Skip to main content

What is an edge runtime?

An edge runtime is a server environment that runs your code closer to the user — on servers distributed around the world rather than in one central data center. Examples include Cloudflare Workers, Deno Deploy, Bun, and Next.js edge routes. Edge runtimes are fast and lightweight, but they are sandboxed — they intentionally strip out many Node.js APIs to keep the environment small and secure. In particular, they have no access to the file system (fs) and no path module. Why does this affect IlanaORM? By default, when you import IlanaORM, it automatically looks for and loads your ilana.config.js file using Node.js fs and path. This works perfectly in a normal Node.js server, but it crashes immediately in an edge runtime because those APIs don’t exist there. IlanaORM solves this with a separate edge entry point that skips the auto-loader entirely. Everything else — models, queries, relations, transactions — works exactly the same.

Usage

Import from ilana-orm/edge instead of ilana-orm:
Since there’s no config file to auto-load, you must call Database.configure() yourself before using any models:

Cloudflare Workers


Next.js Edge Routes


What works and what doesn’t

Migrations and seeders are Node.js CLI tools — they run on your machine or in CI before deployment, not inside the edge worker. Run npx ilana migrate during your deploy pipeline, then point the edge worker at the already-migrated database.