# Keeping Secrets Out of Your Code

An API's secrets, such as the key that signs its tokens and its database password, live in environment variables loaded from a .env file that Git never sees, with a committed .env.example naming them, a check at startup that each one is set, and a new secret at once if one ever reaches GitHub.

![Cheat sheet: Keeping Secrets Out of Your Code](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/136dc56dc5ae412492ab6c0c370bd632.webp)

- Category: Node.js
- Level: Journeyman
- Tags: API Key, env-file, gitignore, nodejs, process.env, Secret Rotation, web-development
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/node-security-secrets-cheat-sheet
