# Epic 5: Infrastructure Adapters

## Overview
Implement infrastructure adapters (cache, queue, blob storage, email) that services use. These adapters are shared infrastructure components that all services can use. Make adapters swappable via interfaces, add scheduler/background jobs system, and implement event bus (in-process and Kafka).

**Note:** gRPC service definitions and clients are already implemented in Epic 1 (Story 1.7) and Epic 2 (each service implements its own gRPC server). Story 5.7 focuses on advanced gRPC features and enhancements.

## Stories

### 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 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 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 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 Advanced gRPC Features
- [Story: 5.7 - Advanced gRPC Features](./5.7-grpc-services.md)
- **Goal:** Enhance gRPC implementation with advanced features (streaming, advanced error handling, gRPC-Gateway).
- **Deliverables:** Streaming RPCs, gRPC-Gateway integration, advanced error handling, gRPC middleware

**Note:** Basic gRPC service definitions and clients are already implemented in Epic 1 (Story 1.7) and Epic 2 (each service implements its own gRPC server).

## Deliverables Checklist
- [ ] 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)
- [ ] Advanced gRPC features (streaming, gRPC-Gateway)

## Acceptance Criteria
- 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
- gRPC streaming works
- gRPC-Gateway provides HTTP access to gRPC services
- Integration test: full infrastructure stack works
