Every startup eventually builds the same uncomfortable habit. A payment key is pasted into a chat message so a teammate can test something. A .env file gets emailed to a new contractor. A database password ends up hard coded in a script that "will be cleaned up later." None of these feels dangerous in the moment, yet together they are one of the most common ways small companies get breached.
This guide explains how to manage secrets (API keys, database credentials, signing keys and tokens) in a way that suits a small team. You do not need an enterprise security department. You need a few clear rules, a central place to keep secrets, and automation that catches mistakes before they reach production.
A secret is any value that grants access to a system or data. The obvious ones are API keys for payment gateways, cloud provider credentials and database connection strings. Less obvious ones include webhook signing secrets, JWT signing keys, OAuth client secrets, SSH keys and the tokens your CI pipeline uses to deploy.
The danger is not only theft. A leaked cloud key can be used to launch expensive compute jobs, a leaked email provider key can be used to send spam under your domain, and a leaked database credential can expose customer records. For companies handling personal data, that also creates legal exposure. Our guide on DPDP Act compliance for Indian startups explains why a preventable credential leak can become a regulatory problem and not just a technical one.
Before choosing tools, it helps to know where leaks actually happen. In most small teams the list is short and boring:
Consider a hypothetical early-stage marketplace with four developers. The team stores credentials in a shared document, and each developer keeps a local .env file. When a contractor finishes a three-month engagement, nobody can say with confidence which keys they saw. Rotating everything would take a day of coordinated work, so the team postpones it, and the contractor's access effectively never expires.
Now imagine the same team after a cleanup. Secrets live in a central manager, each environment has its own set of values, and developers receive access through their own identities rather than copied files. When the contractor leaves, an admin removes one account and rotates the two secrets that account could read. The offboarding takes minutes. The difference is not budget or sophistication. It is having one source of truth.
Here is an order of operations that works for most small teams. Each step delivers value on its own, so you can stop at any point and still be safer than before.
There is a spectrum of options, and the right one depends on team size and risk. Plain environment variables set in your hosting platform are fine for a prototype, but they offer little audit trail. Cloud provider secret managers add access control, versioning and logging with modest effort. Dedicated vault products add dynamic credentials (short-lived passwords generated on demand) and finer policy, at the cost of more operations work.
If your team is small, a cloud-native secret manager is typically the sweet spot. Where you host will influence this choice, and our comparison of Vercel, AWS and self-hosted startup stacks covers how each option handles configuration and access control.
Anything shipped to a browser or phone is public in practice. Never place a secret key in front-end code or a mobile bundle, even if it is obfuscated. Instead, route sensitive calls through your own backend, which holds the real credential and enforces limits per user. Where a provider offers restricted public keys (limited by domain, bundle ID or scope), use those for the client and keep the powerful key on the server.
Pipelines are a favourite target because they hold deployment credentials and run third-party code. A few habits reduce the risk considerably. Prefer short-lived tokens issued through your cloud provider's identity federation instead of long-lived keys stored in CI settings. Scope each token to a single environment and job. Avoid echoing variables in build logs, and mask values where the platform supports it. Finally, restrict who can edit pipeline definitions, because anyone who can change the workflow can often exfiltrate the secrets it uses.
If you are building a mobile or web product with a delivery partner, agree on this early. Our web development services include setting up environments and deployment pipelines so credentials are handled properly from the first release.
Teams avoid rotation because they fear breaking production. The fix is designing for it. Support two valid credentials at once during a transition window: create the new one, deploy applications that use it, then retire the old one. Many providers allow multiple active keys for exactly this reason. Make applications fetch secrets at start or refresh them periodically, so a rotation does not require a code change. Test the process in staging so the first time you rotate is not during an emergency.
A secret that only one system can read, only for a short time, and only with a logged request is a secret you can afford to lose.
Even good teams have accidents, so prepare the response. First, revoke or rotate the credential at the provider. Speed matters because automated scrapers search public repositories continuously. Second, check the provider's usage logs for activity you do not recognise, covering the full window since the secret was exposed. Third, remove the secret from the code and, where appropriate, clean the git history, remembering that this does not undo exposure. Fourth, identify the root cause: was it a missing scanner, a confusing process or a one-off slip? Fix the system rather than blaming the person. Finally, if customer data may have been accessed, involve whoever handles legal and notification duties promptly.
Secrets management is not glamorous, but it is one of the highest-return security investments a small company can make. Start with an inventory, move credentials into a central store, separate environments, add scanners to your workflow and write down what happens when something leaks. Each of those steps takes hours rather than weeks, and together they remove the habits that cause most credential incidents.
If you would like help hardening an existing product or building a new one with secure foundations, the Mavani Solution team can review your current setup and suggest a practical, staged plan.