Manages the database connection for a single, independent WayrApp node.
This module utilizes the Singleton pattern with Prisma ORM to provide an optimized
and centralized database access layer. It is the foundational component for all
data persistence within a sovereign WayrApp instance.
Architectural Vision: Sovereign Nodes
The "decentralization" in WayrApp refers to empowering any community to deploy
and own a complete, independent instance of the platform.
Sovereign Deployment: Each instance (a "node") is self-hosted and fully autonomous.
Data Sovereignty: Each node maintains its own private, isolated database. There is no
data sharing, replication, or synchronization between nodes.
Self-Contained: This connection manager is the heart of a SINGLE node.
Author
Exequiel Trujillo
Since
1.0.0
Example: Basic Repository Usage
// Each query operates on this node's private database only. import { prisma } from'@/shared/database/connection'; constusers = awaitprisma.user.findMany();
Example: Dependency Injection into Route Factories
// The prisma instance is passed to route modules at application startup. import { prisma } from'@/shared/database/connection'; app.use(API_BASE, createContentRoutes(prisma));
Example: Integration Testing
// Tests use the prisma instance to set up and tear down the test database. import { prisma } from'@/shared/database/connection'; beforeEach(async () => { awaitprisma.user.deleteMany(); });
Manages the database connection for a single, independent WayrApp node.
This module utilizes the Singleton pattern with Prisma ORM to provide an optimized and centralized database access layer. It is the foundational component for all data persistence within a sovereign WayrApp instance.
Architectural Vision: Sovereign Nodes
The "decentralization" in WayrApp refers to empowering any community to deploy and own a complete, independent instance of the platform.
Author
Exequiel Trujillo
Since
1.0.0
Example: Basic Repository Usage
Example: Dependency Injection into Route Factories
Example: Integration Testing
Example
Example