A full-stack todo list app repo template to kickstart any of your projects
Built with FastAPI + React Vite, JSX + Comprehensive Integration Testing
Iterate from a todo list to any app. Use this repo as a base.
- 1 - Clone the repo
- 2 - Run claude code or your favourite coding CLI
- 3 - Run this prompt:
this is a todolist app - you need to change this todolist app to be a .... - 4 - profit!
backend/
├── main.py # FastAPI application setup and route definitions
├── models.py # Database models using Peewee ORM
├── schemas.py # Pydantic models for request/response validation
├── services.py # Business logic layer with service classes
├── controllers.py # HTTP request/response handling layer
├── repositories.py # Data access layer with repository pattern
├── test_api.py # Unit and integration tests
└── requirements.txt # Python dependencies
Object-Oriented Design Patterns:
- Service Layer:
TodoServicehandles all business logic operations - Repository Pattern:
TodoRepositorymanages data access and response model conversion - Controller Layer:
TodoControllerhandles HTTP concerns and error translation - Custom Exceptions: Domain-specific exceptions for better error handling
- Dependency Injection: Clean separation of concerns with minimal coupling
frontend/
├── src/
│ ├── App.jsx # Main application component
│ ├── main.jsx # Application entry point with providers
│ ├── services/
│ │ ├── ApiService.js # Base HTTP client class
│ │ └── TodoService.js # Todo-specific API operations
│ ├── hooks/
│ │ └── useTodos.js # Custom hook for todo operations
│ └── index.css # Global styles
├── package.json # Dependencies and scripts
├── vite.config.js # Build configuration
└── playwright.config.js # E2E test configuration
e2e/
├── test_todo_e2e.py # Comprehensive user workflow tests
└── pyproject.toml # Test configuration
- Python 3.11+ 🐍
- Node.js 18+ 📦
- npm/yarn ⚙️
git clone <repository-url>
cd vite-python-fastapi-todolist
# Backend setup 🐍
cd backend
pip install -r requirements.txt
# Frontend setup ⚛️
cd ../frontend
npm install# Terminal 1: Backend (Port 8000) 🚀
cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Terminal 2: Frontend (Port 5173) ⚡
cd frontend
npm run dev# 🔬 Backend unit tests (12 tests, 0.45s)
cd backend
pytest test_api.py -v
# 🌐 End-to-end tests (13 tests, 10.4s)
cd e2e && python3 -m pytest test_todo_e2e.py -v
# ⚡ Quick smoke test
python3 -m pytest test_todo_e2e.py::TestTodoAppE2E::test_app_title -vFrontend: http://localhost:5173 | API: http://localhost:8000 | Docs: http://localhost:8000/docs
All API endpoints are prefixed with /api/todos
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Get all todos |
POST |
/ |
Create new todo |
GET |
/{id} |
Get specific todo |
PUT |
/{id} |
Update todo |
POST |
/{id}/toggle |
Toggle todo completion |
DELETE |
/{id} |
Delete todo |
Create Todo
POST /api/todos
Content-Type: application/json
{
"title": "Learn FastAPI",
"description": "Build a todo app with Python and React"
}Toggle Todo Completion
POST /api/todos/1/toggle- Start Services: Backend (port 8000) + Frontend (port 5173)
- Interactive API Docs: Visit http://localhost:8000/docs for Swagger UI
- Hot Reload: Both services support hot reload for rapid development
- Testing: Run unit tests first, then E2E tests for integration validation
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Alternative API docs: http://localhost:8000/redoc
NOTE:
Integration tests passing in 0.12s
Iterate on integration tests but also have at the end of your session / context limit a e2e test run to pass.
Iterate from a todo list to any app. Use this repo as a base.