///
Aruuri's database architecture is built for trust, transparency, and scalability, leveraging **Drizzle ORM** for type-safe interactions with **Neon PostgreSQL** as its serverless relational database.
100 views
~100 views from guests
Guest views are estimated from total page views. These include anonymous visitors and users who weren't logged in when they viewed the page.
Aruuri's database architecture is built for trust, transparency, and scalability, leveraging Drizzle ORM for type-safe interactions with Neon PostgreSQL as its serverless relational database. This foundation adheres to a domain-driven design approach, ensuring clear separation of concerns, improved maintainability, and readiness for complex query patterns or event sourcing (CQRS). For a broader understanding of the monorepo structure, refer to the [Aruuri Monorepo Architecture] page.
To achieve maximum organizational clarity and enable independent scaling and development for different parts of the platform, Aruuri employs a multi-database strategy, with each database corresponding to a specific business domain. This approach isolates critical data and logic, preventing tight coupling and simplifying data management.
The four core database domains are:
Each domain's database clients and schema definitions are encapsulated within the packages/database directory, promoting a "monorepo native" shared package approach that is consumed by various applications.
The database layer incorporates several modern features to ensure robustness and developer efficiency:
The packages/database/src/client.ts module centralizes the instantiation of database clients for each domain. It differentiates between various connection types to optimize performance and resource utilization:
ARUURI_{DOMAIN}_DATABASE_URL_POOLED environment variables are used. These point to a connection pooler (like Neon's serverless driver) to efficiently manage database connections in stateless environments.ARUURI_{DOMAIN}_DATABASE_URL is used, providing a direct connection to the database.ARUURI_{DOMAIN}_DATABASE_URL_READ variables allow for dedicated read replicas. If a read replica is configured, a separate client ({domain}DbRead) is provided; otherwise, it gracefully falls back to the primary pooled connection.packages/database/src/client.ts)To set up and interact with the local development database:
Note: The
pnpm dev:db:seedscript is currently disabled as the initial database schemas are still under development. It will be re-enabled once core table structures are finalized.
Interacting with the database is type-safe and intuitive, thanks to Drizzle ORM: