A modern, full-stack TODO application built with React, FastAPI, and PostgreSQL. Features a beautiful, responsive UI with Tailwind CSS and a robust REST API backend.
- Modern UI: Beautiful, responsive design with Tailwind CSS
- Real-time Updates: Add and complete tasks instantly
- Persistent Storage: PostgreSQL database with automated schema setup
- RESTful API: FastAPI backend with automatic API documentation
- Docker Support: Complete containerized setup for easy deployment
- Responsive Design: Works perfectly on desktop and mobile devices
- React
19.1.1- Modern UI library with hooks - Vite
7.1.7- Lightning-fast build tool and dev server - Tailwind CSS
3.4.18- Utility-first CSS framework - PostCSS
8.5.6- CSS processing and optimization - ESLint
9.36.0- Code linting and formatting
- FastAPI - Modern, fast Python web framework
- Uvicorn - Lightning-fast ASGI server
- SQLAlchemy - Python SQL toolkit and ORM
- Pydantic - Data validation using Python type hints
- psycopg2-binary - PostgreSQL adapter for Python
- PostgreSQL
16.10- Advanced open-source relational database
- Docker - Containerization platform
- Docker Compose - Multi-container application orchestration
- Nginx - High-performance web server and reverse proxy
Before running this application, make sure you have:
- Docker (v20.0 or higher)
- Docker Compose (v2.0 or higher)
- Node.js
20.x(for local development) - Python
3.11+(for local development)
-
Clone the repository
git clone <repository-url> cd TODO_APP
-
Start the application
docker-compose up --build
-
Access the application
- Frontend: http://localhost:8080
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
cd backend
pip install -r requirements.txt
export DATABASE_URL="postgresql+psycopg2://user:password@localhost:5432/todo_db"
uvicorn main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
npm run dev# Start PostgreSQL (using Docker)
docker run --name todo_db -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -e POSTGRES_DB=todo_db -p 5432:5432 -v ./db/schema.sql:/docker-entrypoint-initdb.d/schema.sql postgres:16-alpineTODO_APP/
βββ backend/ # FastAPI backend
β βββ main.py # Main application file
β βββ requirements.txt # Python dependencies
β βββ Dockerfile # Backend container config
βββ frontend/ # React frontend
β βββ src/
β β βββ App.jsx # Main React component
β β βββ main.jsx # React entry point
β β βββ index.css # Global styles with Tailwind
β βββ package.json # Node.js dependencies
β βββ tailwind.config.js # Tailwind configuration
β βββ vite.config.js # Vite configuration
β βββ nginx.conf # Nginx configuration
β βββ Dockerfile # Frontend container config
βββ db/
β βββ schema.sql # Database schema and sample data
βββ docker-compose.yml # Multi-container configuration
βββ README.md # This file
The application uses a simple but effective schema:
CREATE TABLE task (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
is_completed BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);The application supports the following environment variables:
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql+psycopg2://user:password@db:5432/todo_db |
PORT |
Backend server port | 8000 |
- db: PostgreSQL database with automatic schema initialization
- api: FastAPI backend server
- web: Nginx server serving the React frontend and proxying API requests
| Method | Endpoint | Description |
|---|---|---|
GET |
/tasks |
Get the 5 most recent incomplete tasks |
POST |
/tasks |
Create a new task |
PATCH |
/tasks/{task_id}/complete |
Mark a task as completed |
GET |
/docs |
Interactive API documentation |
# Get tasks
curl http://localhost:8000/tasks
# Create a task
curl -X POST http://localhost:8000/tasks \
-H "Content-Type: application/json" \
-d '{"title": "Buy groceries", "description": "Milk, bread, eggs"}'
# Complete a task
curl -X PATCH http://localhost:8000/tasks/1/complete- Responsive Grid Layout: Two-column layout on large screens, single column on mobile
- Modern Form Design: Clean input fields with focus states
- Task Cards: Beautiful cards with shadows and hover effects
- Loading States: Visual feedback during API calls
- Error Handling: User-friendly error messages
- Smooth Animations: Hover effects and transitions
- Build Stage: Node.js 20 Alpine for building the React app
- Production Stage: Nginx Alpine for serving static files and API proxying
- Base: Python 3.11 Slim for optimal performance
- Features: Automatic dependency installation and hot-reload support
- Base: PostgreSQL 16 Alpine
- Features: Automatic schema initialization with sample data
- CSS not loading: Ensure Tailwind CSS v3.x is installed (not v4.x beta)
- API connection errors: Check that all containers are running with
docker-compose ps - Database connection issues: Verify PostgreSQL is ready before starting API
- Port conflicts: Ensure ports 8080, 8000, and 5432 are available
# View container logs
docker-compose logs -f [service-name]
# Restart services
docker-compose restart
# Rebuild containers
docker-compose up --build --force-recreate
# Clean up
docker-compose down -v
docker system prune- Update environment variables for production database
- Configure reverse proxy (e.g., Nginx, Traefik)
- Set up SSL certificates for HTTPS
- Configure monitoring and logging
- Set up backup strategy for PostgreSQL
# Production
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# Development
docker-compose up --build- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- FastAPI for the excellent Python web framework
- React for the powerful UI library
- Tailwind CSS for the beautiful styling system
- Docker for containerization support
Built with β€οΈ using modern web technologies