Registry / database / stealthql

stealthql

JSON →
library0.2.13jsnpmunverified

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.

npm install stealthql
INSTALL
IMPORT
SIG · STEALTHQL
S
stealthql
databasejavascriptv0.2.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import
import StealthQL from 'stealthql'
const StealthQL = require('stealthql')
StealthQL is ESM-only since v0.2.0; CommonJS require() will fail with ERR_REQUIRE_ESM
createCapsule
import { createCapsule } from 'stealthql/capsule'
import { createCapsule } from 'stealthql'
createCapsule is exported from stealthql/capsule subpath, not the main entry
defineAuth
import { defineAuth } from 'stealthql/auth'
import { defineAuth } from 'stealthql'
Auth helpers are under stealthql/auth since v0.2.5
type Actor
import type { Actor } from 'stealthql/types'
import { Actor } from 'stealthql/types'
Type imports should use `import type` to avoid runtime errors; Actor is only a type, not a value
runMigration
import { runMigration } from 'stealthql/database'
import { runMigration } from 'stealthql'
Database helpers are under stealthql/database subpath

Scaffolds a Next.js project with StealthQL backend capsule, local database, auth, and hot-reload dev server.

npm init -y && npm install next react react-dom stealthql && npx stealthql setup next && npm run dev:stealth
Debug
Known issues
breakingRemoved default export in v0.2.0; use named exports like createCapsule from subpaths
fix
Replace `import StealthQL from 'stealthql'` with specific imports like `import { createCapsule } from 'stealthql/capsule'`
affects: >=0.2.0
breakingRequires Node >=20; older versions incompatible
fix
Upgrade Node to v20 or later
affects: >=0.2.0
breakingESM-only since v0.2.0; CommonJS require() fails
fix
Use ESM imports (import/export) or dynamic import() in CommonJS files
affects: >=0.2.0
deprecatedsetup command with --javascript flag is deprecated; use --typescript for new projects
fix
Use `npx stealthql setup next --typescript` instead of --javascript
affects: >=0.2.10
gotchaPGlite database is in-memory by default; data lost on server restart unless configured with persistent storage
fix
Set `PGLITE_DATA_DIR` environment variable or configure `storage` in stealth.storage.js
affects: >=0.1.0
gotchaHot-reload does not apply schema changes that drop columns or tables; requires full restart
fix
Run `npm run build:capsule` and restart dev server after destructive schema changes
affects: >=0.1.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM
Trying to require('stealthql') in a CommonJS file
fix
Use import('stealthql') or switch to ESM (type: module in package.json)
Module not found: Can't resolve 'stealthql/auth'
Using older version before auth subpath was added (<0.2.5)
fix
Upgrade stealthql: npm install stealthql@latest
Error: createCapsule is not a function
Importing createCapsule from main 'stealthql' instead of 'stealthql/capsule'
fix
Change import to `import { createCapsule } from 'stealthql/capsule'`
Error: Node version >=20 required
Running on Node <20
fix
Install Node v20 or later
Error: PGlite not initialized. Set PGLITE_DATA_DIR or configure storage
No persistent storage configured; PGlite defaults to in-memory which is lost on restart
fix
Set environment variable PGLITE_DATA_DIR to a persistent path, or add storage configuration in stealth.storage.js
Upgrade
Version history
0.2.13latest on npm
Audit
Dependencies
nextrequiredStealthQL is designed as a backend capsule for Next.js; scaffold commands target Next projects
pgliterequiredLocal database materialization uses PGlite (embedded Postgres via WASM)
Agent activity
20 hits · last 30 days
node
16
OpenAI (training)
1
Resources