Skip to content
Ad slotPut your product on this line. It runs at the top of every page on IndieHacked.Advertise
Tools

Secrets setup

The Secrets setup writes a SECRETS.md for your project: the rules your coding agent follows with API keys, with where each secret lives on your stack.

Pick your agents, frontend, backend, host and services, and it adds the .gitignore lines, the agent rules and a pre-commit secret scan to match.

It runs in your browser and never asks for a key. To check a project that already holds keys, use the prompt in our guide.

Built by the IndieHacked team

Your coding agents
Your frontend
Your backend

Leave it empty if you have none.

Where it runs
Services with keys
Your repository

Your files

Copy each into your project. Start with SECRETS.md: it is the file your agent reads first.

The project's root folder. Commit it: it holds rules, never values.

# Secrets: how this project handles them

Read this before any work that touches environment variables, config, credentials, deploys or CI. When you learn something new about how secrets behave in this project, add it under Learned, with the date.

## Where secrets live

A secret lives in one of these places and nowhere else. Everything else refers to it by its variable name.

- On this computer: `.env.local`, ignored by git. Never committed, never pasted into the chat.
- In production: Vercel: the project's environment variables, set for Production, Preview and Development as needed.
- In Supabase: Edge Function secrets for keys your functions use.
- In CI: the CI's own secret store (on GitHub, Actions secrets).

If a new secret needs a home that isn't on this list, stop and ask me.

## Rules

- Never show a secret's value: not in the chat, a file, a commit, a pull request, an issue or a log. Name the variable instead.
- Never put a secret on a command line. Reference it by name (`$STRIPE_SECRET_KEY`). A command line is saved in shell history, shows in process listings, and once approved for good it is stored in the agent's settings. Claude Code's `.claude/settings.local.json` saves every command you approve with "don't ask again", word for word.
- Never approve or write an allow rule that contains a secret. Approve a pattern, such as `npm run *`, instead of one literal command.
- To check that a key works, call the provider with it by name and read the status code: 200 means it works, 401 or 403 means it doesn't. Never print the key to check it.
- Check a key against the kind of endpoint it is for. A user's session token sent to an admin API fails whether it is live or not, so a 401 there proves nothing.
- Never put a secret in a field a tool treats as non-secret, such as a username, a URL or a header in a config file. Tools print those fields.
- One key per consumer. The key the agent uses on this computer is never the production key, so a leak from here never reaches production.
- When a key is rotated, update every place on the list above the same day. A missing copy often fails without an error.
- If a secret shows up anywhere it shouldn't, say so at once. Rotate it at the provider first, then clean up: deleting a file doesn't take a key out of git history, forks or clones.

## Public or secret on this stack

- `NEXT_PUBLIC_` variables are public: Next.js writes them into the JavaScript every visitor downloads. Only publishable keys go in them.
- Supabase: the publishable key (`sb_publishable_`, the older `anon` key) can ship in the app and only reaches what Row Level Security allows. The secret key (`sb_secret_`, the older `service_role` key) bypasses Row Level Security: server only.
- Stripe: the publishable key (`pk_`) is public. Use a restricted key (`rk_`) with only the permissions the code needs, and keep the unrestricted secret key (`sk_`) out of new code.
- OpenAI and Anthropic keys are secret. Call them from your server, never from the browser or the app.

## Commands that print secrets

Don't run these as they are. Ask me first, or query only the one value you need.

- `printenv`, `env` and `set`: every variable in the shell, keys included.
- Opening or `cat`-ing any `.env` file. To see what exists, list names only: `cut -d= -f1 .env.local`.
- Process listings that show full command lines (`ps`, `pgrep -f`): a key passed as an argument shows there.
- `vercel env pull` writes every variable into a local file: run it only into a git-ignored file, and never read that file back out.
- `supabase config push` and its diff can print values that `env()` resolves into fields the CLI treats as non-secret.
- `stripe config --list` prints the CLI's saved keys.
- `gh auth token` prints your GitHub token.
- Any other command that lists, pulls, diffs or exports config: assume it prints secrets until you've seen that it doesn't.

## Learned

Add a line each time something about secrets surprises us: the date, what happened, and the rule that came from it.

How the setup works

A file your agent reads first

A coding agent starts every session without the last one's lessons, so the rules go in a file in the project: SECRETS.md. It says where each secret lives, the rules for handling one, which keys on your stack are public and which are secret, and the commands that print keys as a side effect. The agent reads it before any work with config or credentials, because the line in CLAUDE.md or AGENTS.md tells it to.

The last section, Learned, starts empty. Each time something about your keys surprises you, the agent adds the date, what happened and the rule that came from it. That is how the IndieHacked team keeps its own projects' rules: one file per topic, read first and added to, so a lesson learned once is never learned twice.

Rules the agent can't skip

Claude Code's docs say it plainly: its permission rules are enforced by Claude Code, while instructions in CLAUDE.md only shape what Claude tries to do. So the setup pairs the written rules with ones the tools enforce: .gitignore lines that travel with the repository, deny rules that stop Claude Code reading .env files, ask rules before the commands that print keys, and a gitleaks check on every commit.

The .gitignore lines matter even where your agent already hides its own files. Claude Code keeps .claude/settings.local.json out of git through your global git excludes, which don't follow the project to another computer or cover a file someone has already committed. Apiiro found 104,185 public copies of that file on GitHub, and 1,122 held a real secret (5 November 2026).

What it can't catch

Secret scanners look for key formats, and a password typed into a command has none. Apiiro ran gitleaks and TruffleHog over the 1,122 files with a real secret: 215 were flagged by neither. That gap is why the rules come first: a key you never type into a command is never saved in one.

Nothing you pick leaves your browser, and the setup never asks for a key. To check a project that already has keys in it, use the prompt in the guide.

Questions founders ask

Does the setup need my API keys?

No. It writes the rules for handling keys, never the keys themselves, and it never asks for one. Never paste a real key into any web form or chat to set this up.

Is anything I pick sent anywhere?

No. The setup runs in your browser and nothing you pick leaves it. Close the page and your picks are gone.

Which coding agents read these files?

Claude Code reads CLAUDE.md. Codex, Cursor, Gemini CLI, GitHub Copilot's coding agent and others listed on agents.md read AGENTS.md. Pick every agent you use and the setup writes the line for each file.

My project already has a CLAUDE.md or an AGENTS.md. Do I replace it?

No. Add the Secrets section to the file you have and keep the rest. The same goes for .gitignore and .claude/settings.json: add the lines, and merge the rules into the lists already there.

What if a key is already in my repository?

Rotate it at the provider first, then clean up. Deleting the file or the commit doesn't take the key out of git history, forks or clones, and Apiiro found 734 secrets that now live only in a file's history. The guide's prompt walks your agent through finding and fixing them.

Should SECRETS.md be committed?

Yes. It holds rules and the names of variables, never their values, so everyone working on the project and every agent gets the same rules. If a value ever lands in it, treat that key as leaked.