Skip to content

Commit b4eaa1b

Browse files
committed
Improving readme with c4 model diagrams
1 parent 8e82a79 commit b4eaa1b

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,45 @@
1414
# Background
1515
A foundational framework for building **Spring Boot**-based microservices, designed for a **modular**, **scalable**, and **observable** system to manage **courses** and **reviews**. It incorporates **Spring Security** with **OAuth 2.0** via **Keycloak** for **authentication** and **Spring Cloud Gateway** as the **API gateway**. The architecture integrates a modern **observability stack**, including **OpenTelemetry (OTel)**, **Grafana**, **Loki**, **Tempo**, and **Prometheus**. **MongoDB** and **PostgreSQL** serve as **persistent storage** solutions. Deployment is supported through **Docker Compose** for **local environments** and **Kubernetes** for **scalable deployments**. The system utilizes **Spring Boot** and **Spring Cloud** to enable seamless **microservices communication**, **security**, and **observability**.
1616

17+
# Container Diagram
18+
19+
## Description
20+
The **Course Management System** consists of multiple Spring Boot microservices, a gateway, databases, and external systems for authentication and observability, deployed via Docker Compose or Kubernetes (Tilt).
21+
22+
## Containers
23+
| Container | Technology | Description |
24+
|--------------------------|-------------------------|--------------------------------------------------|
25+
| **Gateway Service** | Spring Cloud Gateway | Routes requests to microservices, handles load balancing. |
26+
| **Course Service** | Spring Boot | Manages course data, interacts with Postgres. |
27+
| **Review Service** | Spring Boot | Manages review data, interacts with MongoDB. |
28+
| **Course Composite Service** | Spring Boot | Aggregates data from Course and Review Services. |
29+
| **Postgres Database** | PostgreSQL | Stores course data for Course Service. |
30+
| **MongoDB Database** | MongoDB | Stores review data for Review Service. |
31+
| **Keycloak** | Keycloak | External auth server for SSO and role-based access. |
32+
| **Grafana** | Grafana | Visualization for metrics, logs, and traces. |
33+
| **Loki** | Loki | Log aggregation system. |
34+
| **Tempo** | Tempo | Distributed tracing system. |
35+
| **Fluent-bit** | Fluent-bit | Log forwarding agent. |
36+
| **Otel Collector** | OpenTelemetry | Collects and exports telemetry data. |
37+
38+
## Interactions
39+
- **Users/Admin****Gateway Service**: HTTP requests via browser/API client.
40+
- **Gateway Service****Keycloak**: Authenticates requests (OAuth2/JWT).
41+
- **Gateway Service****Course Service**: Routes course-related requests.
42+
- **Gateway Service****Review Service**: Routes review-related requests.
43+
- **Gateway Service****Course Composite Service**: Routes aggregate requests.
44+
- **Course Service****Postgres Database**: CRUD operations for course data.
45+
- **Review Service****MongoDB Database**: CRUD operations for review data.
46+
- **Course Composite Service****Course Service**: Fetches course data.
47+
- **Course Composite Service****Review Service**: Fetches review data.
48+
- **All Services****Fluent-bit**: Sends logs.
49+
- **All Services****Otel Collector**: Sends metrics and traces.
50+
- **Fluent-bit****Loki**: Forwards logs.
51+
- **Otel Collector****Tempo**: Sends traces.
52+
- **Otel Collector****Grafana**: Sends metrics.
53+
- **Grafana****Loki**: Queries logs.
54+
- **Grafana****Tempo**: Queries traces.
55+
1756
# Architecture
1857
---
1958
### Level 1: System Context Diagram
@@ -31,6 +70,7 @@ A foundational framework for building **Spring Boot**-based microservices, desig
3170
- User → System: HTTP requests via Gateway.
3271
- System → Keycloak: Authenticates users.
3372
- System → Grafana Stack: Sends observability data.
73+
![System context](notes/images/context-level1.png)
3474
---
3575
### Level 2: Container Diagram
3676
**Description**: Breaks the system into deployable units.
@@ -64,6 +104,7 @@ A foundational framework for building **Spring Boot**-based microservices, desig
64104
- **Tempo**: Trace storage.
65105
- **Grafana**: Visualization.
66106
- Interactions: Microservices → Fluent-bit/OTel → Loki/Tempo → Grafana.
107+
![Container](notes/images/container-level2.png)
67108
---
68109
### Level 3: Component Diagram
69110
**Description**: Key components within containers.
@@ -87,6 +128,8 @@ A foundational framework for building **Spring Boot**-based microservices, desig
87128
- Review Service (Logic).
88129
- Review Repository (MongoDB).
89130
- Observability Agent.
131+
132+
![Component](notes/images/component-level3.png)
90133
---
91134
### Level 4: Deployment Notes
92135
**Description**: Two deployment setups.
@@ -101,12 +144,14 @@ A foundational framework for building **Spring Boot**-based microservices, desig
101144
- Resources: Ingress, Services, ConfigMaps/Secrets, PVCs.
102145
- Tilt: Automates dev with live updates.
103146
- Observability: Fluent-bit DaemonSet
147+
![Deployment](notes/images/deployment-level4.png)
104148

105149
### Additional Notes
106150
- **Tech**: Spring Boot, Spring Cloud, JPA, MongoDB driver, OTel, Fluent-bit.
107151
- **Interactions**: REST/HTTP, JDBC, MongoDB protocol.
108152
- **Scalability**: Kubernetes supports replicas; Docker Compose for local dev.
109153

154+
110155
# Prerequisites
111156

112157
- **Java 17+** (Recommended for Spring Boot 3.x)

notes/images/component-level3.png

554 KB
Loading

notes/images/container-level2.png

419 KB
Loading

notes/images/context-level1.png

409 KB
Loading

notes/images/deployment-level4.png

407 KB
Loading

0 commit comments

Comments
 (0)