Set up pnpm workspaces with three packages: a shared Zod-schema package, a Hono-based API exported as a library, and a Vite/React/ Tailwind frontend that mounts the API via Cloudflare Pages Functions. Storage is abstracted behind an S3-compatible provider so the project can migrate from R2 to a self-hosted MinIO without code changes. https://claude.ai/code/session_01TPBqgcSJMppgrpiq7fLywL
10 lines
263 B
TypeScript
10 lines
263 B
TypeScript
import type { D1Database } from '@cloudflare/workers-types';
|
|
import { drizzle } from 'drizzle-orm/d1';
|
|
import * as schema from './schema.js';
|
|
|
|
export type DB = ReturnType<typeof getDb>;
|
|
|
|
export function getDb(d1: D1Database) {
|
|
return drizzle(d1, { schema });
|
|
}
|