Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://huggingface.co/spaces/ishans24/microservices
Browse files- README.md +5 -218
- README_.md +219 -0
README.md
CHANGED
|
@@ -1,219 +1,6 @@
|
|
| 1 |
-
# Task Management System (Microservices)
|
| 2 |
-
|
| 3 |
-
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.
|
| 4 |
-
|
| 5 |
---
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
- **TaskUserService** β authentication, JWT issuance, profile and admin endpoints.
|
| 12 |
-
- **TaskService** β task CRUD, assignment and completion workflows.
|
| 13 |
-
- **TaskSubmissionService** β submission lifecycle and coordination with other services via OpenFeign.
|
| 14 |
-
- **EurekaServerConfiguration** β service registry for discovery and health status.
|
| 15 |
-
- **APIGateway** β Spring Cloud Gateway with resilience policies and CORS/fallback handling.
|
| 16 |
-
- **task-management-ui** β React SPA consuming the gateway APIs.
|
| 17 |
-
|
| 18 |
-
Additional runtime services in Docker Compose:
|
| 19 |
-
- **MongoDB** (Docker)
|
| 20 |
-
- **Zipkin** (Docker) for tracing
|
| 21 |
-
|
| 22 |
-
---
|
| 23 |
-
|
| 24 |
-
## Tech stack
|
| 25 |
-
|
| 26 |
-
- Java 17, Spring Boot 3.2, Spring Cloud 2023.0
|
| 27 |
-
- Gradle 8
|
| 28 |
-
- React 18 (Create React App)
|
| 29 |
-
- Node.js 18+, npm 9+
|
| 30 |
-
- MongoDB 6
|
| 31 |
-
- Docker & Docker Compose (Docker Engine 24+, Compose v2 recommended)
|
| 32 |
-
- Spring Security, Resilience4j, OpenFeign, Micrometer/Zipkin
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
## Repository layout (high level)
|
| 36 |
-
|
| 37 |
-
```
|
| 38 |
-
APIGateWay/ # Spring Cloud Gateway service
|
| 39 |
-
EurekaServerConfiguration/ # Eureka discovery server
|
| 40 |
-
TaskUserService/ # Authentication / User management service
|
| 41 |
-
TaskService/ # Task domain microservice
|
| 42 |
-
TaskSubmissionService/ # Submission microservice
|
| 43 |
-
task-management-ui/ # React single page application
|
| 44 |
-
build-all.sh # Builds all services and UI
|
| 45 |
-
run-system.sh # Builds and launches full stack with Compose
|
| 46 |
-
stop-system.sh # Stops the Compose stack
|
| 47 |
-
docker-compose.yml # Compose orchestration for services + MongoDB + Zipkin
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
---
|
| 51 |
-
|
| 52 |
-
## Features (selected)
|
| 53 |
-
|
| 54 |
-
### UserService
|
| 55 |
-
- `POST /auth/signup` β user registration
|
| 56 |
-
- `POST /auth/signin` β authentication (returns JWT)
|
| 57 |
-
- `GET /api/user/profile` β get user profile
|
| 58 |
-
|
| 59 |
-
### TaskService
|
| 60 |
-
- `POST /api/tasks/create` β create new task (admin only)
|
| 61 |
-
- `GET /api/tasks/{taskId}` β get task details
|
| 62 |
-
- `PUT /api/tasks/{taskId}/assign/{userId}` β assign task to user (admin only)
|
| 63 |
-
|
| 64 |
-
### TaskSubmissionService
|
| 65 |
-
- `POST /api/submissions/submit` β submit completed task (authenticated users)
|
| 66 |
-
- `GET /api/submissions/{submissionId}` β get submission details
|
| 67 |
-
|
| 68 |
-
---
|
| 69 |
-
|
| 70 |
-
## Configuration
|
| 71 |
-
|
| 72 |
-
All Spring services accept environment overrides (via environment variables or `application-*.properties`) for values such as:
|
| 73 |
-
|
| 74 |
-
| Variable | Applies to | Purpose | Default (local) |
|
| 75 |
-
|---|---:|---|---:|
|
| 76 |
-
| `SERVER_PORT` | All Spring services | HTTP port override | service-specific |
|
| 77 |
-
| `SPRING_APP_NAME` | All services | Service identifier / registration name | - |
|
| 78 |
-
| `EUREKA_SERVER_URI` | Gateway & microservices | Eureka discovery endpoint | `http://localhost:8085/eureka` |
|
| 79 |
-
| `MONGODB_URI` | Backends | MongoDB connection string | `mongodb://localhost:27017/<db>` |
|
| 80 |
-
| `ZIPKIN_BASE_URL` | All services | Zipkin tracing endpoint | `http://localhost:9411` |
|
| 81 |
-
| `ZIPKIN_SAMPLER_PROBABILITY` | All services | Tracing sampling rate | `1.0` |
|
| 82 |
-
|
| 83 |
-
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.
|
| 84 |
-
|
| 85 |
-
---
|
| 86 |
-
|
| 87 |
-
## Prerequisites / System requirements
|
| 88 |
-
|
| 89 |
-
- JDK 17+
|
| 90 |
-
- Node.js 18+, npm 9+
|
| 91 |
-
- Docker Engine 24+ and Docker Compose v2 (or docker-compose v1)
|
| 92 |
-
- 8 GB RAM recommended when running full stack locally
|
| 93 |
-
|
| 94 |
-
---
|
| 95 |
-
|
| 96 |
-
## Setup & Running
|
| 97 |
-
|
| 98 |
-
### Option 1 β Full stack via Docker Compose (recommended for quick end-to-end runs)
|
| 99 |
-
|
| 100 |
-
1. (Optional) Create a Docker volume for MongoDB persistence:
|
| 101 |
-
```bash
|
| 102 |
-
docker volume create mongo-data
|
| 103 |
-
```
|
| 104 |
-
2. Build and run everything (the `run-system.sh` helper can be used if present):
|
| 105 |
-
```bash
|
| 106 |
-
./run-system.sh
|
| 107 |
-
# or
|
| 108 |
-
docker compose up --build
|
| 109 |
-
```
|
| 110 |
-
3. Verify services are registered in Eureka (default port shown by the compose file):
|
| 111 |
-
- Eureka dashboard: `http://localhost:8085`
|
| 112 |
-
- API Gateway health: `http://localhost:8090/actuator/health`
|
| 113 |
-
- Zipkin UI: `http://localhost:9411`
|
| 114 |
-
- React dev UI: `http://localhost:3000` (if using `npm start` instead of build)
|
| 115 |
-
|
| 116 |
-
Stop everything:
|
| 117 |
-
```bash
|
| 118 |
-
./stop-system.sh
|
| 119 |
-
# or
|
| 120 |
-
docker compose down
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
-
To remove persisted MongoDB data:
|
| 124 |
-
```bash
|
| 125 |
-
docker volume rm mongo-data
|
| 126 |
-
```
|
| 127 |
-
|
| 128 |
-
### Option 2 β Run services locally (development)
|
| 129 |
-
|
| 130 |
-
1. Start MongoDB locally or via Docker:
|
| 131 |
-
```bash
|
| 132 |
-
docker run -p 27017:27017 --name mongo -d mongo:6.0
|
| 133 |
-
```
|
| 134 |
-
2. Start Eureka server:
|
| 135 |
-
```bash
|
| 136 |
-
cd EurekaServerConfiguration
|
| 137 |
-
./gradlew bootRun
|
| 138 |
-
```
|
| 139 |
-
3. Start services in separate terminals:
|
| 140 |
-
```bash
|
| 141 |
-
cd TaskUserService && ./gradlew bootRun
|
| 142 |
-
cd TaskService && ./gradlew bootRun
|
| 143 |
-
cd TaskSubmissionService && ./gradlew bootRun
|
| 144 |
-
cd APIGateWay && ./gradlew bootRun
|
| 145 |
-
```
|
| 146 |
-
4. Start React UI (dev mode):
|
| 147 |
-
```bash
|
| 148 |
-
cd task-management-ui
|
| 149 |
-
npm install
|
| 150 |
-
npm start
|
| 151 |
-
```
|
| 152 |
-
|
| 153 |
-
When running behind the gateway, point the UI to the gateway base URL (example `.env`):
|
| 154 |
-
```
|
| 155 |
-
REACT_APP_API_BASE_URL=http://localhost:8090
|
| 156 |
-
```
|
| 157 |
-
|
| 158 |
-
---
|
| 159 |
-
|
| 160 |
-
## Build
|
| 161 |
-
|
| 162 |
-
### One-step build (bundles backends and UI)
|
| 163 |
-
|
| 164 |
-
```bash
|
| 165 |
-
./build-all.sh
|
| 166 |
-
```
|
| 167 |
-
|
| 168 |
-
### Manual builds
|
| 169 |
-
|
| 170 |
-
- Backends: inside each service directory
|
| 171 |
-
```bash
|
| 172 |
-
./gradlew clean bootJar -x test
|
| 173 |
-
```
|
| 174 |
-
- UI
|
| 175 |
-
```bash
|
| 176 |
-
cd task-management-ui
|
| 177 |
-
npm install
|
| 178 |
-
npm run build
|
| 179 |
-
```
|
| 180 |
-
|
| 181 |
-
---
|
| 182 |
-
|
| 183 |
-
## Troubleshooting
|
| 184 |
-
|
| 185 |
-
- **MongoDB health check fails**: ensure your host CPU supports AVX (required for MongoDB 6), or run a remote MongoDB instance and set `MONGODB_URI` accordingly.
|
| 186 |
-
- **Port conflicts**: adjust `SERVER_PORT` environment variable for services.
|
| 187 |
-
- **Gateway CORS errors**: set appropriate `GATEWAY_ALLOWED_ORIGIN_*` and `TASK_ALLOWED_ORIGINS` env vars to match your front-end origin(s).
|
| 188 |
-
- **Zipkin unreachable**: either run Zipkin container or comment out `ZIPKIN_BASE_URL` in configs to disable tracing.
|
| 189 |
-
|
| 190 |
-
---
|
| 191 |
-
|
| 192 |
-
## Verification checklist
|
| 193 |
-
|
| 194 |
-
- Eureka dashboard shows `USER-SERVICE`, `TASK-SERVICE`, and `TASK-SUBMISSION` as `UP`.
|
| 195 |
-
- Gateway health endpoint returns `{"status":"UP"}`.
|
| 196 |
-
- Service actuator health endpoints are available (e.g. `http://localhost:8081/actuator/health`, `:8082`, `:8083`).
|
| 197 |
-
- MongoDB collections: `users`, `tasks`, `submissions`.
|
| 198 |
-
|
| 199 |
-
---
|
| 200 |
-
|
| 201 |
-
## Notes
|
| 202 |
-
|
| 203 |
-
- Admin-only endpoints are protected by role checks (create/assign tasks).
|
| 204 |
-
- OpenFeign is used for inter-service HTTP clients.
|
| 205 |
-
- Production deployments should rotate secrets and secure all JWT keys / database credentials.
|
| 206 |
-
|
| 207 |
-
---
|
| 208 |
-
|
| 209 |
-
## Contribution
|
| 210 |
-
|
| 211 |
-
Contributions are welcome β open an issue or submit a PR.
|
| 212 |
-
|
| 213 |
-
## License
|
| 214 |
-
|
| 215 |
-
This project is licensed under the MIT License.
|
| 216 |
-
|
| 217 |
-
---
|
| 218 |
-
|
| 219 |
-
*Happy shipping! π*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: microservices
|
| 3 |
+
sdk: docker
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: blue
|
| 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Task Management System (Microservices)
|
| 2 |
+
|
| 3 |
+
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.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Overview
|
| 8 |
+
|
| 9 |
+
This project implements a Task Management system using a microservices architecture. The system consists of three main microservices plus infrastructure components:
|
| 10 |
+
|
| 11 |
+
- **TaskUserService** β authentication, JWT issuance, profile and admin endpoints.
|
| 12 |
+
- **TaskService** β task CRUD, assignment and completion workflows.
|
| 13 |
+
- **TaskSubmissionService** β submission lifecycle and coordination with other services via OpenFeign.
|
| 14 |
+
- **EurekaServerConfiguration** β service registry for discovery and health status.
|
| 15 |
+
- **APIGateway** β Spring Cloud Gateway with resilience policies and CORS/fallback handling.
|
| 16 |
+
- **task-management-ui** β React SPA consuming the gateway APIs.
|
| 17 |
+
|
| 18 |
+
Additional runtime services in Docker Compose:
|
| 19 |
+
- **MongoDB** (Docker)
|
| 20 |
+
- **Zipkin** (Docker) for tracing
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## Tech stack
|
| 25 |
+
|
| 26 |
+
- Java 17, Spring Boot 3.2, Spring Cloud 2023.0
|
| 27 |
+
- Gradle 8
|
| 28 |
+
- React 18 (Create React App)
|
| 29 |
+
- Node.js 18+, npm 9+
|
| 30 |
+
- MongoDB 6
|
| 31 |
+
- Docker & Docker Compose (Docker Engine 24+, Compose v2 recommended)
|
| 32 |
+
- Spring Security, Resilience4j, OpenFeign, Micrometer/Zipkin
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
## Repository layout (high level)
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
APIGateWay/ # Spring Cloud Gateway service
|
| 39 |
+
EurekaServerConfiguration/ # Eureka discovery server
|
| 40 |
+
TaskUserService/ # Authentication / User management service
|
| 41 |
+
TaskService/ # Task domain microservice
|
| 42 |
+
TaskSubmissionService/ # Submission microservice
|
| 43 |
+
task-management-ui/ # React single page application
|
| 44 |
+
build-all.sh # Builds all services and UI
|
| 45 |
+
run-system.sh # Builds and launches full stack with Compose
|
| 46 |
+
stop-system.sh # Stops the Compose stack
|
| 47 |
+
docker-compose.yml # Compose orchestration for services + MongoDB + Zipkin
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
## Features (selected)
|
| 53 |
+
|
| 54 |
+
### UserService
|
| 55 |
+
- `POST /auth/signup` β user registration
|
| 56 |
+
- `POST /auth/signin` β authentication (returns JWT)
|
| 57 |
+
- `GET /api/user/profile` β get user profile
|
| 58 |
+
|
| 59 |
+
### TaskService
|
| 60 |
+
- `POST /api/tasks/create` β create new task (admin only)
|
| 61 |
+
- `GET /api/tasks/{taskId}` β get task details
|
| 62 |
+
- `PUT /api/tasks/{taskId}/assign/{userId}` β assign task to user (admin only)
|
| 63 |
+
|
| 64 |
+
### TaskSubmissionService
|
| 65 |
+
- `POST /api/submissions/submit` β submit completed task (authenticated users)
|
| 66 |
+
- `GET /api/submissions/{submissionId}` β get submission details
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## Configuration
|
| 71 |
+
|
| 72 |
+
All Spring services accept environment overrides (via environment variables or `application-*.properties`) for values such as:
|
| 73 |
+
|
| 74 |
+
| Variable | Applies to | Purpose | Default (local) |
|
| 75 |
+
|---|---:|---|---:|
|
| 76 |
+
| `SERVER_PORT` | All Spring services | HTTP port override | service-specific |
|
| 77 |
+
| `SPRING_APP_NAME` | All services | Service identifier / registration name | - |
|
| 78 |
+
| `EUREKA_SERVER_URI` | Gateway & microservices | Eureka discovery endpoint | `http://localhost:8085/eureka` |
|
| 79 |
+
| `MONGODB_URI` | Backends | MongoDB connection string | `mongodb://localhost:27017/<db>` |
|
| 80 |
+
| `ZIPKIN_BASE_URL` | All services | Zipkin tracing endpoint | `http://localhost:9411` |
|
| 81 |
+
| `ZIPKIN_SAMPLER_PROBABILITY` | All services | Tracing sampling rate | `1.0` |
|
| 82 |
+
|
| 83 |
+
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.
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## Prerequisites / System requirements
|
| 88 |
+
|
| 89 |
+
- JDK 17+
|
| 90 |
+
- Node.js 18+, npm 9+
|
| 91 |
+
- Docker Engine 24+ and Docker Compose v2 (or docker-compose v1)
|
| 92 |
+
- 8 GB RAM recommended when running full stack locally
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## Setup & Running
|
| 97 |
+
|
| 98 |
+
### Option 1 β Full stack via Docker Compose (recommended for quick end-to-end runs)
|
| 99 |
+
|
| 100 |
+
1. (Optional) Create a Docker volume for MongoDB persistence:
|
| 101 |
+
```bash
|
| 102 |
+
docker volume create mongo-data
|
| 103 |
+
```
|
| 104 |
+
2. Build and run everything (the `run-system.sh` helper can be used if present):
|
| 105 |
+
```bash
|
| 106 |
+
./run-system.sh
|
| 107 |
+
# or
|
| 108 |
+
docker compose up --build
|
| 109 |
+
```
|
| 110 |
+
3. Verify services are registered in Eureka (default port shown by the compose file):
|
| 111 |
+
- Eureka dashboard: `http://localhost:8085`
|
| 112 |
+
- API Gateway health: `http://localhost:8090/actuator/health`
|
| 113 |
+
- Zipkin UI: `http://localhost:9411`
|
| 114 |
+
- React dev UI: `http://localhost:3000` (if using `npm start` instead of build)
|
| 115 |
+
|
| 116 |
+
Stop everything:
|
| 117 |
+
```bash
|
| 118 |
+
./stop-system.sh
|
| 119 |
+
# or
|
| 120 |
+
docker compose down
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
To remove persisted MongoDB data:
|
| 124 |
+
```bash
|
| 125 |
+
docker volume rm mongo-data
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
### Option 2 β Run services locally (development)
|
| 129 |
+
|
| 130 |
+
1. Start MongoDB locally or via Docker:
|
| 131 |
+
```bash
|
| 132 |
+
docker run -p 27017:27017 --name mongo -d mongo:6.0
|
| 133 |
+
```
|
| 134 |
+
2. Start Eureka server:
|
| 135 |
+
```bash
|
| 136 |
+
cd EurekaServerConfiguration
|
| 137 |
+
./gradlew bootRun
|
| 138 |
+
```
|
| 139 |
+
3. Start services in separate terminals:
|
| 140 |
+
```bash
|
| 141 |
+
cd TaskUserService && ./gradlew bootRun
|
| 142 |
+
cd TaskService && ./gradlew bootRun
|
| 143 |
+
cd TaskSubmissionService && ./gradlew bootRun
|
| 144 |
+
cd APIGateWay && ./gradlew bootRun
|
| 145 |
+
```
|
| 146 |
+
4. Start React UI (dev mode):
|
| 147 |
+
```bash
|
| 148 |
+
cd task-management-ui
|
| 149 |
+
npm install
|
| 150 |
+
npm start
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
When running behind the gateway, point the UI to the gateway base URL (example `.env`):
|
| 154 |
+
```
|
| 155 |
+
REACT_APP_API_BASE_URL=http://localhost:8090
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
---
|
| 159 |
+
|
| 160 |
+
## Build
|
| 161 |
+
|
| 162 |
+
### One-step build (bundles backends and UI)
|
| 163 |
+
|
| 164 |
+
```bash
|
| 165 |
+
./build-all.sh
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
### Manual builds
|
| 169 |
+
|
| 170 |
+
- Backends: inside each service directory
|
| 171 |
+
```bash
|
| 172 |
+
./gradlew clean bootJar -x test
|
| 173 |
+
```
|
| 174 |
+
- UI
|
| 175 |
+
```bash
|
| 176 |
+
cd task-management-ui
|
| 177 |
+
npm install
|
| 178 |
+
npm run build
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
---
|
| 182 |
+
|
| 183 |
+
## Troubleshooting
|
| 184 |
+
|
| 185 |
+
- **MongoDB health check fails**: ensure your host CPU supports AVX (required for MongoDB 6), or run a remote MongoDB instance and set `MONGODB_URI` accordingly.
|
| 186 |
+
- **Port conflicts**: adjust `SERVER_PORT` environment variable for services.
|
| 187 |
+
- **Gateway CORS errors**: set appropriate `GATEWAY_ALLOWED_ORIGIN_*` and `TASK_ALLOWED_ORIGINS` env vars to match your front-end origin(s).
|
| 188 |
+
- **Zipkin unreachable**: either run Zipkin container or comment out `ZIPKIN_BASE_URL` in configs to disable tracing.
|
| 189 |
+
|
| 190 |
+
---
|
| 191 |
+
|
| 192 |
+
## Verification checklist
|
| 193 |
+
|
| 194 |
+
- Eureka dashboard shows `USER-SERVICE`, `TASK-SERVICE`, and `TASK-SUBMISSION` as `UP`.
|
| 195 |
+
- Gateway health endpoint returns `{"status":"UP"}`.
|
| 196 |
+
- Service actuator health endpoints are available (e.g. `http://localhost:8081/actuator/health`, `:8082`, `:8083`).
|
| 197 |
+
- MongoDB collections: `users`, `tasks`, `submissions`.
|
| 198 |
+
|
| 199 |
+
---
|
| 200 |
+
|
| 201 |
+
## Notes
|
| 202 |
+
|
| 203 |
+
- Admin-only endpoints are protected by role checks (create/assign tasks).
|
| 204 |
+
- OpenFeign is used for inter-service HTTP clients.
|
| 205 |
+
- Production deployments should rotate secrets and secure all JWT keys / database credentials.
|
| 206 |
+
|
| 207 |
+
---
|
| 208 |
+
|
| 209 |
+
## Contribution
|
| 210 |
+
|
| 211 |
+
Contributions are welcome β open an issue or submit a PR.
|
| 212 |
+
|
| 213 |
+
## License
|
| 214 |
+
|
| 215 |
+
This project is licensed under the MIT License.
|
| 216 |
+
|
| 217 |
+
---
|
| 218 |
+
|
| 219 |
+
*Happy shipping! π*
|