All docs pages
Docs

Secrets

API keys and passwords the app needs, kept out of the code and set in Settings, Secrets.

In stackly.json and the CLI it is secrets. It has no price of its own; see What features cost.

secrets · always included · Worker secrets

API keys and passwords the app needs, kept out of the code. The owner fills them in under Settings, Secrets.

Use it

  1. List each secret the app reads in stackly.json:

    "secrets": [{ "name": "STRIPE_SECRET_KEY", "description": "Stripe secret key, from Developers, API keys" }]
    
  2. Read it in server code only, under its exact name, and fail closed when it is missing:

    import { env } from "cloudflare:workers";
    
    const key = env.STRIPE_SECRET_KEY;
    if (!key) throw new Error("Payments are not set up yet.");
    
  • Stackly's agent asks for a missing secret by ending its reply with <stackly_secrets>[{"name":"NAME","description":"…"}]</stackly_secrets>. Add "generate":"random" only for a key the app owns, such as a session signing key.
  • A secret can have a separate draft value (a test key). Read it the same way in both stages.

Don't

  • Never put a secret in code, in "settings" (shown in plain text), in a log line or in the browser.
  • Never invent a fallback value, and never ask the person to paste a credential into the chat.

Locally

stackly dev reads secrets from .dev.vars (stackly secrets init writes it). Never commit that file.

All app features