How do you manage secrets and configuration in a Node.js application?

Secrets and configuration can be managed using environment variables, often through a .env file loaded with libraries like dotenv. For sensitive information, using a secrets manager (like AWS Secrets Manager or HashiCorp Vault) is recommended. This keeps sensitive data out of source code.

Example:

require('dotenv').config();
const dbPassword = process.env.DB_PASSWORD; // Access secret