0debt is a scalable, distributed financial application built on modern cloud-native principles. It solves the complexity of "who owes who" in group activities through a resilient microservices architecture, real-time event processing, and a clean user experience.
The 0debt platform consists of loosely coupled services communicating via HTTP and Redis Pub/Sub:
| Service | Description | Repository |
|---|---|---|
| users-service | Source of truth for identity. Handles authentication (JWT), secure password hashing, and subscription plans | 0debt/users-service |
| groups-service | Manages collaboration spaces, membership logic, and synchronization with user profiles | 0debt/groups-service |
| expenses-service | Financial engine. Records transactions and executes the debt simplification algorithm. Orchestrates distributed transactions (Saga pattern) | 0debt/expenses-service |
| Service | Description | Repository |
|---|---|---|
| analytics-service | Provides financial health insights and budget tracking. Generates visual reports via QuickChart | 0debt/analytics-service |
| notifications-service | Event-driven service that handles transactional emails via Resend and background jobs | 0debt/notifications-service |
| Component | Description | Repository |
|---|---|---|
| api-gateway | Edge entry point. Reverse proxy built with Hono handling routing, rate limiting, and security validation | 0debt/api-gateway |
| 0debt-frontend | Modern SPA built with Next.js, Shadcn UI, and TailwindCSS, optimized for Bun runtime | 0debt/frontend |
| 0debt-infra | Infrastructure configuration and documentation | 0debt/0debt-infra |
graph TD
User((User)) -->|HTTPS| Gateway[API Gateway]
Gateway -->|HTTP| Users[Users Service]
Gateway -->|HTTP| Groups[Groups Service]
Gateway -->|HTTP| Expenses[Expenses Service]
Gateway -->|HTTP| Analytics[Analytics Service]
Expenses --Pub: expense.created--> Redis[(Redis Pub/Sub)]
Groups --Pub: member.added--> Redis
Redis --Sub--> Notifications[Notifications Service]
Redis --Sub--> Analytics
Users -->|Avatar| DiceBear[DiceBear API]
Users -->|Storage| Supabase[Supabase Storage]
Groups -->|Image| Unsplash[Unsplash API]
Expenses -->|Rates| Frankfurter[Frankfurter API]
Analytics -->|Chart| QuickChart[QuickChart API]
Notifications -->|Email| Resend[Resend API]
- North-South: Client → API Gateway → Microservices
- East-West: Internal service-to-service calls for validation and data retrieval
Event-driven architecture for non-blocking communication:
| Publisher | Event | Subscribers |
|---|---|---|
| expenses-service | expense.created |
notifications-service, analytics-service |
| groups-service | member.added, member.removed, group.deleted |
notifications-service |
The platform implements an orchestrated Saga for critical operations like user deletion:
- Validation: expenses-service checks for pending debts
- Execution: users-service deletes user record
- Cleanup: analytics-service removes associated budgets
This ensures data consistency across services while maintaining financial integrity.
| API | Function | Consumer |
|---|---|---|
| QuickChart | Chart generation (PNG) | analytics-service |
| Resend | Transactional emails | notifications-service |
| Frankfurter | Currency exchange rates | expenses-service |
| Unsplash | Group images | groups-service |
| DiceBear | Avatar generation | users-service |
| Supabase Storage | File storage | users-service |
For detailed architectural decisions and specifications:
| Document | Description |
|---|---|
| Architecture diagram | Complete system architecture with Mermaid |
| Saga pattern | Distributed transaction implementation |
| Redis Pub/Sub | Asynchronous communication details |
| External APIs | Third-party API integration specs |
| Customer agreement | Terms of service |
| Pricing plans | FREE, PRO, ENTERPRISE tiers |
| SLA | Service level agreement |
| Privacy policy | Data protection and GDPR compliance |
| Layer | Technology |
|---|---|
| Runtime | Bun |
| Backend framework | Hono |
| Frontend | Next.js 16, Shadcn UI, TailwindCSS |
| Database | MongoDB Atlas |
| Cache & messaging | Redis |
| Infrastructure | Hetzner VPS + Coolify |
| CI/CD | GitHub Actions |
Apache License 2.0
