feat: microservice architecture

This commit is contained in:
2025-11-05 09:12:34 +01:00
parent 54a047f5dc
commit 65a428534c
354 changed files with 5544 additions and 13141 deletions

View File

@@ -1,49 +1,58 @@
# Phase 5: Infrastructure Adapters
## Overview
Implement infrastructure adapters for caching (Redis), event bus (Kafka), background job scheduling (asynq), and multi-tenancy support.
Implement infrastructure adapters (cache, queue, blob storage, email), make adapters swappable via interfaces, add scheduler/background jobs system, and implement event bus (in-process and Kafka).
## Tasks
## Stories
### 5.1 Cache Implementation
- [5.1.1 - Install Redis Client](./5.1.1-install-githubcomredisgo-redisv9.md)
- [5.1.2 - Create Cache Interface](./5.1.2-create-pkginfracachecachego-interface.md)
- [5.1.3 - Implement Redis Cache](./5.1.3-implement-internalinfracacheredis_cachego.md)
- [5.1.4 - Add Redis Config](./5.1.4-add-redis-config-to-configdefaultyaml.md)
- [5.1.5 - Register in DI Container](./5.1.5-register-in-di-container.md)
- [5.1.6 - Add Cache Middleware](./5.1.6-add-cache-middleware-for-selected-routes-optional.md)
### 5.1 Cache System (Redis)
- [Story: 5.1 - Cache System](./5.1-cache-system.md)
- **Goal:** Implement a complete Redis-based caching system with a clean interface.
- **Deliverables:** Cache interface, Redis implementation, configuration, DI integration
### 5.2 Event Bus Implementation
- [5.2.1 - Create Event Bus Interface](./5.2.1-create-pkgeventbuseventbusgo-interface.md)
- [5.2.2 - Implement In-Process Bus](./5.2.2-implement-internalinfrabusinprocess_busgo.md)
- [5.2.3 - Implement Kafka Bus](./5.2.3-implement-internalinfrabuskafka_busgo.md)
- [5.2.4 - Add Kafka Config](./5.2.4-add-kafka-config-to-configdefaultyaml.md)
### 5.2 Event Bus System
- [Story: 5.2 - Event Bus](./5.2-event-bus.md)
- **Goal:** Implement a complete event bus system supporting both in-process and Kafka.
- **Deliverables:** Event bus interface, in-process bus, Kafka bus, core events
### 5.3 Background Job Scheduler
- [5.3.1 - Install Asynq](./5.3.1-install-githubcomhibikenasynq.md)
- [5.3.2 - Create Scheduler Interface](./5.3.2-create-pkgschedulerschedulergo-interface.md)
- [5.3.3 - Implement Asynq Scheduler](./5.3.3-implement-internalinfraschedulerasynq_schedulergo.md)
- [5.3.4 - Add Cron Support](./5.3.4-add-cron-support.md)
### 5.3 Blob Storage System
- [Story: 5.3 - Blob Storage](./5.3-blob-storage.md)
- **Goal:** Implement a complete blob storage system using S3.
- **Deliverables:** Blob storage interface, S3 implementation, file upload API
### 5.4 Multi-tenancy Support
- [5.4.1 - Create Tenant Resolver Interface](./5.4.1-create-pkgtenanttenantgo-interface.md)
- [5.4.2 - Implement Tenant Resolver](./5.4.2-implement-internaltenantresolvergo.md)
- [5.4.3 - Add Tenant Middleware](./5.4.3-add-tenant-middleware.md)
- [5.4.4 - Update Ent Queries](./5.4.4-update-ent-queries-with-tenant-scoping.md)
### 5.4 Email Notification System
- [Story: 5.4 - Email Notification](./5.4-email-notification.md)
- **Goal:** Implement a complete email notification system with SMTP support.
- **Deliverables:** Notification interface, SMTP implementation, email templates, identity integration
### 5.5 Scheduler and Background Jobs System
- [Story: 5.5 - Scheduler & Jobs](./5.5-scheduler-jobs.md)
- **Goal:** Implement a complete scheduler and background job system.
- **Deliverables:** Scheduler interface, Asynq implementation, job registry, example jobs
### 5.6 Secret Store Integration
- [Story: 5.6 - Secret Store](./5.6-secret-store.md)
- **Goal:** Implement secret store integration supporting Vault and AWS Secrets Manager.
- **Deliverables:** Secret store interface, Vault implementation, AWS implementation, config integration
### 5.7 gRPC Service Definitions and Clients
- [Story: 5.7 - gRPC Services](./5.7-grpc-services.md)
- **Goal:** Implement gRPC service definitions and clients to enable microservices communication.
- **Deliverables:** gRPC service definitions, gRPC servers, gRPC clients, code generation
## Deliverables Checklist
- [ ] Redis cache adapter implemented
- [ ] Event bus supports in-process and Kafka
- [ ] Background job scheduler with asynq
- [ ] Cron job support
- [ ] Multi-tenancy resolver and middleware
- [ ] Database queries scoped by tenant
- [ ] Cache adapter (Redis) working
- [ ] Event bus (in-process and Kafka) functional
- [ ] Blob storage (S3) adapter
- [ ] Email notification system
- [ ] Scheduler and background jobs
- [ ] Secret store integration (optional)
- [ ] gRPC service definitions and clients
## Acceptance Criteria
- Cache operations work with Redis fallback
- Events can be published to Kafka
- Background jobs can be scheduled
- Cron jobs run on schedule
- Tenant isolation works for database queries
- Middleware extracts tenant from request
- Cache stores and retrieves data correctly
- Events are published and consumed
- Files can be uploaded and downloaded
- Email notifications are sent
- Background jobs run on schedule
- Integration test: full infrastructure stack works