This project is a TODO application that implements CRUD operations using a FastAPI backend, a React frontend, and PostgreSQL as the database. The application allows users to create, read, update, and delete TODO items.
todo-app
├── .github
│ └── workflows
├── backend
│ ├── app
│ │ ├── core
│ │ │ ├── todo_logging.py
│ │ │ └── __init__.py
│ │ ├── db
│ │ │ ├── init_db.py
│ │ │ └── __init__.py
│ │ ├── models
│ │ │ ├── todo_models.py
│ │ │ └── __init__.py
│ │ ├── routers
│ │ │ ├── todo_routers.py
│ │ │ └── __init__.py
│ │ ├── schemas
│ │ │ ├── todo_schemas.py
│ │ │ └── __init__.py
│ │ ├── services
│ │ │ ├── todo_services.py
│ │ │ └ __init__.py
│ │ ├── exceptions
│ │ ├── main.py
│ │ └── todo_dependencies.py
│ ├── tests
├── frontend
│ ├── public
│ └── src
│ ├── components
│ └── services
│ ├── tests
├── infra
│ ├── bicep
│ └── kubernetes
├── scripts
│ ├── db
│ └── other_scripts
├── docs
└── README.md
The backend is built using FastAPI and is organized into several modules:
- Core: Contains configuration and dependency management, including logging setup.
- DB: Handles database connections and interactions with PostgreSQL.
- Models: Defines data models using SQLAlchemy ORM.
- Routers: Contains route definitions for handling CRUD operations.
- Schemas: Defines Pydantic schemas for request and response validation.
- Services: Contains business logic for the application.
The frontend is built using React and is structured as follows:
- Public: Contains static assets such as images and the index.html file.
- Src: Contains React components and service functions for API calls.
- Tests: Contains unit tests for components and services.
-
Clone the repository:
git clone https://github.com/ppenumatsa1/todo-app cd todo-app
-
Set up the PostgreSQL database and run the initialization script:
psql -U your-username -f scripts/db/init.sql
-
Install the required dependencies for the backend:
cd backend python -m venv venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate` export PYTHONPATH=./backend # On Windows use `$env:PYTHONPATH = "./backend"` pip install -r requirements.txt
-
Run the backend server:
uvicorn app.main:app --reload
-
Install the required dependencies for the frontend:
cd frontend export NODE_OPTION=--openssl-legacy-provider # On Windows use `$env:PYTHONPATH = "$env:NODE_OPTIONS="--openssl-legacy-provider""` npm install
-
Run the frontend server:
npm run build serve -s build
- Use the API endpoints defined in the backend to interact with TODO items.
- The frontend provides a user interface to manage TODO items.
Unit tests are provided for both the backend and frontend. Run the tests to ensure the application functions as expected.
Refer to the docs
folder for additional documentation related to the project.