WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto

feat(appview): add database connection module and DATABASE_URL config

+14
+12
packages/appview/src/db/index.ts
··· 1 + import { drizzle } from "drizzle-orm/postgres-js"; 2 + import postgres from "postgres"; 3 + import * as schema from "./schema.js"; 4 + 5 + export function createDb(databaseUrl: string) { 6 + const client = postgres(databaseUrl); 7 + return drizzle(client, { schema }); 8 + } 9 + 10 + export type Database = ReturnType<typeof createDb>; 11 + 12 + export * from "./schema.js";
+2
packages/appview/src/lib/config.ts
··· 2 2 port: number; 3 3 forumDid: string; 4 4 pdsUrl: string; 5 + databaseUrl: string; 5 6 } 6 7 7 8 export function loadConfig(): AppConfig { ··· 9 10 port: parseInt(process.env.PORT ?? "3000", 10), 10 11 forumDid: process.env.FORUM_DID ?? "", 11 12 pdsUrl: process.env.PDS_URL ?? "https://bsky.social", 13 + databaseUrl: process.env.DATABASE_URL ?? "", 12 14 }; 13 15 }