1. The Clean Domain-Driven Architecture
Famished is built on a clean architecture model using ASP.NET Core 10 and EF Core. The codebase separates domain models from application operations, database infrastructure, and endpoint controllers. This guarantees zero side effects on core data operations.
- Domain Layer: Stores pure business entities, enumerations, and custom validation exceptions. Zero third-party library dependencies.
- Application Layer: Hosts business logic commands, query handlers (MediatR pattern), data mappers, and domain logic validation rules.
- Persistence Layer: Manages the MSSQL database context, entity configurations, relationship mappings, and database seed controllers.
- API Layer: Hosts routing controllers, token-based authentication filters, real-time SignalR tracking hubs, and third-party webhooks.
2. Double-Entry Ledger System
To eliminate financial inconsistencies and support immediate payout withdrawals, Famished implements an atomic double-entry bookkeeping system. No transaction updates directly overwrite balance values; instead, they are recorded as immutable debit/credit entries.
This structural ledger model prevents concurrency issues during busy ordering slots, facilitating instant withdraw approvals for riders and merchants.
3. Hyperlocal Spatial Indexing
Our dispatch systems map orders to nearby delivery pilots in real time using MS SQL spatial database features. Coordinates (latitude and longitude) are mapped to geo-spatial data geometries. Indexing queries discover riders within a 3km radius instantly, keeping order dispatches rapid.