EdgeBase Cloudflare Worker server
npm install @edgebasejs/workerCloudflare Worker server for EdgeBase. This package bundles the API routes and integrates auth, sync, migrations, and realtime.
``bash`
pnpm add @edgebasejs/worker
`ts
import { createEdgeBaseWorker } from '@edgebasejs/worker';
import schema from './edgebase.schema';
const app = createEdgeBaseWorker({
schema,
getDb: (c) => c.env.DB,
getJwtSecret: (c) => c.env.JWT_SECRET,
getEnvironment: (c) => c.env.ENVIRONMENT,
apiVersion: '0.1.0',
autoInitialize: (c) => c.env.ENVIRONMENT !== 'production',
});
export default app;
`
- Auth (register/login/logout/refresh)
- Offline-first sync and conflict handling
- Realtime subscriptions (WebSocket)
- Webhooks, audit logs, analytics, push notifications
- Admin API for database, users, and tooling
For production, run migrations explicitly and set autoInitialize` to false.