API keys and passwords belong in environment variables or a secrets manager, never in code, never in git and never in frontend JavaScript that ships to the browser. Give each key only the permissions it needs, and rotate it if it might have leaked.
# .env (listed in .gitignore) DATABASE_URL=postgres://app:change-me@db:5432/app # scan a repository for leaked secrets docker run --rm -v "$PWD":/repo zricethezav/gitleaks:latest detect --source /repo