Secrets & Environment
Two layers of secrets in databayt:
| Layer | What | Source | Lands at |
|---|---|---|---|
| Cross-cutting | MCP keys, GitHub PAT, Anthropic API key, Slack tokens | Gist (secrets.sh <GIST_ID>) | ~/.claude/.env |
| Per-product app | DB URLs, OAuth client IDs, Stripe, etc. | Vercel team databayt (vercel env pull) | ~/<repo>/.env |
The Gist holds ~25 keys across sections (required, databases, ai, auth, services, cloudinary, imagekit, telegram, optional). The template lives at .claude/scripts/secrets-template.json. The Gist is hand-curated — admins fork the template, paste real values, and share the Gist ID out-of-band (Signal, Notes, 1Password). The script reads the Gist anonymously, so it must be secret (not private).
Cross-cutting secrets (Gist → ~/.claude/.env)
| Section | Examples |
|---|---|
| Required | ANTHROPIC_API_KEY, GITHUB_PERSONAL_ACCESS_TOKEN |
| Databases | NEON_API_KEY, DATABASE_URL_* (per-product) |
| AI | GROQ_API_KEY, product-specific keys |
| Auth | AUTH_SECRET, OAuth client IDs (Google, Facebook) |
| Services | SLACK_BOT_TOKEN + SLACK_WORKSPACE_ID, STRIPE_SECRET_KEY, VERCEL_TOKEN, others |
| Optional | Cloudinary, ImageKit, Telegram, Resend, others |
Pull from the Gist:
bash ~/kun/.claude/scripts/secrets.sh <GIST_ID>The script writes ~/.claude/.env with chmod 600 and appends an auto-export line to ~/.zshrc / ~/.bashrc. Re-run to refresh whenever a key rotates.
Per-product app env (Vercel → ~/<repo>/.env)
Each product on Vercel (kun, hogwarts, codebase, souq, mkan, shifa, marketing) has its env vars in the Vercel team databayt. The onboarding installer pulls them automatically during Phase 6 via the vercel-pull.sh helper:
# What runs per cloned repo
cd ~/hogwarts
vercel link --yes --project=hogwarts --scope=databayt
vercel env pull .env --environment=developmentRe-pull anytime to refresh:
bash ~/kun/.claude/scripts/vercel-pull.shIf you weren't logged in during install, run vercel login (OAuth, browser) and re-run the script.
Gotchas
Trailing newline (real incident). Vercel dashboard paste adds invisible \n to values. A GITHUB_PERSONAL_ACCESS_TOKEN with \n makes Authorization: Bearer <token>\n throw invalid header value — broke kun's report-an-issue form (PR #97). Always .trim() env reads in code. If you must set values via CLI, do it cleanly:
# Right — printf strips trailing newline
printf '%s' "$VALUE" | vercel env add NAME production
# Wrong — chaining stores an empty value
vercel env rm NAME && vercel env add NAME.env, not .env.local. databayt convention is a single central .env per repo. Don't create .env.local, .env.development, etc. — see ~/.claude/CLAUDE.md.
GITHUB_PERSONAL_ACCESS_TOKEN, not GITHUB_TOKEN. Canonical var name across all databayt repos. Fine-grained PAT (github_pat_...). Same token is reused across ~/.claude/mcp.json and per-repo .env files.
Troubleshooting
"Token may lack read:org scope" during install
gh auth refresh -h github.com -s read:org -wVercel env pull skipped during install
You weren't logged in. Run:
vercel login
bash ~/kun/.claude/scripts/vercel-pull.shSecrets section missing in my Gist
The Gist is hand-curated. Ask the admin to add the section to .claude/scripts/secrets-template.json and update the Gist.
Anthropic auth fails
echo $ANTHROPIC_API_KEY # should print sk-ant-...
claude doctor # full surface checkRequesting new secrets
- Open an issue in
databayt/kundescribing what you need - Admin adds the key to the Gist
- Re-run
secrets.sh <GIST_ID>to refresh~/.claude/.env
For Vercel-managed app env vars, ask the admin to add the var on the Vercel project at vercel.com/teams/databayt/<project>/settings/environment-variables, then re-run bash ~/kun/.claude/scripts/vercel-pull.sh.
On This Page
Secrets & EnvironmentCross-cutting secrets (Gist →~/.claude/.env)Per-product app env (Vercel → ~/<repo>/.env)GotchasTroubleshooting"Token may lack read:org scope" during installVercel env pull skipped during installSecrets section missing in my GistAnthropic auth failsRequesting new secrets