docs: Align documentation with true microservices architecture
Transform all documentation from modular monolith to true microservices
architecture where core services are independently deployable.
Key Changes:
- Core Kernel: Infrastructure only (no business logic)
- Core Services: Auth, Identity, Authz, Audit as separate microservices
- Each service has own entry point (cmd/{service}/)
- Each service has own gRPC server and database schema
- Services register with Consul for service discovery
- API Gateway: Moved from Epic 8 to Epic 1 as core infrastructure
- Single entry point for all external traffic
- Handles routing, JWT validation, rate limiting, CORS
- Service Discovery: Consul as primary mechanism (ADR-0033)
- Database Pattern: Per-service connections with schema isolation
Documentation Updates:
- Updated all 9 architecture documents
- Updated 4 ADRs and created 2 new ADRs (API Gateway, Service Discovery)
- Rewrote Epic 1: Core Kernel & Infrastructure (infrastructure only)
- Rewrote Epic 2: Core Services (Auth, Identity, Authz, Audit as services)
- Updated Epic 3-8 stories for service architecture
- Updated plan.md, playbook.md, requirements.md, index.md
- Updated all epic READMEs and story files
New ADRs:
- ADR-0032: API Gateway Strategy
- ADR-0033: Service Discovery Implementation (Consul)
New Stories:
- Epic 1.7: Service Client Interfaces
- Epic 1.8: API Gateway Implementation
This commit is contained in:
@@ -19,18 +19,22 @@ Data flows through the platform in multiple patterns depending on the type of op
|
||||
|
||||
### Standard HTTP Request Flow
|
||||
|
||||
Complete data flow from HTTP request to response.
|
||||
Complete data flow from HTTP request through API Gateway to backend service and response.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
Start[HTTP Request] --> Auth[Authentication]
|
||||
Auth -->|Valid| Authz[Authorization]
|
||||
Auth -->|Invalid| Error1[401 Response]
|
||||
Start[HTTP Request] --> Gateway[API Gateway]
|
||||
Gateway --> RateLimit{Rate Limit Check}
|
||||
RateLimit -->|Allowed| Auth[Validate JWT via Auth Service]
|
||||
RateLimit -->|Exceeded| Error0[429 Too Many Requests]
|
||||
|
||||
Authz -->|Authorized| Handler[Request Handler]
|
||||
Authz -->|Unauthorized| Error2[403 Response]
|
||||
Auth -->|Valid| Authz[Check Permission via Authz Service]
|
||||
Auth -->|Invalid| Error1[401 Unauthorized]
|
||||
|
||||
Handler --> Service[Domain Service]
|
||||
Authz -->|Authorized| Route[Route to Backend Service]
|
||||
Authz -->|Unauthorized| Error2[403 Forbidden]
|
||||
|
||||
Route --> Service[Backend Service]
|
||||
Service --> Cache{Cache Check}
|
||||
|
||||
Cache -->|Hit| CacheData[Return Cached Data]
|
||||
@@ -42,17 +46,19 @@ graph TD
|
||||
Service --> CacheStore[Update Cache]
|
||||
|
||||
Service --> EventBus[Publish Events]
|
||||
Service --> Audit[Audit Log]
|
||||
Service --> AuditSvc[Audit Service<br/>gRPC]
|
||||
Service --> Metrics[Update Metrics]
|
||||
|
||||
Service --> Handler
|
||||
Handler --> Response[HTTP Response]
|
||||
CacheData --> Response
|
||||
Service --> Gateway
|
||||
Gateway --> Response[HTTP Response]
|
||||
CacheData --> Gateway
|
||||
Error0 --> Response
|
||||
Error1 --> Response
|
||||
Error2 --> Response
|
||||
|
||||
Response --> Client[Client]
|
||||
|
||||
style Gateway fill:#4a90e2,stroke:#2e5c8a,stroke-width:3px,color:#fff
|
||||
style Auth fill:#ff6b6b,stroke:#c92a2a,stroke-width:2px,color:#fff
|
||||
style Service fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff
|
||||
style Cache fill:#4a90e2,stroke:#2e5c8a,stroke-width:2px,color:#fff
|
||||
@@ -60,22 +66,30 @@ graph TD
|
||||
|
||||
### Request Data Transformation
|
||||
|
||||
How request data is transformed as it flows through the system.
|
||||
How request data is transformed as it flows through API Gateway to backend service.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Client
|
||||
participant Handler
|
||||
participant Gateway
|
||||
participant BackendService
|
||||
participant Service
|
||||
participant Repo
|
||||
participant DB
|
||||
|
||||
Client->>Handler: HTTP Request (JSON)
|
||||
Handler->>Handler: Parse JSON
|
||||
Handler->>Handler: Validate request
|
||||
Handler->>Handler: Convert to DTO
|
||||
Client->>Gateway: HTTP Request (JSON)
|
||||
Gateway->>Gateway: Rate limiting
|
||||
Gateway->>Gateway: Validate JWT (via Auth Service)
|
||||
Gateway->>Gateway: Check permission (via Authz Service)
|
||||
Gateway->>Gateway: Route to service (via service discovery)
|
||||
Gateway->>Gateway: Forward request (gRPC/HTTP)
|
||||
|
||||
Handler->>Service: Business DTO
|
||||
Gateway->>BackendService: Request (gRPC/HTTP)
|
||||
BackendService->>BackendService: Parse request
|
||||
BackendService->>BackendService: Validate request
|
||||
BackendService->>BackendService: Convert to DTO
|
||||
|
||||
BackendService->>Service: Business DTO
|
||||
Service->>Service: Business logic
|
||||
Service->>Service: Domain entity
|
||||
|
||||
@@ -89,10 +103,13 @@ sequenceDiagram
|
||||
|
||||
Service->>Service: Business logic
|
||||
Service->>Service: Response DTO
|
||||
Service-->>Handler: Response DTO
|
||||
Service-->>BackendService: Response DTO
|
||||
|
||||
Handler->>Handler: Convert to JSON
|
||||
Handler-->>Client: HTTP Response (JSON)
|
||||
BackendService->>BackendService: Convert to response format
|
||||
BackendService-->>Gateway: Response (gRPC/HTTP)
|
||||
|
||||
Gateway->>Gateway: Transform response (if needed)
|
||||
Gateway-->>Client: HTTP Response (JSON)
|
||||
```
|
||||
|
||||
## Event Data Flow
|
||||
|
||||
Reference in New Issue
Block a user