This system is actively under development.
📚 Interactive Documentation: Click the DeepWiki badge above to explore AI-powered documentation you can chat with!
- 🔐 Advanced Security: RSA key rotation with Redis-based distribution
- 📦 Microservices Architecture: Independently deployable services
- 🚀 Event-Driven: Kafka for asynchronous communication
- 🎯 Role-Based Access: Admin, Courier, and Client roles
- 🔄 Service Discovery: Automatic service registration with Eureka
- 📊 Centralized Logging: Error tracking across all services
Courier-App is an enterprise-grade courier management system implemented using a modern microservices architecture.
It supports:
- Admins
- Couriers
- Clients
Architecture includes:
- React + TypeScript frontend
- Spring Boot microservices
- Spring Cloud Gateway
- Eureka Discovery
- RSA key rotation + JWT authentication
- Redis for key distribution, session metadata & caching
- Kafka event-driven communication
- MySQL persistence
- Makefile orchestration
- Docker Compose infrastructure service
This is a true monorepo - all code lives in a single repository without submodules.
courier-app/
│
├── courier-backend/ # Contains all backend microservices
| ├── api-gateway/ # Spring Cloud Gateway
│ ├── auth-service/ # Authentication + RSA key generation + JWT cookies
│ ├── order-service/ # Order management
│ ├── user-service/ # User management (admin/courier/client)
│ ├── resource-service/ # Offices, branches, contacts
│ ├── error-service/ # Centralized error logging
│ ├── discovery-service/ # Eureka Service Registry
│ ├── .gitignore
│ └── docker-compose.yml # Infrastructure stack (Kafka, Redis, MySQL, Zookeeper)
│
├── courier-frontend/ # React frontend application
│ └── README.md # Frontend setup instructions
├── package.json # Workspace root configuration
├── Makefile # Local orchestrator
└── README.md # Root README (this file)
- Public-facing entry point for all requests
- Validates JWT using the public key loaded from Redis
- Routes traffic to backend microservices
- Generating RSA key pairs
- Managing public/private key rotation
- Storing all key material safely in Redis
- Creating JWT access & refresh tokens
- Returning tokens via HTTP-only cookies
- Storing session and user metadata in Redis
The auth-service uses Redis as the single source of truth for RSA key material:
-
RSA_KEYS:latest_public_key
Stores the current public key used for JWT signature verification. -
RSA_KEYS:public_keys_list
Stores a bounded list of recent public keys for smooth key rotation. -
RSA_KEYS:private_keys_map
MapspublicKey → privateKey.
Onlyauth-serviceuses this.
No other service ever sees private keys. -
RSA_KEYS:auth_service_secret
An internal secret used by the authentication server. -
MAX_KEYS = 6
Ensures only a limited history of keys is stored.
Oldest keys are automatically discarded (public + private) during rotation.
- On startup (or verification failure), a service loads the latest public key from Redis.
- The service caches the public key in memory to avoid repeated Redis reads.
- When
auth-servicerotates keys, the “latest” key in Redis changes. - Microservices detect this on the next refresh or verification failure and reload the updated key.
This approach ensures:
- Zero exposure of private keys
- Automatic propagation of new keys
- Consistent JWT verification across services
- Eureka-based registry
- Tracks all running microservices
- Supports dynamic service lookup & load balancing
- Creating, updating, and disabling users
- Managing roles (admin, courier, client)
- Integrating with
resource-servicevia Feign - Synchronizing contact data for client users
- Business rules (e.g., office/branch assignments)
- Receiving tokens via cookies when calling resource-service
- Offices
- Branches
- Contacts
- Searching (city, name, enabled branches)
- Role-restricted CRUD using
@PreAuthorize - Publishing errors to Kafka for the error-service
- JWT verification using the Redis-loaded public key
- Order creation & updates
- Delivery status transitions
- Date validation (createdAt vs deliveryDate)
- Publishing order events to Kafka
- Caching order-related metadata in Redis
- Kafka consumer for centralized error logging
- Persists error entries in MySQL
- Helps with cross-service debugging & observability
The backend stack includes:
| Service | Port | Description |
|---|---|---|
| MySQL | 3306 | Main database |
| Redis | 6379 | Key/secret storage + token/cache |
| Kafka | 9092 | Event streaming |
| Zookeeper | 2181 | Kafka coordination |
| Eureka | 8761 | Service registry |
| API Gateway | 8080 | Entry point |
| Auth Service | 8088 | RSA keys + JWT issuing |
| Order Service | 8081 | Orders |
| Resource Service | 8083 | Offices, branches, contacts |
| User Service | 8084 | Users + roles |
| Error Service | 8082 | Logging |
Built using:
- React + TypeScript
- Redux Toolkit
- Axios
- Material UI + Bootstrap
- Vite
Features include:
- Role-based UI (Admin, Courier, Client)
- Generic
ItemsContainersystem - Advanced search filters + debounced text search
- Inline create forms
- Modal-based update forms
- Snackbar system based on
notistack - Clean architecture with adapters and business separation
- Node.js and npm (for the frontend)
- Java 17 (for the backend services)
- Docker & Docker Compose (installed and running)
- Maven (for building backend services)
git clone https://github.com/dmaman86/courier-app.git
cd courier-app
npm installThe Makefile is the main orchestrator for running the entire system locally.
-
Run EVERYTHING (infrastructure + backend + frontend):
make start-all
This executes, in order:
- Infrastructure (Kafka, Redis, MySQL, Zookeeper)
- Discovery Service
- API Gateway
- All backend microservices
- Frontend application
-
Stop the entire system:
make stop-all
This stops:
- Frontend
- All backend microservices
- Infrastructure containers
-
Start infrastructure services:
make start-infra
-
Start Discovery Service:
make start-discovery
-
Start API Gateway:
make start-api-gateway
-
Start all backend microservices:
make start-microservices
-
Start a specific microservice:
make start-microservice SERVICE=auth-service
-
Start infrastructure manually:
cd courier-backend docker-compose -f docker-compose-infra.yml up -d -
Start a microservice manually:
cd courier-backend/auth-service mvn spring-boot:run
Recommended order:
discovery-serviceapi-gatewayauth-serviceresource-serviceuser-serviceorder-serviceerror-service
You can verify the services are running correctly by visiting the Eureka Dashboard:
http://localhost:8761/
All services should appear as UP.
-
Start frontend:
make start-frontend
-
Stop frontend:
make stop-frontend
cd courier-frontend
npm install
npm run devFrontend available at:
http://localhost:5173/courier-app/
- The full Dockerization of the project is not yet completed, except for the use of Kafka. Please follow the instructions above to run the project locally.
Contributions are welcome! Please create a pull request or open an issue to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE.md file for details.