camelon

Database

camelon does not ship a database. It injects the client you pass. The db arg is whatever you hand createHandler, and it arrives on the args bag in every loader, action, and middleware.

import type { RouteArgs } from 'camelon';
import type { PrismaClient } from '@prisma/client';

export async function loader({ db }: RouteArgs) {
  const prisma = db as PrismaClient;
  return { users: await prisma.user.findMany() };
}
import { createHandler } from 'camelon';
import { PrismaClient } from '@prisma/client';
import { manifest } from './gen/manifest.generated';

await createHandler({ routes: manifest, db: new PrismaClient() });

db is typed as unknown by default. Cast or wrap it for type safety:

export async function loader({ db }: RouteArgs) {
  const prisma = db as PrismaClient;
  return { users: await prisma.user.findMany() };
}

If you use db without configuring one, the first access throws a clear error. Apps that never touch db pay nothing.