The codebase follows a strict Hexagonal (Ports & Adapters) Architecture with three layers:
• Domain Layer (src/domain/) - Pure TypeScript classes with zero framework imports. Contains Value Objects (Money, TaxRate, JurisdictionCode), Entities (Transaction aggregate root, TaxRule, Commission), and Strategies (ITaxStrategy interface with US, EU, UK, CA implementations plus the TaxRulePipeline chain).
• Application Layer (src/application/) - Use case orchestrators (CalculateTax, CalculateCommission, ProcessBatchTransaction) that build domain objects from DTOs, check cache, resolve strategies, run pipelines, and write audit logs. Depends entirely on abstract port interfaces - ICachePort, IQueuePort, IAuditLogPort, ITaxRuleRepository.
• Infrastructure Layer (src/infrastructure/) - Concrete adapters: PrismaService for PostgreSQL, RedisCacheAdapter, BullMQ queue adapter, and Prisma audit log adapter. The NestJS InfrastructureModule is the single composition root that wires adapters to ports.