- pnpm workspace: apps/web (Next.js), apps/bot, packages/{db,shared,mcp,runner}
- Drizzle schema: projects, goals, tasks, sessions, questions, events
- Postgres via infra/docker-compose.yml
- template/: AGENTS.md workflow on OpenSpec, Claude hooks, peppa MCP config
- scripts to push template and bootstrap projects in Gitea
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
402 B
TypeScript
15 lines
402 B
TypeScript
import { loadEnv } from "@peppa/shared";
|
|
import { drizzle } from "drizzle-orm/postgres-js";
|
|
import postgres from "postgres";
|
|
import * as schema from "./schema.ts";
|
|
|
|
export * from "./schema.ts";
|
|
export { schema };
|
|
|
|
export function createDb(url = loadEnv().DATABASE_URL) {
|
|
const client = postgres(url, { max: 5 });
|
|
return drizzle(client, { schema });
|
|
}
|
|
|
|
export type Db = ReturnType<typeof createDb>;
|