bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
35 lines (34 loc) • 1.01 kB
TypeScript
import type { RuntimeBkndConfig } from "bknd/adapter";
declare global {
namespace Cloudflare {
interface Env {
}
}
}
export type CloudflareEnv = Cloudflare.Env;
export type CloudflareBkndConfig<Env = CloudflareEnv> = RuntimeBkndConfig<Env> & {
mode?: "warm" | "fresh" | "cache" | "durable";
bindings?: (args: Env) => {
kv?: KVNamespace;
dobj?: DurableObjectNamespace;
db?: D1Database;
};
d1?: {
session?: boolean;
transport?: "header" | "cookie";
first?: D1SessionConstraint;
};
static?: "kv" | "assets";
key?: string;
keepAliveSeconds?: number;
forceHttps?: boolean;
manifest?: string;
};
export type Context<Env = CloudflareEnv> = {
request: Request;
env: Env;
ctx: ExecutionContext;
};
export declare function serve<Env extends CloudflareEnv = CloudflareEnv>(config?: CloudflareBkndConfig<Env>): {
fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
};