
Todo Microservices Application
A production-ready, full-stack todo application built with microservices architecture using Node.js, TypeScript, React, and MySQL. Features complete Docker containerization and comprehensive test coverage.
π Table of Contents
π Architecture Overview
This application follows a microservices architecture with complete containerization support:
Services:
User Service - Handles authentication (register/login) and JWT token generation
Todo Service - Manages CRUD operations for todos with JWT validation
Frontend - React application with Ant Design UI components
Nginx - Reverse proxy for routing and serving static files (Docker mode)
π Tech Stack
Backend
Runtime: Node.js (v18+)
Language: TypeScript
Framework: Express.js
Database: MySQL 8.0
ORM: TypeORM
Authentication: JWT (jsonwebtoken)
Validation: Joi
Security: Helmet, CORS, bcrypt
Testing: Jest, Supertest (95% coverage)
Containerization: Docker, Docker Compose
Frontend
Framework: React 18
UI Library: Ant Design (antd)
Routing: React Router v6
HTTP Client: Axios
State Management: React Hooks
Styling: CSS, Ant Design styles
Build: Create React App
DevOps
Containerization: Docker, Docker Compose
Testing: Jest, Supertest
Code Quality: ESLint, Prettier
π¦ Prerequisites
For Local Development:
Node.js (v16.0.0 or higher)
npm (v7.0.0 or higher)
MySQL (v8.0 or higher)
Git
For Docker Deployment:
Docker (v20.10.0 or higher)
Docker Compose (v2.0.0 or higher)
Verify Installation:
π Project Structure
π Installation & Setup
Option 1: Quick Start with Docker (Recommended)
Option 2: Local Development Setup
Step 1: Clone the Repository
Step 2: Setup MySQL Databases
Step 3: Setup and Run Services
π³ Docker Deployment
Production Deployment
Development with Hot Reload
Docker Commands Reference
Using Makefile
π§ͺ Testing
Test Coverage Summary
User Service: 20 test cases covering authentication
Todo Service: 34 test cases covering CRUD operations
Total Coverage: >90% code coverage
Running Tests
All Tests
Test Categories
Test in Docker
Test Database Setup
Test Examples
User Registration Test
Todo CRUD Test
π API Documentation
Base URLs
User Service:
http://localhost:3001Todo Service:
http://localhost:3002Authentication Flow
Endpoints Summary
User Service
Method Endpoint Description Auth Required POST
/api/auth/register Register new user No POST /api/auth/login Login user No GET /health Health check NoTodo Service
Method Endpoint Description Auth Required POST
/api/todos Create todo Yes GET /api/todos Get all todos Yes GET /api/todos/:id Get single todo Yes PUT /api/todos/:id Update todo Yes DELETE /api/todos/:id Delete todo Yes GET /health Health check NoPostman Collection
Import the complete Postman collection from
api-docs/postman-collection.json for easy API testing.Example Requests
Register User
Create Todo
π§ Environment Variables
User Service (.env)
Todo Service (.env)
Frontend (.env)
Docker Environment (.env.docker)
π Troubleshooting
Common Issues and Solutions
Docker Issues
Container won't start:
Database connection fails:
Testing Issues
Tests failing with "Field 'uuid' doesn't have a default value":
JWT token mismatch:
Ensure both services use the same JWT_SECRET
Check token expiration time
Development Issues
CORS errors:
Port already in use:
Development Guidelines
Write tests for all new features
Maintain >80% code coverage
Follow TypeScript best practices
Use ESLint and Prettier for code formatting
Update documentation for API changes
π₯ Authors
Ahmad Anis - Initial work and architecture
π Acknowledgments
Built as a technical challenge demonstrating microservices architecture
Implements industry best practices for Node.js and React development
Features comprehensive test coverage and Docker containerization
Follows RESTful API design principles
Implements proper authentication and authorization with JWT
π Project Status
β
Core functionality complete
β
Docker containerization implemented
β
Comprehensive test suite (54+ test cases)
β
Production-ready with security best practices
π§ CI/CD pipeline (optional enhancement)
π§ Kubernetes deployment (future enhancement)
Happy Coding! π
For questions or support, please open an issue in the repository.
0 likes Β· 16 views Β· Aug 12, 2025
Developed a microservices-based todo app with Node.js, React, and Docker.