{"id":28304,"library":"stealthql","title":"StealthQL","description":"StealthQL (v0.2.13) is a repo-native backend capsule for Next.js that bundles a local PGlite database, built-in auth (magic links, Google/GitHub/Facebook OAuth, recovery codes, org membership, service accounts, share tokens), policy-based row access control, field masks, Google-Sheets-style shares with proposals/CSV round-trip/expiration/revocation/audit logs, scheduled jobs, compliance evidence, and one-command deployment to DigitalOcean or Vercel+DigitalOcean split. Published on npm, TypeScript ships types, requires Node >=20, and follows a local-first dev loop with hot-reload. Differentiates from Supabase/Firebase by being fully self-hosted, repo-native (capsule files checked into your repo), and LLM-friendly.","status":"active","version":"0.2.13","language":"javascript","source_language":"en","source_url":"https://github.com/stealthql/stealthql","tags":["javascript","backend","local-first","nextjs","auth","database","pglite","capsule","llm","typescript"],"install":[{"cmd":"npm install stealthql","lang":"bash","label":"npm"},{"cmd":"yarn add stealthql","lang":"bash","label":"yarn"},{"cmd":"pnpm add stealthql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"StealthQL is designed as a backend capsule for Next.js; scaffold commands target Next projects","package":"next","optional":false},{"reason":"Local database materialization uses PGlite (embedded Postgres via WASM)","package":"pglite","optional":false}],"imports":[{"note":"StealthQL is ESM-only since v0.2.0; CommonJS require() will fail with ERR_REQUIRE_ESM","wrong":"const StealthQL = require('stealthql')","symbol":"default import","correct":"import StealthQL from 'stealthql'"},{"note":"createCapsule is exported from stealthql/capsule subpath, not the main entry","wrong":"import { createCapsule } from 'stealthql'","symbol":"createCapsule","correct":"import { createCapsule } from 'stealthql/capsule'"},{"note":"Auth helpers are under stealthql/auth since v0.2.5","wrong":"import { defineAuth } from 'stealthql'","symbol":"defineAuth","correct":"import { defineAuth } from 'stealthql/auth'"},{"note":"Type imports should use `import type` to avoid runtime errors; Actor is only a type, not a value","wrong":"import { Actor } from 'stealthql/types'","symbol":"type Actor","correct":"import type { Actor } from 'stealthql/types'"},{"note":"Database helpers are under stealthql/database subpath","wrong":"import { runMigration } from 'stealthql'","symbol":"runMigration","correct":"import { runMigration } from 'stealthql/database'"}],"quickstart":{"code":"npm init -y && npm install next react react-dom stealthql && npx stealthql setup next && npm run dev:stealth","lang":"typescript","description":"Scaffolds a Next.js project with StealthQL backend capsule, local database, auth, and hot-reload dev server."},"warnings":[{"fix":"Replace `import StealthQL from 'stealthql'` with specific imports like `import { createCapsule } from 'stealthql/capsule'`","message":"Removed default export in v0.2.0; use named exports like createCapsule from subpaths","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Upgrade Node to v20 or later","message":"Requires Node >=20; older versions incompatible","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Use ESM imports (import/export) or dynamic import() in CommonJS files","message":"ESM-only since v0.2.0; CommonJS require() fails","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Use `npx stealthql setup next --typescript` instead of --javascript","message":"setup command with --javascript flag is deprecated; use --typescript for new projects","severity":"deprecated","affected_versions":">=0.2.10"},{"fix":"Set `PGLITE_DATA_DIR` environment variable or configure `storage` in stealth.storage.js","message":"PGlite database is in-memory by default; data lost on server restart unless configured with persistent storage","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Run `npm run build:capsule` and restart dev server after destructive schema changes","message":"Hot-reload does not apply schema changes that drop columns or tables; requires full restart","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use import('stealthql') or switch to ESM (type: module in package.json)","cause":"Trying to require('stealthql') in a CommonJS file","error":"ERR_REQUIRE_ESM"},{"fix":"Upgrade stealthql: npm install stealthql@latest","cause":"Using older version before auth subpath was added (<0.2.5)","error":"Module not found: Can't resolve 'stealthql/auth'"},{"fix":"Change import to `import { createCapsule } from 'stealthql/capsule'`","cause":"Importing createCapsule from main 'stealthql' instead of 'stealthql/capsule'","error":"Error: createCapsule is not a function"},{"fix":"Install Node v20 or later","cause":"Running on Node <20","error":"Error: Node version >=20 required"},{"fix":"Set environment variable PGLITE_DATA_DIR to a persistent path, or add storage configuration in stealth.storage.js","cause":"No persistent storage configured; PGlite defaults to in-memory which is lost on restart","error":"Error: PGlite not initialized. Set PGLITE_DATA_DIR or configure storage"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}