# Database Specification

> Generated by openlore v1.0.0 on 2025-06-15
> Source files: src/database/connection.ts

## Purpose

Manages PostgreSQL connection pooling and provides a health check endpoint.

## Requirements

### Requirement: ConnectionPooling

The system SHALL maintain a PostgreSQL connection pool with max 20 connections and 30-second idle timeout.

### Requirement: HealthCheck

The system SHALL expose a health check function that verifies database connectivity by executing `SELECT 1`.

#### Scenario: HealthyDatabase
- **GIVEN** a running PostgreSQL instance
- **WHEN** healthCheck is called
- **THEN** the function returns true

#### Scenario: UnhealthyDatabase
- **GIVEN** a down PostgreSQL instance
- **WHEN** healthCheck is called
- **THEN** the function returns false

## Technical Notes

- **Implementation**: `src/database/connection.ts`
- **Dependencies**: pg (node-postgres)
