Skip to main content

Architecture

Technical architecture documentation for the TVL Platform, including diagrams, deployment views, and sequence flows.

Overview

The TVL Platform follows a domain-driven design (DDD) architecture with 14 bounded contexts, built as a multi-tenant SaaS platform using Node.js, TypeScript, PostgreSQL, and React.

Architecture Documentation

Key Architectural Patterns

Multi-Tenancy

  • 3-tier isolation: Organization → Account → User
  • Row-Level Security (RLS) policies in PostgreSQL
  • Tenant-scoped data access patterns

Domain-Driven Design

  • 14 bounded contexts with clear boundaries
  • Domain events for cross-context communication
  • Aggregate roots and entity relationships

Event-Driven Architecture

  • Transactional outbox pattern for reliable events
  • Event sourcing for audit trails
  • Asynchronous processing with BullMQ

Database Patterns

  • JSONB for flexible schemas
  • GIST exclusion constraints for date ranges
  • Time-based partitioning for audit tables
  • Optimistic locking for concurrency