How uselotus/lotus works
High-Level Architecture Components
a) Frontend Layer:
• React TypeScript application (in /frontend)
• User interface for plan management, metrics, and experimentation
b) Backend Services:
• Main Django Backend (/backend)
• Go Microservices:
• Event Ingestion Service (/go/event-ingestion)
• Event Guidance Service (/go/event-guidance)
c) Data Storage:
• PostgreSQL with TimescaleDB
• Redis for caching
• Redpanda (Kafka-compatible messaging)
d) Background Processing:
• Celery workers for async tasks
Component Relationships
a) Client Interaction Flow:
External Clients -> Nginx Proxy -> Frontend/Backend Services
b) Event Processing Flow:
Events -> Event Ingestion (Go) -> Redpanda -> Event Consumer -> PostgreSQL
c) Data Flow:
Django Backend <-> Redis Cache
Django Backend <-> PostgreSQL
Django Backend <-> Celery Workers
Specific Architectural Elements
Key subsystems:
a) Authentication/Authorization:
• API token validation flow
• Organization/Team management
b) Billing Components:
• Metering system
• Invoice generation
• Payment processor integrations
c) Event Processing:
• Event ingestion pipeline
• Real-time processing
• Historical aggregation
Integration Points
External integration capabilities:
• Payment processors (Stripe, Braintree)
• CRM systems (Salesforce)
• Accounting systems (NetSuite)
• Analytics platforms
Detailed Component Breakdown
For the Django backend, show:
• API endpoints (/backend/api)
• Billing logic (/backend/metering_billing)
• Authentication services (/backend/metering_billing/auth)
• Background tasks (/backend/metering_billing/tasks.py)
Scalability of individual components
This architecture should reflect Lotus's capability to handle complex pricing models, subscription management, and experimentation while maintaining flexibility for integration with existing stacks.