Documentation Index
Fetch the complete documentation index at: https://docs.capy.sc/llms.txt
Use this file to discover all available pages before exploring further.
Synopsis
-- is passed through to the child process.
Description
capy run decrypts your project’s secrets in memory and spawns the given command with them set as environment variables. Your app reads env vars the normal way for its runtime - process.env, os.environ, ENV["KEY"], std::env::var, whatever.
This is Capy’s single runtime mechanism - works for any language, any framework, local dev through production, no per-language SDK to install.
Plaintext values live only in the child process’s memory and are never written to disk.
Two modes
capy run auto-detects which mode to run in based on what’s in process.env:
Local mode (default)
WhenSECRETS_BLOB and PROJECT_KEY are not set, capy run:
- Reads
.envfrom the current working directory. - Resolves your project key, in priority order:
CAPY_KEYenv var (64-char hex), or- the per-project cache at
~/.capy/orgs/{orgId}/projects/{projectId}/key.cachethatcapy(sync) populates after a successful server round-trip.
- Decrypts each
capy:…snippet in.env. - Spawns the child with the decrypted values set in its environment.
capy once to sync and populate the cache; capy run after that is offline.
Deployed mode
When bothSECRETS_BLOB and PROJECT_KEY are set in process.env, capy run:
- Parses
SECRETS_BLOBlocally - extracts the deploy ID, the service-held outer blob, and the encrypted env map. - Posts the outer blob to
POST /deploy/{deployId}/decrypton the Capy service. The service verifies the deploy token isn’t revoked and returns a derived service key. - Combines
PROJECT_KEYwith the service key to derive the decrypt key, then AES-GCM-decrypts the env map. - Spawns the child with those values set in its environment.
capy deploy. No local .env file, no local keyring, no interactive auth.
If only one of
SECRETS_BLOB / PROJECT_KEY is set, capy run exits with an error rather than silently falling back to local mode. Makes platform misconfiguration loud instead of silent.Behavior (both modes)
- Variables already set in the parent shell environment are preserved as-is - decrypted values don’t overwrite explicit env.
- Forwards
SIGINT,SIGTERM, andSIGHUPto the child. - Exits with the child’s exit code.
Examples
In containers
capy run can serve as the Docker entrypoint:
SECRETS_BLOB and PROJECT_KEY (from capy deploy) are present in the container’s environment at runtime.
Next.js on Vercel
In deployed mode,capy run also writes .capy/next-env.js before spawning the child. That file maps each decrypted variable name to its process.env reference. In next.config.js:
next.config.js. See Deploying → Vercel for the full walkthrough.
See also
- Running your app - the full runtime story
- Deploying - how
SECRETS_BLOBandPROJECT_KEYreach your platform