Skip to content

Edge Compatibility

JSORM is designed to work in any modern runtime, not just Node.js.

  • Edge: Cloudflare Workers, Vercel Edge Functions
  • Serverless: AWS Lambda, Google Cloud Functions
  • Node.js: 22+
  • Browser: for clients that talk directly to the DB

Note: @jsorm/compiler is NOT edge-compatible. It uses node:crypto for sync HMAC cursors. The PostgreSQL provider requires Node.js 22+ (sync node:crypto); it does not work on Bun, Deno, or Web Crypto runtimes.

Layer separation makes it possible:

  • Core (@jsorm/core) — Metadata and types only. No runtime dependencies.
  • Client (@jsorm/client) — Builds AST. No fs, path, process, or Node APIs.
  • Compiler (@jsorm/compiler) — Shared SQL generation. NOT edge-compatible (uses node:crypto).
  • Provider — You select the right provider for each environment.
import { jsorm, User } from "./models/jsorm.server.js";
export default {
async fetch(request: Request) {
const { data: users } = await jsorm.users.get({
where: { active: true },
});
return new Response(JSON.stringify(users));
},
};
import { jsorm, User } from "./models/jsorm.server.js";
const { data: users } = await jsorm.users.get({
where: { active: true },
});
console.log(users);

Same API. Same code. Only the registered provider changes.