Programming guide

Keep passwords and API keys out of your code

Move passwords, API keys and tokens into environment variables, stop them reaching Git and know what to do quickly if a secret is ever exposed.

Estimated time: 30–60 minutesUpdated: 28 September 2026

Use this guide when your code contains passwords, API keys, database connection strings or tokens, or before you share a project or deploy it. Have your project open, access to the services whose keys you use and your hosting platform's settings.

Step by step

  1. Find every secret

    Search your code for words like password, key, token, secret and connection strings. Check configuration files, scripts and test files too. List each secret and which service it belongs to.

Members

The rest of this guide is for members

This guide continues with 4 more sections. Unlock this guide and all 207 ABCDayZ guides with checklists, troubleshooting and next steps.

£3.99 for 1 month or £29 for 12 months. One payment, no automatic renewal.

Unlock all guides

Already a member on another device? Open your personal access link. Bought Programming with AI? Your first month is included.