How nwf007/statement-delivery-system works
The platform separates burst-oriented statement generation from customer-facing delivery: a run is planned, ledger data becomes a rendered and encrypted statement, and customers later retrieve it through an authenticated API and a single-use download gateway. Retention and erasure form a separate lifecycle, with legal holds and key destruction governing whether encrypted objects can be purged. The graph reflects README capabilities and the supplied source excerpts; some endpoint-to-repository wiring is inferred only where documented behavior supports it, so uncertain links are omitted.
Main entry points: Program.cs Delivery API · RenderPipeline.cs Render pipeline · DownloadEndpoints.cs Download endpoints · StatementContentStore.cs Encrypted content store
Components 34
Generation
- Generation worker
src/Services/Generation.Worker/Program.cs - Run orchestrator
src/Services/Generation.Worker/RunOrchestratorService.cs - Render worker
src/Services/Generation.Worker/RenderWorkerService.cs - Render pipeline
src/Services/Generation.Worker/RenderPipeline.cs
Delivery
- Delivery API
src/Services/Delivery.Api/Program.cs - Statement endpoints
src/Services/Delivery.Api/Statements/StatementEndpoints.cs - Link endpoints
src/Services/Delivery.Api/Downloads/DownloadLinkEndpoints.cs - Download gateway
src/Services/Download.Gateway/Program.cs - Download endpoints
src/Services/Download.Gateway/Downloads/DownloadEndpoints.cs
Retention
- Retention worker
src/Services/Retention.Worker/Program.cs - Retention sweep
src/Services/Retention.Worker/RetentionSweepService.cs - Retention decision
src/BuildingBlocks/Domain/Retention/RetentionDecisionEngine.cs - Retention endpoints
src/Services/Delivery.Api/Retention/ErasureEndpoints.cs - Legal hold endpoints
src/Services/Delivery.Api/Retention/LegalHoldEndpoints.cs - Restore endpoints
src/Services/Delivery.Api/Retention/RestoreEndpoints.cs - Erasure executor
src/Services/Retention.Worker/ErasureExecutor.cs - Object administration
src/BuildingBlocks/ServiceDefaults/Storage/ObjectAdminStore.cs
Security and persistence
- PDF renderer
src/BuildingBlocks/Rendering/QuestPdfStatementRenderer.cs - Statement model
src/BuildingBlocks/Domain/Statements/Statement.cs - Encrypted content store
src/BuildingBlocks/ServiceDefaults/Storage/StatementContentStore.cs - Framed encryption
src/BuildingBlocks/Crypto/Framing/FramedAeadCipher.cs - Customer key service
src/BuildingBlocks/Crypto/Keys/CustomerKeyService.cs - Key provider
src/BuildingBlocks/Crypto/Keys/KeyProvider.cs - Object storage
src/BuildingBlocks/ServiceDefaults/Storage/ObjectStorage.cs - Statement reads
src/BuildingBlocks/Persistence/Repositories/StatementReadRepository.cs - Statement writes
src/BuildingBlocks/Persistence/Repositories/StatementWriteRepository.cs - Run repository
src/BuildingBlocks/Persistence/Runs/StatementRunRepository.cs - Download tokens
src/BuildingBlocks/Persistence/Tokens/DownloadTokenRepository.cs
Audit
- Audit verification API
src/Services/Delivery.Api/Auditing/AuditVerifyEndpoint.cs
Other components
- Operator
- Customer
- Core ledger
- Mock ledger API
src/Services/MockLedger.Api/Program.cs - PostgreSQL
Connections 47
- Customer → Delivery API: calls
- Delivery API → Statement endpoints: routes
- Delivery API → Link endpoints: routes
- Delivery API → Retention endpoints: routes
- Delivery API → Legal hold endpoints: routes
- Delivery API → Restore endpoints: routes
- Delivery API → Audit verification API: routes
- Statement endpoints → Statement reads: reads
- Link endpoints → Statement reads: reads
- Link endpoints → Download tokens: creates
- Customer → Download gateway: redeems link
- Download gateway → Download endpoints: routes
- Download endpoints → Download tokens: consumes
- Download endpoints → Statement reads: loads metadata
- Download endpoints → Encrypted content store: streams content
- Encrypted content store → Object storage: reads and writes
- Encrypted content store → Framed encryption: encrypts and decrypts
- Framed encryption → Customer key service: uses keys
- Customer key service → Key provider: wraps keys
- Generation worker → Run orchestrator: hosts
- Generation worker → Render worker: hosts
- Run orchestrator → Run repository: plans runs
- Run orchestrator → PostgreSQL: acquires lease
- Render worker → Render pipeline: processes claims
- Render pipeline → Core ledger: requests transactions
- Render pipeline → PDF renderer: renders document
- Render pipeline → Encrypted content store: writes encrypted content
- Render pipeline → Statement writes: publishes statement
- Statement writes → PostgreSQL: writes
- Statement reads → PostgreSQL: reads
- Run repository → PostgreSQL: reads and writes
- Download tokens → PostgreSQL: reads and writes
- Operator → Retention endpoints: requests erasure
- Operator → Legal hold endpoints: manages holds
- Operator → Restore endpoints: requests restore
- Retention endpoints → PostgreSQL: records request
- Legal hold endpoints → Object administration: sets object holds
- Restore endpoints → PostgreSQL: records request
- Retention worker → Retention sweep: hosts
- Retention sweep → Retention decision: decides disposition
- Retention worker → Erasure executor: executes erasure
- Erasure executor → Customer key service: destroys customer key
- Erasure executor → Object administration: manages objects
- Object administration → Object storage: administers locks
- Retention sweep → PostgreSQL: loads candidates
- Audit verification API → PostgreSQL: verifies chains
- Mock ledger API → Core ledger: implements locally