caelum0x 695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00

31 lines
738 B
TypeScript

import { Pool } from "pg";
// Single shared pool across API route invocations (Vercel serverless functions
// reuse the module scope across warm invocations, so this is safe and avoids
// exhausting Neon's connection limit).
let pool: Pool | undefined;
export function getPool(): Pool {
if (!pool) {
const connectionString = process.env.DATABASE_URL;
if (!connectionString) {
throw new Error("DATABASE_URL is not set");
}
pool = new Pool({
connectionString,
ssl: { rejectUnauthorized: false },
max: 5,
});
}
return pool;
}
export async function checkDbConnection(): Promise<boolean> {
try {
await getPool().query("select 1");
return true;
} catch {
return false;
}
}