app-secrets
Skill9 starsChanged 27 days agoMITView on GitHub
Guide for creating and using secrets in Fusebase Apps app backends. Use when: (1) An app backend needs API keys, passwords, or other sensitive config, (2) Creating secrets via the CLI, (3) Accessing secrets at runtime in backend code, (4) Deciding what should be a secret vs. a regular env var.
- Reads credentials
In this repository119 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/fusebase-flow-always.mdcCursor rule
- .cursor/rules/fusebase-flow-implementation.mdcCursor rule
- .cursor/rules/fusebase-flow-security.mdcCursor rule
- .cursor/rules/fusebase-flow-specs.mdcCursor rule
- .cursor/rules/fusebase-flow-validation.mdcCursor rule
- api-explorationSkill
- app-api-contract-testingSkill
- app-backendSkill
- app-business-docsSkill
- app-dev-practicesSkill
- app-e2e-testsSkill
- app-quality-patternsSkill
- app-routingSkill
- app-sidecarSkill
- app-ui-designSkill
- business-logic-guardianSkill
- client-vs-internalSkill
- code-reviewSkill
- comment-policySkill
- communicationSkill
- design-discovery-ideationSkill
- dev-debug-logsSkill
- documentation-budgetSkill
- file-uploadSkill
- find-wasted-codeSkill
- find-wasted-effortSkill
- fusebase-cliSkill
- fusebase-dashboardsSkill
- fusebase-flow-health-checkSkill
- fusebase-gateSkill
- fusebase-portal-specific-appsSkill
- git-history-diagnosticSkill
- git-workflowSkill
- handling-authentication-errorsSkill
- handoffSkill
- implementation-planningSkill
- invite-with-passwordSkill
- lightweight-laneSkill
- liveness-disciplineSkill
- managed-integrationsSkill
- mcp-gate-debugSkill
- module-size-disciplineSkill
- north-starSkill
- phase-auditSkill
- product-apps-decompositionSkill
- product-docs-firstSkill
- product-ownerSkill
- project-onboardingSkill
- release-deploy-reportingSkill
- remote-logsSkill
- repo-onboarding-context-mapSkill
- requirements-specificationSkill
- role-disciplineSkill
- security-permissions-reviewSkill
- skill-authoringSkill
- smoke-testingSkill
- task-delegationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use the CLI to register secret keys (values are set on the FuseBase website):
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
App Secrets
Secrets are encrypted key-value pairs stored in Fusebase and injected into the app backend at runtime as environment variables. Use them for sensitive config that must not be committed to source control (API keys, passwords, tokens, etc.).
Secrets are only available in the app server (backend/ directory). They are NOT accessible in the browser/SPA — never try to read secrets from the frontend.
Creating Secrets
Use the CLI to register secret keys (values are set on the FuseBase website):
fusebase secret create --app <appPath> --secret "KEY:description" [--secret ...]appPath— the app'sapps[].pathfromfusebase.json;--featureis accepted as a deprecated alias for--app- Each
--secretisKEYorKEY:human-readable description - Pass multiple
--secretflags to create several secrets at once - This command only edits
fusebase.json(it makes no network call and prints no URL). The keys are registered on the platform — with empty values — on the nextfusebase deploy/fusebase dev start, and that command prints the URL where you fill in the actual values
Examples:
# Single secret
fusebase secret create --app apps/my-app --secret "OPENAI_API_KEY:OpenAI API key"
# Multiple secrets at once
fusebase secret create --app apps/my-app \
--secret "STRIPE_SECRET_KEY:Stripe secret key" \
--secret "DB_PASSWORD:Database connection password" \
--secret "WEBHOOK_SECRET:Webhook signing secret"Then run fusebase deploy (or fusebase dev start) to register the keys on the platform. That run prints the secrets URL:
Registered 3 new secret key(s) for apps/my-app: STRIPE_SECRET_KEY, DB_PASSWORD, WEBHOOK_SECRET
Set their values in the FuseBase UI:
https://{org-domain}/dashboard/{orgId}/apps/features/{appId}/secretsOpen that URL and fill in the secret values. The URL is printed only when new keys are registered — if the keys already exist on the platform, nothing is printed and you can reach the same page from the app's Secrets tab in the FuseBase UI.
Accessing Secrets at Runtime
Secrets are injected as environment variables into the app backend process. Read them via process.env:
// backend/src/index.ts or any backend file
const apiKey = process.env.OPENAI_API_KEY
if (!apiKey) {
throw new Error('OPENAI_API_KEY is not set')
}Validate required secrets at backend startup so the backend fails fast with a clear error rather than failing silently on the first request:
// backend/src/config.ts
function requireEnv(key: string): string {
const value = process.env[key]
if (!value) throw new Error(`Missing required environment variable: ${key}`)
return value
}
export const config = {
openaiApiKey: requireEnv('OPENAI_API_KEY'),
stripeSecretKey: requireEnv('STRIPE_SECRET_KEY'),
}Local Development
fusebase dev start downloads secrets from Fusebase and injects them into the backend process as environment variables — the exact same secrets used in production. There is no need for a .env file or the dotenv package.
- ❌ Do NOT create a
backend/.envfile for secrets - ❌ Do NOT add
dotenvas a dependency - ❌ Do NOT use
import 'dotenv/config'in backend code - ✅ Use
fusebase secret createto declare secrets, set values in the FuseBase UI (URL printed byfusebase deploy/fusebase dev start), and they will be available viaprocess.envin both dev and production
Runtime Persistence
Secrets are read-only at runtime — the backend cannot update secret values programmatically. They are set via the CLI or the Fusebase web UI.
Secrets (env vars) are best for shared, deploy-time credentials (API keys, service-account tokens). They are not suitable for per-user or dynamically obtained tokens because they cannot be written at runtime and the backend is stateless (no filesystem, no in-memory persistence across restarts).
For per-user credentials obtained at runtime (e.g. OAuth refresh tokens from a callback), use httpOnly cookies instead — see skill app-backend, "Stateless Backend" section. The cookie is sent by the browser on every request; the backend reads it and stays stateless. The env-var secret can serve as a fallback.
Checklist
fusebase secret createrun with all required keys and descriptions- Secret values filled in via the app secret manager on the FuseBase website
- Secrets validated at backend startup (fail fast with a clear error)
- No
backend/.envfile — secrets are injected byfusebase dev startautomatically - No
dotenvdependency in backend code - No secrets referenced in SPA/browser code
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

