@mintcd/sync-engine
v0.1.0
Published
Sync engine specialized for Cloudflare D1 + indexedDB and Next.js
Downloads
132
Maintainers
Readme
A sync engine specialized to:
- Remote database: Cloudflare D1
- Local database: indexedDB and localStorage
- Framework: file-based routing Nextjs
Quick generator usage
- Generate Next.js API routes and a service worker from a schema:
# from anywhere after publishing the package
npx @mintcd/sync-engine path/to/schema.json [projectRoot]Example:
npx @mintcd/sync-engine ./schema.example.json ./my-next-appClient usage
Import the runtime helpers from the package in your client code:
import { createSyncEngine } from '@mintcd/sync-engine';
const engine = createSyncEngine(schemaOrConfig, { autoRegisterSW: true });The generator already writes app/api/<table>/route.ts files and public/sw.js for you.
