Welcome to the Jose Madrid Salsa developer docs — explore features, APIs, and deployment guides.
Jose Madrid SalsaJMS Docs

Secrets Management

Secret management, rotation procedures, and environment variable security

Secrets Management

All secrets for José Madrid Salsa are stored as Vercel environment variables. No secrets are committed to the repository.

Secret Inventory

SecretVariableRotation Frequency
Database passwordDATABASE_URLOn compromise
Auth session keyNEXTAUTH_SECRETOn compromise
Admin encryptionMASTER_KEYOn compromise
Data encryptionENCRYPTION_KEYOn compromise
Stripe API keySTRIPE_SECRET_KEYAnnually or on compromise
Stripe webhook secretSTRIPE_WEBHOOK_SECRETOn endpoint change
Resend API keyRESEND_API_KEYOn compromise
Google service account keyGOOGLE_SERVICE_ACCOUNT_PRIVATE_KEYAnnually
Sentry auth tokenSENTRY_AUTH_TOKENBuild-time only, on compromise
UploadThing secretUPLOADTHING_SECRETOn compromise
Anthropic API keyANTHROPIC_API_KEYOn compromise

Generating Secrets

Hex Secrets (MASTER_KEY, NEXTAUTH_SECRET)

openssl rand -hex 32

Base64 Secrets (ENCRYPTION_KEY)

node -e "console.log(require('crypto').randomBytes(64).toString('base64'))"

Vercel CLI

# Add a secret to production
vercel env add SECRET_NAME production

# Remove and re-add to rotate
vercel env rm SECRET_NAME production
vercel env add SECRET_NAME production

Pre-Commit Protection

Gitleaks runs on every commit to prevent accidental secret exposure:

# Scan the entire repo
npm run security:scan

# Scan only staged changes (runs automatically via pre-commit hook)
npm run security:protect

# Generate a baseline report
npm run security:baseline

The pre-commit hook chain is:

git commit → husky pre-commit → lint-staged → gitleaks protect

Do not skip hooks

Never use git commit --no-verify to bypass the secret scanning hook. If Gitleaks flags a false positive, add it to a .gitleaksignore file instead.

Rotation Procedure

Generate a new secret value

Use the appropriate generation command for the secret type.

Update in Vercel

vercel env rm SECRET_NAME production
vercel env add SECRET_NAME production

Or update via the Vercel Dashboard: Project Settings > Environment Variables.

Trigger redeployment

vercel --prod

Or push an empty commit:

git commit --allow-empty -m "chore: trigger redeploy for secret rotation"
git push origin main

Verify the deployment

Check that the new deployment starts correctly and the application functions normally.

Revoke the old secret

For third-party services (Stripe, Resend, Google), revoke the old key in their respective dashboards after confirming the new key works.

Environment Isolation

Secrets should differ across environments:

VariableProductionPreviewDevelopment
NEXTAUTH_SECRETUniqueUniqueUnique
STRIPE_SECRET_KEYsk_live_...sk_test_...sk_test_...
DATABASE_URLProduction NeonBranch/dev NeonLocal Postgres
MASTER_KEYUniqueUniqueUnique

Never share production secrets

Production secrets must never be reused in preview or development environments. A compromised preview deployment should not grant access to production data.

.env Files

The repository contains several .env template files:

FilePurposeCommitted
.env.exampleTemplate with placeholder valuesYes
.env.localLocal development valuesNo (gitignored)
.env.vercel.productionPulled from VercelNo (gitignored)

Pull production variables locally for debugging:

npm run db:production:pull-env
# or: vercel env pull .env.vercel.production --environment=production --yes

How is this guide?

Edit on GitHub

Last updated on

On this page