A modern, full-stack todo application built for the Cornfield Group Assessment.
This is a complete todo application featuring:
- Backend: Node.js REST API with Express
- Frontend: React application with modern UI
- Database: In-memory storage
- Containerization: Full Docker support with Docker Compose
- Add new todos to the list
- Mark todos as complete
- Delete todos from the list
- Filter by all/active/complete todos
- Clear all completed todos
- Drag and drop to reorder items
- Real-time statistics dashboard
- Toast notifications for user feedback
- Responsive mobile-friendly design
- Optimistic UI updates
- Backend: Node.js with Express (preferred)
- Frontend: React (preferred)
- API Documentation: Comprehensive docs included
- Docker: Both frontend and backend containerized
- Communication: Frontend makes API calls to backend
Prerequisites: Docker and Docker Compose installed
# Clone or navigate to project directory
cd Cornfield
# Build and run both services
docker-compose up --build
# Or run in background
docker-compose up -d --buildAccess the application:
- Frontend: http://localhost:80
- Backend API: http://localhost:5000/api/health
Prerequisites: Node.js 16+ installed
# Start Backend (Terminal 1)
cd server
npm install
npm start
# Start Frontend (Terminal 2)
cd client
npm install
npm startAccess the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000/api/health
Cornfield/
├── server/ # Backend API
│ ├── server.js # Main server file
│ ├── package.json # Backend dependencies
│ ├── Dockerfile # Backend container config
│ ├── healthcheck.js # Health check script
│ ├── test-api.js # API testing script
│ ├── api-tester.html # Interactive API tester
│ ├── API_DOCUMENTATION.md # Complete API docs
│ └── README.md # Backend documentation
├── client/ # Frontend React App
│ ├── src/
│ │ ├── App.js # Main React component
│ │ ├── api.js # API service layer
│ │ └── components/ # React components
│ ├── public/ # Static assets
│ ├── package.json # Frontend dependencies
│ ├── Dockerfile # Production container config
│ ├── Dockerfile.dev # Development container config
│ ├── nginx.conf # Nginx configuration
│ └── README.md # Frontend documentation
├── docker-compose.yml # Production Docker setup
├── docker-compose.dev.yml # Development Docker setup
└── README.md # This file
# Build and run production containers
docker-compose up --build
# Stop containers
docker-compose down
# View logs
docker-compose logs
# Rebuild specific service
docker-compose build server
docker-compose build client# Build and run development containers (with hot reload)
docker compose -f docker-compose.dev.yml up --build
# Stop development containers
docker compose -f docker-compose.dev.yml down# Build backend only
cd server
docker build -t cornfield-api .
docker run -p 5000:5000 cornfield-api
# Build frontend only
cd client
docker build -t cornfield-frontend .
docker run -p 80:80 cornfield-frontendBackend (server/.env):
PORT=5000
NODE_ENV=production
Frontend:
- Development: Automatically proxies to
http://localhost:5000 - Production: Uses Nginx reverse proxy to backend
- Frontend: Port 80 (production) / 3000 (development)
- Backend: Port 5000
- API Endpoints:
/api/*
Complete API documentation is available at:
- File:
server/API_DOCUMENTATION.md - Interactive Tester:
server/api-tester.html - Health Check: http://localhost:5000/api/health
GET /api/todos- Get all todosPOST /api/todos- Create todoPUT /api/todos/:id- Update todoDELETE /api/todos/:id- Delete todoDELETE /api/todos/completed/clear- Clear completedPUT /api/todos/reorder- Reorder todos (drag & drop)GET /api/stats- Get statistics
cd server
# Test with Node.js script
node test-api.js
# Test with interactive HTML page
open api-tester.htmlcd client
# Run React tests
npm test
# Build production version
npm run build- Start both services (Docker or locally)
- Open frontend in browser
- Test all CRUD operations
- Verify drag & drop functionality
- Test filtering and statistics
- Modern React UI with hooks and functional components
- Drag & Drop Reordering using react-beautiful-dnd
- Real-time Filtering (All/Active/Completed)
- Toast Notifications for user feedback
- Loading States and error handling
- Responsive Design for mobile devices
- Statistics Dashboard with completion metrics
- Optimistic Updates for smooth UX
- RESTful API with proper HTTP status codes
- In-memory Storage (no database required)
- CORS Support for frontend integration
- Error Handling with consistent response format
- Health Checks for Docker monitoring
- API Documentation with examples
- UUID-based IDs for unique identification
1. Port Already in Use:
# Check what's using the port
netstat -ano | findstr :5000
netstat -ano | findstr :3000
# Kill process if needed (Windows)
taskkill /PID <PID> /F2. Docker Build Issues:
# Clean Docker cache
docker system prune -a
# Rebuild without cache
docker-compose build --no-cache3. API Connection Issues:
- Verify backend is running on port 5000
- Check browser console for CORS errors
- Ensure frontend proxy is configured correctly
4. Dependencies Issues:
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install##Browser Support
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
- Optimistic Updates - Instant UI feedback
- Code Splitting - Lazy loaded components
- Asset Optimization - Minified production builds
- Nginx Caching - Static asset caching
- Gzip Compression - Reduced transfer sizes
Potential improvements for production use:
- Database persistence (MongoDB/PostgreSQL)
- User authentication and authorization
- Real-time updates with WebSockets
- Progressive Web App (PWA) features
- Dark theme support
- Bulk operations (select multiple todos)
- Todo categories and tags
- Due dates and reminders
- Export/Import functionality
For any questions about this implementation, please contact the development team.