Entity Auth

Replicator Playbooks

Step-by-step guides for deploying the real-time bridge across environments.

Replicator Playbooks

Next.js real-time UI

  1. Scaffold template:
    npx @entityauth/cli bridge scaffold entity-auth --node entityauth:bridge:postgres-prisma
  2. Install dependencies & generate Prisma client:
    cd entity-auth/templates/postgres-prisma
    npm install
    npx prisma generate
  3. Configure environment variables (.env.local):
    CONVEX_URL=https://<deployment>.convex.cloud
    WORKSPACE_TENANT_ID=workspace_123
    CONVEX_REPLICATOR_TOKEN=ct_...
    DATABASE_URL=postgresql://...
  4. Start the bridge:
    npx @entityauth/cli bridge start entity-auth --node entityauth:bridge:postgres-prisma
  5. Run your Next.js app (npm run dev) using the synchronized database.
  6. Monitor health with bridge status.
  7. Publish local mutations via the template’s publishExternalMutation helper.

Background worker (Node)

  1. Scaffold or compose your own project using @entityauth/replicator.
  2. Ensure persistent storage for offsets (SQLite file, Redis, etc.).
  3. Deploy under systemd, PM2, or containers; call stop() on shutdown.
  4. Automate health reporting with periodic bridge heartbeat.

Serverless batch (cron)

  1. Create a handler that runs runBridge once with a custom waitFn.
  2. Schedule the job (Cloudflare Cron, AWS EventBridge, etc.).
  3. Persist offsets in a durable store (Cloudflare DO, Redis, etc.).
  4. On each invocation, resume from the stored cursor and exit cleanly.

Memory demo

Use for quick validation or integration tests:

npx @entityauth/cli bridge scaffold entity-auth --node entityauth:bridge:memory-demo
npx @entityauth/cli bridge start entity-auth --node entityauth:bridge:memory-demo

Common knobs

  • eventsPerBatch – balance throughput vs latency.
  • retry – tune exponential backoff behaviour.
  • applyExternalMutationAction – enable bi-directional sync.
  • logPath – send structured logs to your platform.

Consult the operations guide for security and monitoring.