# 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. ## Tasks ### 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.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.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.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.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.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) ## 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 - [ ] HTTP server with middleware stack - [ ] OpenTelemetry tracing integrated ## 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