How formancehq/stack works
Main Components Identification
a) Core Services:
• Formance Ledger (double-entry accounting)
• Formance Payments (unified payments processing)
• Formance Numscript (DSL for monetary computations)
b) Infrastructure Components:
• PostgreSQL (main storage)
• Redis (caching/syncing)
• Kafka/NATS (async communication)
• Traefik (API gateway)
Architectural Layers
┌─ Client Layer ─────────────────────┐
• CLI (fctl) │
• HTTP Clients │
• ┬───────────────────┘
• ↓
┌─ Gateway Layer ────────────────────┐
• Traefik │
• ┬───────────────────┘
• ↓
┌─ Service Layer ────────────────────┐
• ┌─────────┐ ┌────────┐ ┌────────┐ │
• Ledger │ │Payments│ │Numscript│ │
• ┘ └────────┘ └────────┘ │
• ┬───────────────────┘
• ↓
┌─ Message Layer ────────────────────┐
• Kafka/NATS │
• ┬───────────────────┘
• ↓
┌─ Storage Layer ────────────────────┐
• PostgreSQL │
• Redis │
• ┘
Component Relationships
Key interactions:
a) Event Flow:
• Event versioning (v1.0.0, v2.0.0) as seen in the events directory
b) Service Integration:
• Integration points between services
• Webhook configurations and triggers
• Authentication flow
Additional Elements
a) Testing Infrastructure:
• Benchmark components
• Integration testing setup
• Load testing architecture
b) Deployment Options:
• Cloud deployment path
• Local development setup
• Container orchestration
Specific Implementation Details
• The modular nature of the system (services can be used independently)
• Event-driven architecture (based on the events/ directory structure)
• Multiple version support (as seen in the API versioning)
• Integration points (webhooks, triggers, workflows)
Notes for Implementation
• Use standard UML notation where applicable
• Keep service boundaries clear
• Scaling points
• Stateful vs stateless components
• Security and authentication boundaries
Remember to include observability components (seen in the benchmarks/tools directory) and show how monitoring and logging fit into the architecture.