Files

Epic 1: Core Kernel & Infrastructure

Overview

Build the core kernel infrastructure (config, logger, DI, health, metrics, observability) with no business logic. Implement API Gateway as core infrastructure component. Create service client interfaces and service registry foundation. Establish HTTP/gRPC server foundations that services will use.

Note: This epic focuses on infrastructure only. Business services (Auth, Identity, Authz, Audit) are implemented in Epic 2 as separate microservices.

Stories

1.1 Enhanced Dependency Injection Container

  • Story: 1.1 - Enhanced DI Container
  • Goal: Extend the DI container to provide core kernel infrastructure services only (no business logic) with proper lifecycle management.
  • Deliverables: Extended DI container, provider functions for core kernel services only, core module export

1.2 Database Client Foundation

  • Story: 1.2 - Database Client Foundation
  • Goal: Set up database client foundation for services. Each service will have its own database connection and schema.
  • Deliverables: Database client wrapper with schema support, connection pooling, per-service connection management

Note: Core domain entities (User, Role, Permission, AuditLog) are implemented in Epic 2 as part of their respective services.

1.3 Health Monitoring and Metrics System

  • Story: 1.3 - Health & Metrics
  • 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 Handling and Error Bus

  • Story: 1.4 - Error Handling
  • 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/gRPC Server Foundation

  • Story: 1.5 - HTTP/gRPC Server Foundation
  • Goal: Create HTTP and gRPC server foundation that services can use. Each service will have its own server instance.
  • Deliverables: HTTP server foundation, gRPC server foundation, common middleware, lifecycle management

1.6 OpenTelemetry Distributed Tracing

  • Story: 1.6 - OpenTelemetry
  • Goal: Integrate OpenTelemetry for distributed tracing across all services to enable observability in production.
  • Deliverables: OpenTelemetry setup, HTTP instrumentation, gRPC instrumentation, database instrumentation, trace-log correlation

1.7 Service Client Interfaces

  • Story: 1.7 - Service Client Interfaces
  • Goal: Create service client interfaces for all core services to enable microservices communication.
  • Deliverables: Service client interfaces in pkg/services/, service client factory, gRPC/HTTP client implementations

1.8 API Gateway Implementation

  • Story: 1.8 - API Gateway
  • Goal: Implement API Gateway as core infrastructure component that routes all external traffic to backend services.
  • Deliverables: API Gateway service entry point, gateway implementation with routing, JWT validation, rate limiting, service discovery integration

Deliverables Checklist

  • DI container with core kernel services only (no business logic)
  • Database client foundation (per-service connections)
  • Health and metrics endpoints functional
  • Error bus captures and logs errors
  • HTTP/gRPC server foundation for services
  • Basic observability with OpenTelemetry
  • Service client interfaces defined
  • API Gateway service (core infrastructure)
  • Basic service registry implementation (Consul)

Acceptance Criteria

  • GET /healthz returns 200 for all services
  • GET /ready checks service health
  • GET /metrics exposes Prometheus metrics
  • Panic recovery logs errors via error bus
  • HTTP/gRPC requests are traced with OpenTelemetry
  • API Gateway routes requests to backend services
  • Service client interfaces are defined
  • Services can register with Consul
  • No business logic services in Epic 1

Implementation Summary