Spaces:
Sleeping
Task Management System (Microservices)
A Spring Cloud microservice ecosystem for managing tasks with a React front-end. An API Gateway exposes the platform through a single port, Eureka provides service discovery, and MongoDB persists user, task, and submission data. The solution can be run locally with Gradle/npm or containerised end-to-end with Docker Compose.
Overview
This project implements a Task Management system using a microservices architecture. The system consists of three main microservices plus infrastructure components:
- TaskUserService β authentication, JWT issuance, profile and admin endpoints.
- TaskService β task CRUD, assignment and completion workflows.
- TaskSubmissionService β submission lifecycle and coordination with other services via OpenFeign.
- EurekaServerConfiguration β service registry for discovery and health status.
- APIGateway β Spring Cloud Gateway with resilience policies and CORS/fallback handling.
- task-management-ui β React SPA consuming the gateway APIs.
Additional runtime services in Docker Compose:
- MongoDB (Docker)
- Zipkin (Docker) for tracing
Tech stack
- Java 17, Spring Boot 3.2, Spring Cloud 2023.0
- Gradle 8
- React 18 (Create React App)
- Node.js 18+, npm 9+
- MongoDB 6
- Docker & Docker Compose (Docker Engine 24+, Compose v2 recommended)
- Spring Security, Resilience4j, OpenFeign, Micrometer/Zipkin
Repository layout (high level)
APIGateWay/ # Spring Cloud Gateway service
EurekaServerConfiguration/ # Eureka discovery server
TaskUserService/ # Authentication / User management service
TaskService/ # Task domain microservice
TaskSubmissionService/ # Submission microservice
task-management-ui/ # React single page application
build-all.sh # Builds all services and UI
run-system.sh # Builds and launches full stack with Compose
stop-system.sh # Stops the Compose stack
docker-compose.yml # Compose orchestration for services + MongoDB + Zipkin
Features (selected)
UserService
POST /auth/signupβ user registrationPOST /auth/signinβ authentication (returns JWT)GET /api/user/profileβ get user profile
TaskService
POST /api/tasks/createβ create new task (admin only)GET /api/tasks/{taskId}β get task detailsPUT /api/tasks/{taskId}/assign/{userId}β assign task to user (admin only)
TaskSubmissionService
POST /api/submissions/submitβ submit completed task (authenticated users)GET /api/submissions/{submissionId}β get submission details
Configuration
All Spring services accept environment overrides (via environment variables or application-*.properties) for values such as:
| Variable | Applies to | Purpose | Default (local) |
|---|---|---|---|
SERVER_PORT |
All Spring services | HTTP port override | service-specific |
SPRING_APP_NAME |
All services | Service identifier / registration name | - |
EUREKA_SERVER_URI |
Gateway & microservices | Eureka discovery endpoint | http://localhost:8085/eureka |
MONGODB_URI |
Backends | MongoDB connection string | mongodb://localhost:27017/<db> |
ZIPKIN_BASE_URL |
All services | Zipkin tracing endpoint | http://localhost:9411 |
ZIPKIN_SAMPLER_PROBABILITY |
All services | Tracing sampling rate | 1.0 |
Each service also exposes domain-specific properties (JWT secrets, CORS allowed origins, etc.) in its application.properties/application-docker.properties files. Defaults are safe for local usage but must be overridden for production.
Prerequisites / System requirements
- JDK 17+
- Node.js 18+, npm 9+
- Docker Engine 24+ and Docker Compose v2 (or docker-compose v1)
- 8 GB RAM recommended when running full stack locally
Setup & Running
Option 1 β Full stack via Docker Compose (recommended for quick end-to-end runs)
- (Optional) Create a Docker volume for MongoDB persistence:
docker volume create mongo-data - Build and run everything (the
run-system.shhelper can be used if present):./run-system.sh # or docker compose up --build - Verify services are registered in Eureka (default port shown by the compose file):
- Eureka dashboard:
http://localhost:8085 - API Gateway health:
http://localhost:8090/actuator/health - Zipkin UI:
http://localhost:9411 - React dev UI:
http://localhost:3000(if usingnpm startinstead of build)
- Eureka dashboard:
Stop everything:
./stop-system.sh
# or
docker compose down
To remove persisted MongoDB data:
docker volume rm mongo-data
Option 2 β Run services locally (development)
- Start MongoDB locally or via Docker:
docker run -p 27017:27017 --name mongo -d mongo:6.0 - Start Eureka server:
cd EurekaServerConfiguration ./gradlew bootRun - Start services in separate terminals:
cd TaskUserService && ./gradlew bootRun cd TaskService && ./gradlew bootRun cd TaskSubmissionService && ./gradlew bootRun cd APIGateWay && ./gradlew bootRun - Start React UI (dev mode):
cd task-management-ui npm install npm start
When running behind the gateway, point the UI to the gateway base URL (example .env):
REACT_APP_API_BASE_URL=http://localhost:8090
Build
One-step build (bundles backends and UI)
./build-all.sh
Manual builds
- Backends: inside each service directory
./gradlew clean bootJar -x test
- UI
cd task-management-ui
npm install
npm run build
Troubleshooting
- MongoDB health check fails: ensure your host CPU supports AVX (required for MongoDB 6), or run a remote MongoDB instance and set
MONGODB_URIaccordingly. - Port conflicts: adjust
SERVER_PORTenvironment variable for services. - Gateway CORS errors: set appropriate
GATEWAY_ALLOWED_ORIGIN_*andTASK_ALLOWED_ORIGINSenv vars to match your front-end origin(s). - Zipkin unreachable: either run Zipkin container or comment out
ZIPKIN_BASE_URLin configs to disable tracing.
Verification checklist
- Eureka dashboard shows
USER-SERVICE,TASK-SERVICE, andTASK-SUBMISSIONasUP. - Gateway health endpoint returns
{"status":"UP"}. - Service actuator health endpoints are available (e.g.
http://localhost:8081/actuator/health,:8082,:8083). - MongoDB collections:
users,tasks,submissions.
Notes
- Admin-only endpoints are protected by role checks (create/assign tasks).
- OpenFeign is used for inter-service HTTP clients.
- Production deployments should rotate secrets and secure all JWT keys / database credentials.
Contribution
Contributions are welcome β open an issue or submit a PR.
License
This project is licensed under the MIT License.
Happy shipping! π