feat: microservice architecture
This commit is contained in:
@@ -1,64 +1,58 @@
|
||||
# Phase 1: Core Kernel & Infrastructure
|
||||
|
||||
## Overview
|
||||
Implement dependency injection container, set up database (Ent ORM), create health and metrics endpoints, implement error bus, and add basic HTTP server with middleware.
|
||||
Extend DI container to support all core services, implement database layer with Ent ORM, build health monitoring and metrics system, create error handling and error bus, establish HTTP server with comprehensive middleware stack, and integrate OpenTelemetry for distributed tracing.
|
||||
|
||||
## Tasks
|
||||
## Stories
|
||||
|
||||
### 1.1 Dependency Injection Container
|
||||
- [1.1.1 - Extend DI Container](./1.1.1-extend-internaldicontainergo.md)
|
||||
- [1.1.2 - Create DI Providers](./1.1.2-create-internaldiprovidersgo.md)
|
||||
- [1.1.3 - Add Core Module](./1.1.3-add-internaldicore_modulego.md)
|
||||
### 1.1 Enhanced Dependency Injection Container
|
||||
- [Story: 1.1 - Enhanced DI Container](./1.1-enhanced-di-container.md)
|
||||
- **Goal:** Extend the DI container to provide all core infrastructure services with proper lifecycle management.
|
||||
- **Deliverables:** Extended DI container, provider functions for all services, core module export
|
||||
|
||||
### 1.2 Database Setup (Ent)
|
||||
- [1.2.1 - Install Ent](./1.2.1-install-entgoioentcmdent.md)
|
||||
- [1.2.2 - Initialize Ent Schema](./1.2.2-initialize-ent-schema.md)
|
||||
- [1.2.3 - Define Core Entities](./1.2.3-define-core-entities-in-internalentschema.md)
|
||||
- [1.2.4 - Generate Ent Code](./1.2.4-generate-ent-code-go-generate-internalent.md)
|
||||
- [1.2.5 - Create Database Client](./1.2.5-create-internalinfradatabaseclientgo.md)
|
||||
- [1.2.6 - Add Database Config](./1.2.6-add-database-config-to-configdefaultyaml.md)
|
||||
### 1.2 Database Layer with Ent ORM
|
||||
- [Story: 1.2 - Database Layer](./1.2-database-layer.md)
|
||||
- **Goal:** Set up a complete database layer using Ent ORM with core domain entities, migrations, and connection management.
|
||||
- **Deliverables:** Ent schema, core entities, database client, migrations, connection pooling
|
||||
|
||||
### 1.3 Health & Metrics
|
||||
- [1.3.1 - Install Prometheus](./1.3.1-install-githubcomprometheusclient_golangprometheus.md)
|
||||
- [1.3.2 - Install Health Check](./1.3.2-install-githubcomheptiolabshealthcheck-optional-or.md)
|
||||
- [1.3.3 - Create Health Interface](./1.3.3-create-pkghealthhealthgo-interface.md)
|
||||
- [1.3.4 - Implement Health Registry](./1.3.4-implement-internalhealthregistrygo.md)
|
||||
- [1.3.5 - Create Metrics](./1.3.5-create-internalmetricsmetricsgo.md)
|
||||
- [1.3.6 - Add Metrics Endpoint](./1.3.6-add-metrics-endpoint-prometheus-format.md)
|
||||
- [1.3.7 - Register Endpoints](./1.3.7-register-endpoints-in-main-http-router.md)
|
||||
### 1.3 Health Monitoring and Metrics System
|
||||
- [Story: 1.3 - Health & Metrics](./1.3-health-metrics-system.md)
|
||||
- **Goal:** Implement comprehensive health checks and Prometheus metrics for monitoring platform health and performance.
|
||||
- **Deliverables:** Health check system, Prometheus metrics, health endpoints, metrics endpoint
|
||||
|
||||
### 1.4 Error Bus
|
||||
- [1.4.1 - Create Error Bus Interface](./1.4.1-create-pkgerrorbuserrorbusgo-interface.md)
|
||||
- [1.4.2 - Implement Channel Bus](./1.4.2-implement-internalerrorbuschannel_busgo.md)
|
||||
- [1.4.3 - Add Panic Recovery Middleware](./1.4.3-add-panic-recovery-middleware-that-publishes-to-er.md)
|
||||
- [1.4.4 - Register Error Bus](./1.4.4-register-error-bus-in-di-container.md)
|
||||
### 1.4 Error Handling and Error Bus
|
||||
- [Story: 1.4 - Error Handling](./1.4-error-handling.md)
|
||||
- **Goal:** Implement centralized error handling with an error bus that captures, logs, and optionally reports all application errors.
|
||||
- **Deliverables:** Error bus interface, channel-based implementation, panic recovery middleware
|
||||
|
||||
### 1.5 HTTP Server Foundation
|
||||
- [1.5.1 - Install Gin](./1.5.1-install-githubcomgin-gonicgin.md)
|
||||
- [1.5.2 - Create Server](./1.5.2-create-internalserverservergo.md)
|
||||
- [1.5.3 - Wire HTTP Server](./1.5.3-wire-http-server-into-fx-lifecycle.md)
|
||||
- [1.5.4 - Update Main Entry Point](./1.5.4-update-cmdplatformmaingo-to-use-fx-lifecycle.md)
|
||||
### 1.5 HTTP Server Foundation with Middleware Stack
|
||||
- [Story: 1.5 - HTTP Server](./1.5-http-server.md)
|
||||
- **Goal:** Create a production-ready HTTP server with comprehensive middleware for security, observability, and error handling.
|
||||
- **Deliverables:** HTTP server, comprehensive middleware stack, core routes, FX lifecycle integration
|
||||
|
||||
### 1.6 Observability (OpenTelemetry)
|
||||
- [1.6.1 - Install OpenTelemetry](./1.6.1-install-opentelemetry-packages.md)
|
||||
- [1.6.2 - Create Tracer](./1.6.2-create-internalobservabilitytracergo.md)
|
||||
- [1.6.3 - Add HTTP Instrumentation](./1.6.3-add-http-instrumentation-middleware.md)
|
||||
- [1.6.4 - Add Trace Context Propagation](./1.6.4-add-trace-context-propagation-to-requests.md)
|
||||
### 1.6 OpenTelemetry Distributed Tracing
|
||||
- [Story: 1.6 - OpenTelemetry](./1.6-opentelemetry.md)
|
||||
- **Goal:** Integrate OpenTelemetry for distributed tracing across the platform to enable observability in production.
|
||||
- **Deliverables:** OpenTelemetry setup, HTTP instrumentation, database instrumentation, trace-log correlation
|
||||
|
||||
### 1.7 Service Client Interfaces
|
||||
- [Story: 1.7 - Service Client Interfaces](./1.7-service-abstraction-layer.md)
|
||||
- **Goal:** Create service client interfaces for all core services to enable microservices communication.
|
||||
- **Deliverables:** Service client interfaces, service factory, configuration
|
||||
|
||||
## Deliverables Checklist
|
||||
- [ ] DI container with all core services registered
|
||||
- [ ] Database schema defined with Ent
|
||||
- [ ] Health check endpoints working
|
||||
- [ ] Metrics endpoint exposed
|
||||
- [ ] Error bus implemented and integrated
|
||||
- [ ] DI container with all core services
|
||||
- [ ] Database client with Ent schema
|
||||
- [ ] Health and metrics endpoints functional
|
||||
- [ ] Error bus captures and logs errors
|
||||
- [ ] HTTP server with middleware stack
|
||||
- [ ] OpenTelemetry tracing integrated
|
||||
- [ ] Basic observability with OpenTelemetry
|
||||
- [ ] Service client interfaces for microservices
|
||||
|
||||
## Acceptance Criteria
|
||||
- `GET /healthz` returns 200
|
||||
- `GET /ready` checks database connectivity
|
||||
- `GET /metrics` returns Prometheus metrics
|
||||
- HTTP requests are logged with structured logging
|
||||
- Panic recovery middleware catches and reports errors
|
||||
- OpenTelemetry traces are generated for HTTP requests
|
||||
|
||||
- `GET /ready` checks DB connectivity
|
||||
- `GET /metrics` exposes Prometheus metrics
|
||||
- Panic recovery logs errors via error bus
|
||||
- Database migrations run on startup
|
||||
- HTTP requests are traced with OpenTelemetry
|
||||
|
||||
Reference in New Issue
Block a user