A professional full-stack todo list application showcasing modern architecture patterns
Built with Node.js Fastify + React + Comprehensive Testing
- 🔬 Backend API Integration Tests - Lightning fast API testing, no mocks (AI could gets confused with mocks)
- 🌐 End-to-End Tests - Complete user workflow validation (tests via React app)
A professional full-stack todo list application built with modern web technologies and object-oriented architecture. This system demonstrates enterprise-level patterns, comprehensive testing, and clean separation of concerns across both frontend and backend.
- Modern UI Design: Professional business-style interface with Chakra UI v2 components
- Real-time Updates: Instant todo modifications with optimistic updates
- Responsive Design: Mobile-first approach with consistent styling
- Error Handling: Comprehensive error states with user-friendly toast notifications
- Loading States: Visual feedback for all operations with proper loading indicators
- Form Validation: Input validation with clear error messages
- Multiple Operations: Create, update, toggle completion, and delete todos with inline editing
- RESTful API: Full CRUD operations with proper HTTP methods and status codes
- Data Persistence: SQLite database with automatic schema management
- Error Handling: Structured error responses with detailed messages
- Data Validation: Comprehensive input validation using Fastify schemas
- CORS Support: Cross-origin requests enabled for development and production
- Auto-documentation: Swagger/OpenAPI docs with Fastify
- Object-Oriented Architecture: Clean separation with services, repositories, and controllers
- Modern React: Hooks-based components with custom hooks for business logic
- State Management: TanStack React Query for server state with caching and synchronization
- Testing Strategy: Multi-layered testing with unit, integration, and end-to-end tests
- Development Experience: Vite hot reload, auto-restart, and comprehensive error feedback
backend/
├── main.js # Fastify application setup and route definitions
├── models.js # Database models using Knex query builder
├── schemas.js # Fastify schemas for request/response validation
├── services.js # Business logic layer with service classes
├── controllers.js # HTTP request/response handling layer
├── repositories.js # Data access layer with repository pattern
├── test_api.test.js # Jest unit and integration tests
└── package.json # Node.js 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 Error Handling: Structured error responses with proper HTTP status codes
- 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
Service-Oriented Design:
- Base Service Class: Generic HTTP operations with error handling
- Specialized Services: Domain-specific API operations extending base class
- Custom Hooks: React Query integration with service layer abstraction
- Component Separation: UI components separated from business logic
- Type-Safe Operations: JSDoc annotations for better development experience
e2e/
├── tests/todo.test.js # Comprehensive user workflow tests (Playwright)
└── pyproject.toml # Test configuration
| Test Type | Count | Speed | Coverage |
|---|---|---|---|
| 🔬 Backend Unit | 12 tests | ⚡ 0.45s | 🎯 100% API |
| 🌐 End-to-End | 13 tests | 🚀 10.4s | 🎭 Full UX |
| 🏆 Total | 25 tests | ⚡ < 11s | 🎉 Complete |
Our testing strategy follows the Testing Pyramid principle with three distinct layers that each serve specific purposes:
Lightning-fast API validation in under 0.5 seconds
🎯 What We Test:
- ✅ All CRUD Operations - Create, Read, Update, Delete, Toggle
- ✅ Error Scenarios - 404s, validation failures, edge cases
- ✅ Data Integrity - Business rules and validation logic
- ✅ Complex Workflows - Multi-step operations and state changes
- ✅ Performance - Sub-second execution with database isolation
🚀 Benefits:
- ⚡ Instant feedback - Results in 0.45 seconds
- 🔒 Perfect isolation - Fresh database per test
- 📊 Complete coverage - Every API endpoint tested
- 🛡️ Bulletproof reliability - Zero flaky tests
Complete user journey validation with real browser interactions
🎭 What We Test:
- ✅ User Workflows - Complete todo creation, editing, deletion flows
- ✅ Visual Validation - UI state changes and visual feedback
- ✅ Browser Integration - Real Chrome/Firefox testing with Playwright
- ✅ Data Persistence - Changes survive page refreshes and navigation
- ✅ Error Detection - Console error monitoring during interactions
- ✅ Complex Scenarios - Multi-todo operations and edge cases
🎯 Benefits:
- 🎭 Real user simulation - Actual browser clicks and typing
- 🏗️ Full system validation - Database → API → UI → User
- 📸 Visual regression - Screenshot-based change detection
- 🚀 Production confidence - Tests mirror real usage patterns
- Node.js 18+ 📦
- npm ⚙️
git clone <repository-url>
cd vite-koajs-todolist
# Backend setup 🚀
cd backend
npm install
# Frontend setup ⚛️
cd ../frontend
npm install# Terminal 1: Backend (Port 3000) 🚀
cd backend
npm run dev
# Terminal 2: Frontend (Port 5173) ⚡
cd frontend
npm run dev# 🔬 Backend unit tests (12 tests, fast)
cd backend
npm test
# 🌐 End-to-end tests (13 tests)
cd e2e
npm test
# ⚡ Quick smoke test
cd e2e
npm run test:e2eFrontend: http://localhost:5173 | API: http://localhost:3000
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:3000
- Health Check: http://localhost:3000/health
vite-python-fastapi-todolist/
├── backend/ # FastAPI backend
│ ├── main.py # App setup & routes
│ ├── models.py # Database models
│ ├── services.py # Business logic
│ └── test_api.py # Unit tests
├── frontend/ # React frontend
│ ├── src/
│ │ ├── App.jsx # Main component
│ │ └── services/ # API services
│ └── package.json
├── e2e/ # End-to-end tests
│ └── test_todo_e2e.py
└── README.md
- 🎯 Professional Chakra UI - Business-grade design system
- ✏️ Inline Editing - Click-to-edit with save/cancel controls
- ⚡ Real-time Updates - Instant visual feedback on all operations
- 🔔 Smart Notifications - Toast messages for user feedback
- 📱 Responsive Design - Perfect on desktop, tablet, and mobile
- 🎭 Loading States - Professional loading indicators throughout
- 🔥 FastAPI Framework - Auto-generated OpenAPI documentation
- 🗃️ SQLite + Knex.js - Lightweight, powerful data persistence
- 🎯 Full CRUD Operations - Complete REST API with proper HTTP codes
- 🛡️ Pydantic Validation - Type-safe input validation and serialization
- 📡 CORS Ready - Cross-origin support for seamless frontend integration
- 🔧 Structured Errors - Detailed error responses with helpful messages
GET /api/todos # 📋 Get all todos
GET /api/todos/{id} # 🔍 Get specific todo
POST /api/todos # ➕ Create new todo
PUT /api/todos/{id} # ✏️ Update todo
POST /api/todos/{id}/toggle # ✅ Toggle completion
DELETE /api/todos/{id} # 🗑️ Delete todo
- ➕ Create todos with title and optional description
- ✅ Toggle completion with satisfying checkbox interactions
- ✏️ Inline editing with dedicated edit mode and cancel option
- 🗑️ Delete todos with visual confirmation feedback
- 🎨 Visual states - Distinct styling for completed vs pending
- 📊 Progress tracking - Live badge counters showing completion status
This todo application demonstrates several advanced development patterns:
- Layered Architecture: Separation of controllers, services, repositories, and models
- Repository Pattern: Data access abstraction with service integration
- Exception Handling: Custom exceptions with proper HTTP status mapping
- ORM Integration: Peewee ORM with SQLite for simple yet powerful data persistence
- Service Layer: HTTP client abstraction with TodoService extending ApiService
- Custom Hooks: useTodos hook integrating TanStack React Query with services
- State Management: Server state management with optimistic updates
- Component Design: Professional UI components with consistent styling
- Unit Testing: Backend API testing with pytest and test database isolation
- E2E Testing: Full user workflow testing with Playwright
- Error Monitoring: Console error detection during browser interactions
- Test Isolation: Proper cleanup and setup for reliable test execution
- Development Setup: Follow the Quick Start guide
- Testing: Ensure all tests pass before submitting changes
- Run backend tests:
cd backend && npm test - Run E2E tests:
python3 -m pytest test_todo_e2e.py -v
- Run backend tests:
- Code Style: Follow existing patterns and maintain consistent formatting
- Documentation: Update README if adding new features or changing APIs
This todo application serves as a comprehensive example of modern full-stack development with professional patterns, thorough testing, and clean architecture.