How artemas-muzanenhamo/gov-poc works
Project Type and Purpose
• This is a Spring Boot‐based proof‐of‐concept full‐stack microservice application (no UI in this repo, UI lives in a separate repo).
• It demonstrates a typical Spring Cloud microservice stack: configuration server, service registry (Eureka), API gateway (Zuul), three business microservices, plus MongoDB.
• README confirms purpose: show data flow, service registration/discovery, externalized config, API gateway routing, contract testing with Pact.
File Structure Analysis
Top‐level directories correspond to each service/module:
• configuration-server – spring‐cloud‐config server
• discovery-server – Eureka service registry
• gateway – Zuul API gateway
• health-service, identity-service, license-service – three Spring Boot microservices
• mongodb – Dockerfile for MongoDB
• pacts – consumer‐driven contract files
Common patterns:
• Each service has its own build.gradle, Dockerfile, src/main/java, src/main/resources/bootstrap.yml/application.yml, and tests.
• docker-compose.yml orchestrates all containers.
Architecture from README
• A centralized Config Server serves config properties to all services.
• Services register with the Discovery Server (Eureka).
• API Gateway (Zuul) routes external traffic to internal services via service names.
• Business services call one another (License calls Identity) through Eureka behind‐the‐scenes.
• MongoDB backs all business services.
• Pact JSONs under pacts/ verify inter‐service contracts between identity ↔ health and identity ↔ license.
a. Main Components
1. Config Server
2. Discovery Server (Eureka)
3. API Gateway (Zuul)
4. Identity Service
5. License Service
6. Health Service
7. MongoDB Database
8. Pact Broker/Contract Files (pacts/) – optional consumer‐driven testing component
9. docker-compose orchestration layer
b. Relationships & Data Flows
• On startup, each microservice (identity, license, health) pulls its config from the Config Server.
• Each service registers its instance and health‐check endpoint with the Discovery Server.
• External client requests → API Gateway → routes (by service name) → Discovery Server resolves instances → forwards to appropriate service.
• License Service invokes Identity Service via service name lookup in Eureka (to validate IDs).
• All services persist/retrieve data from the shared MongoDB instance.
• Pact tests: consumer (health or license) uses pacts/health-service-identity-service.json / pacts/license-service-identity-service.json to validate against provider (identity).
c. Architectural Patterns & Design Principles
• Microservice decomposition: one bounded‐context per service.
• API Gateway pattern (Zuul) for entry point, routing, and edge concerns.
• Service Registry pattern (Eureka) for service discovery and client‐side load balancing.
• Externalized Configuration pattern (Spring Cloud Config).
• Consumer‐Driven Contract Testing (Pact).
• Containerization & orchestration (Docker, docker-compose).
d. Key Technologies & Frameworks
• Spring Boot & Spring Cloud (Config, Netflix Eureka, Zuul)
• MongoDB (NoSQL datastore)
• Docker & Docker Compose
• Pact for CDC testing
• Gradle build system
Essential Details to Capture
• Service names and ports (9999 for gateway/discovery, default boot ports).
• Config repo paths (e.g., /shared/*.yml resource files).
• Contract test artifacts under pacts.