Interactive setup
Run stash init to authenticate, resolve your database, scaffold an encryption client, install dependencies, and add the EQL extension to CipherStash.
npx stash init is the first step in the CipherStash setup lifecycle. It authenticates you, resolves your database, scaffolds an encryption client, installs dependencies, installs the EQL extension, and writes a context file. When it finishes, it prompts you to continue to stash plan.
npx stash initWhat init does
Init runs six steps with minimal prompts:
- Authenticates with CipherStash: If you are already authenticated, it logs
Using workspace <id> (region)and moves on. No prompt. If you are not authenticated, it opens your browser for device-based authentication. Your token is saved to~/.cipherstash/auth.json. - Resolves the database: Reads your
DATABASE_URLand verifies a connection can be made. Detects your Postgres provider (Supabase from the URL host, or generic Postgres). - Generates the encryption client file: Auto-detects your integration (Drizzle from
drizzle.config.*ordrizzle-orm/drizzle-kitinpackage.json, Supabase from theDATABASE_URLhost, or generic Postgres). Writes a placeholder client to./src/encryption/index.tssilently. If that file already exists, it prompts you to keep it or overwrite it. - Installs dependencies: Checks whether
@cipherstash/stackandstashare already innode_modules. If both are present, skips silently. If either is missing, shows a single combined install prompt. Detects your package manager (npm, pnpm, yarn, bun) automatically. - Installs EQL: Runs the same logic as
stash db install. Scaffoldsstash.config.tsif missing, detects your provider, and installs the EQL extension into your database. You do not need to runstash db installseparately after init. - Gathers context: Writes
.cipherstash/context.jsonwith the detected integration, package manager, schemas, environment keys, and available agents. This file is required bystash planandstash impl.
Best case: 0 prompts (already authenticated, both packages installed, no existing client file, database reachable). Worst case: 2 prompts (region selection for first-time login, install confirmation for missing packages).
| Flag | Description |
|---|---|
--supabase | Changes the intro message and next-steps output to the Supabase path. Detection handles file scaffolding regardless of this flag. |
--drizzle | Changes the intro message and next-steps output to the Drizzle path. Detection handles file scaffolding regardless of this flag. |
Generated files
Init produces two files:
./src/encryption/index.ts: A placeholder encryption client. The template matches your detected integration. For a generic Postgres project it generates:
import { Encryption } from "@cipherstash/stack"
import { encryptedTable, encryptedColumn } from "@cipherstash/stack/schema"
const users = encryptedTable("users", {
email: encryptedColumn("email").equality().freeTextSearch(),
name: encryptedColumn("name").equality().freeTextSearch(),
})
export default await Encryption({ schemas: [users] }).cipherstash/context.json: Detected facts about your project. stash plan and stash impl read this file. It includes your integration type, package manager, detected schemas, environment keys, and available coding agents.
After init
When init completes, it shows a summary panel:
Setup complete
✓ Authenticated to CipherStash
✓ Database connection verified
✓ Encryption client scaffolded
✓ `@cipherstash/stack` installed
✓ `stash` CLI installed
✓ EQL extension installedThen it asks (default-yes):
Continue to `stash plan` now to draft your encryption plan? (Y/n)Answering yes launches stash plan immediately. Answering no (or running non-interactively) prints:
Next: run `stash plan` to draft your encryption plan.db install flags
If you need to run EQL installation with specific flags (for example, writing a Supabase migration file), use stash db install directly after init:
npx stash db install --supabase --migration
npx stash db install --drizzle
npx stash db install --drizzle --supabaseGood to know: You can pass
--drizzleand--supabasetogether. The CLI combines both behaviors: Supabase-compatible SQL output as a Drizzle migration.
See Install and upgrade EQL for the full flag reference.
Next steps
CipherStash CLI
The stash dev-time CLI installs EQL in PostgreSQL, scaffolds an encryption client, and manages schemas with init, plan, and impl commands.
Draft an encryption plan
Run stash plan to hand off to a coding agent that drafts a reviewable encryption plan.md, with column paths, before any code changes are made.