A complete microservices architecture demonstrating modern DevOps practices with containerization, orchestration, and deployment on Kubernetes/Minikube.
This project implements a production-ready microservices application featuring:
- Frontend: React SPA with responsive UI for auth flows
- Backend: Node.js REST API with protected endpoints
- Auth Service: Dedicated microservice for authentication (JWT-based)
- Database: PostgreSQL with persistent storage
- Containerization: Docker with multi-stage builds
- Orchestration: Kubernetes manifests with 3 replicas per service
- Security: Password hashing (bcrypt), JWT tokens, secrets management
fullstack-microservices/
βββ frontend/ # React application
β βββ src/
β β βββ components/ # Login, Signup, ForgotPassword, etc.
β β βββ App.js
β β βββ index.js
β βββ Dockerfile
β βββ nginx.conf
β βββ package.json
βββ backend/ # Backend REST API
β βββ server.js
β βββ Dockerfile
β βββ package.json
β βββ README.md
βββ auth-service/ # Authentication microservice
β βββ server.js
β βββ Dockerfile
β βββ package.json
β βββ README.md
βββ db/ # Database initialization
β βββ init.sql
β βββ README.md
βββ k8s/ # Kubernetes manifests
β βββ namespace.yaml
β βββ configmap.yaml
β βββ secrets.yaml
β βββ pv-pvc.yaml
β βββ db-deployment.yaml
β βββ auth-deployment.yaml
β βββ backend-deployment.yaml
β βββ frontend-deployment.yaml
β βββ ingress.yaml
β βββ kustomization.yaml
βββ docs/ # Documentation
β βββ deployment-guide.md
β βββ demo-script.md
β βββ architecture-diagram.png
βββ scripts/ # Automation scripts
β βββ demo-test.sh
β βββ build-images.sh
β βββ deploy-k8s.sh
βββ docker-compose.yml # Local development
βββ README.md # This file
- β User signup with validation
- β Login with JWT access/refresh tokens
- β Forgot password with secure token generation
- β Reset password with token verification
- β Password hashing with bcrypt (10 rounds)
- β Token-based stateless authentication
- β Service isolation with clear boundaries
- β Inter-service communication via HTTP
- β Independent scaling (3 replicas each)
- β Health checks and readiness probes
- β Configuration via ConfigMaps and Secrets
- β Dockerfiles with multi-stage builds
- β Docker Compose for local development
- β Kubernetes manifests with best practices
- β PersistentVolume for database
- β NodePort services for external access
- β Resource requests and limits
- β Liveness and readiness probes
- Docker (20.10+)
- Docker Compose (1.29+)
- Minikube (1.30+)
- kubectl (1.26+)
- Node.js 18+ (for local development)
# Clone the repository
cd fullstack-microservices
# Start all services
docker compose up --build
# Access the application
# Frontend: http://localhost:3000
# Auth Service: http://localhost:3001
# Backend: http://localhost:5000Test the application:
# Signup
curl -X POST http://localhost:3001/signup \
-H "Content-Type: application/json" \
-d '{"name":"John Doe","email":"john@example.com","password":"SecurePass123"}'
# Login
curl -X POST http://localhost:3001/login \
-H "Content-Type: application/json" \
-d '{"email":"john@example.com","password":"SecurePass123"}'
# Get profile (use token from login)
TOKEN="<access-token>"
curl -H "Authorization: Bearer $TOKEN" http://localhost:5000/profileSee detailed guide in docs/deployment-guide.md
# 1. Start Minikube
minikube start --cpus=4 --memory=8192
# 2. Build and load images
eval $(minikube docker-env)
docker build -t frontend:latest ./frontend
docker build -t backend:latest ./backend
docker build -t auth-service:latest ./auth-service
# 3. Deploy to Kubernetes
kubectl apply -f k8s/
# 4. Check deployment
kubectl get pods -n microservices
# 5. Access frontend
minikube service frontend-service -n microservices
# 6. Get Minikube IP for API access
minikube ipAuth Service (.env):
PORT=3001
DB_HOST=localhost
DB_PORT=5432
DB_NAME=authdb
DB_USER=postgres
DB_PASSWORD=postgres
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_REFRESH_SECRET=your-refresh-secret-key-change-in-productionBackend (.env):
PORT=5000
DB_HOST=localhost
DB_PORT=5432
DB_NAME=authdb
DB_USER=postgres
DB_PASSWORD=postgres
AUTH_SERVICE_URL=http://localhost:3001Frontend (.env):
REACT_APP_AUTH_SERVICE_URL=http://localhost:3001
REACT_APP_BACKEND_SERVICE_URL=http://localhost:5000| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /signup |
Register new user | No |
| POST | /login |
Login and get tokens | No |
| POST | /forgot-password |
Request password reset | No |
| POST | /reset-password |
Reset password with token | No |
| POST | /verify-token |
Verify JWT token | No |
| POST | /refresh-token |
Get new access token | No |
| GET | /health |
Health check | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /profile |
Get user profile | Yes |
| PUT | /profile |
Update profile | Yes |
| GET | /users |
List all users | Yes |
| GET | /public-info |
Public endpoint | No |
| GET | /health |
Health check | No |
/login- Login page/signup- Signup page/forgot-password- Password recovery/reset-password- Password reset with token/dashboard- User dashboard (protected)
# Run demo test script
./scripts/demo-test.sh
# Or run individual service tests
cd auth-service && npm test
cd backend && npm test
cd frontend && npm testSee docs/demo-script.md for step-by-step testing instructions.
Follow the script in docs/demo-script.md to record a demo showing:
- Starting Minikube
- Building and loading images
- Deploying with kubectl
- Showing 3 replicas running
- Testing signup/login flows
- Making authenticated API calls
- Viewing data in dashboard
Each service exposes a /health endpoint:
# Docker Compose
curl http://localhost:3001/health # Auth
curl http://localhost:5000/health # Backend
# Kubernetes (get NodePort first)
MINIKUBE_IP=$(minikube ip)
curl http://$MINIKUBE_IP:30001/health # Auth
curl http://$MINIKUBE_IP:30000/health # Backend# Terminal 1: Start PostgreSQL
docker run -d -p 5432:5432 \
-e POSTGRES_DB=authdb \
-e POSTGRES_PASSWORD=postgres \
postgres:15-alpine
# Terminal 2: Auth Service
cd auth-service
npm install
npm run dev
# Terminal 3: Backend
cd backend
npm install
npm run dev
# Terminal 4: Frontend
cd frontend
npm install
npm start# Docker Compose
docker exec -it postgres-db psql -U postgres -d authdb
# Kubernetes
kubectl port-forward -n microservices svc/postgres-service 5432:5432
psql -h localhost -U postgres -d authdb- Change all default secrets in
.envand Kubernetes secrets - Use external secret managers: Vault, AWS Secrets Manager, etc.
- Enable HTTPS with proper TLS certificates
- Implement rate limiting on auth endpoints
- Use httpOnly cookies instead of localStorage for tokens
- Add CORS with specific origins (not wildcard)
- Enable database SSL connections
- Implement audit logging
- Use network policies to restrict pod-to-pod communication
- Regular security updates and dependency scanning
- Changing all default passwords and secrets
- Implementing proper secret management
- Adding rate limiting and DDoS protection
- Using HTTPS everywhere
- Implementing proper logging and monitoring
- Adding comprehensive error handling
- Implementing database backups
- Adding CI/CD pipelines with security scanning
User β Frontend (React SPA)
β
ββββββ΄βββββ
β β
Auth Service Backend Service
β β
ββββββ¬βββββ
β
PostgreSQL
- User submits credentials to Auth Service
- Auth Service validates and returns JWT tokens
- Frontend stores tokens (localStorage in demo)
- Frontend sends token in Authorization header
- Backend verifies token with Auth Service
- Backend returns protected data
This project demonstrates:
- Microservices Architecture: Service isolation, API design
- Containerization: Docker, multi-stage builds, optimization
- Orchestration: Kubernetes deployments, services, scaling
- Authentication: JWT tokens, password hashing, secure flows
- DevOps: CI/CD-ready, infrastructure as code
- Best Practices: Health checks, resource limits, secrets management
# View logs
docker compose logs -f [service-name]
# Restart services
docker compose restart
# Clean restart
docker compose down -v
docker compose up --build# Check pod status
kubectl get pods -n microservices
# View logs
kubectl logs -n microservices <pod-name>
# Describe pod
kubectl describe pod -n microservices <pod-name>
# Check events
kubectl get events -n microservices --sort-by='.lastTimestamp'- ImagePullBackOff: Ensure images are built and loaded into Minikube
- CrashLoopBackOff: Check logs for errors, verify DB connectivity
- Connection refused: Ensure services are using correct service names
- 401 Unauthorized: Verify token is valid and not expired
Contributions welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
This project is licensed under the MIT License.
- Complete frontend with Signup, Login, Forgot Password, Dashboard
- Backend service with protected endpoints
- Separate auth microservice with JWT implementation
- PostgreSQL database with persistent storage
- Dockerfiles for all services
- docker-compose.yml for local development
- Kubernetes manifests with 3 replicas
- PersistentVolume/PersistentVolumeClaim for database
- ConfigMaps and Secrets
- Health checks and resource limits
- NodePort services for external access
- Documentation (README, deployment guide, demo script)
- Test scripts for automated validation
- Architecture diagram
- Security best practices (bcrypt, JWT, secrets)
For issues or questions:
- Create an issue in the repository
- Check existing documentation
- Review logs for error messages
Built with β€οΈ for learning microservices, Docker, and Kubernetes
