Connection Pool Infrastructure
Component Detail
Infrastructure
medium complexity
Shared Component
backend
0
Dependencies
2
Dependents
0
Entities
0
Integrations
Description
Manages a pool of PostgreSQL connections for the Next.js backend using node-postgres (pg). Configures pool size, idle timeout, and connection lifecycle to support concurrent requests from both the mobile app and the admin panel without exhausting database connections.
connection-pool-infrastructure
Responsibilities
- Initialize and configure the pg connection pool on backend startup
- Provide pooled connections to all repository and service layers
- Manage connection lifecycle including acquisition, release, and error handling
- Expose pool health metrics for monitoring and diagnostics
Interfaces
getPool()
getConnection()
releaseConnection(client)
query(sql, params)
transaction(fn)
getPoolStats()
closePool()
testConnection()
setPoolSize(size)
onConnectionError(handler)
Relationships
Dependents (2)
Components that depend on this component