Skip to content

chore(compose): set NODE_ENV=production by default on the api service#198

Merged
CryptoJones merged 1 commit into
masterfrom
chore/docker-compose-api-node-env-production
May 19, 2026
Merged

chore(compose): set NODE_ENV=production by default on the api service#198
CryptoJones merged 1 commit into
masterfrom
chore/docker-compose-api-node-env-production

Conversation

@CryptoJones
Copy link
Copy Markdown
Owner

Closes #197.

Summary

The migrate service set NODE_ENV: production but the api service didn't. Libraries that gate optimizations on NODE_ENV === 'production' (Express, Sequelize, pg, …) were running in dev mode inside what an operator would assume is a production deployment.

Add NODE_ENV: ${NODE_ENV:-production} to the api service. Operators who want dev compose can override via NODE_ENV=development in .env.

Test plan

  • npm run lint clean
  • npm test — 646 passed (compose-only change, no test surface)

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

The migrate service in docker-compose.yml sets `NODE_ENV: production`
(line 78), but the api service was missing the same default. Result:
in compose deployments the api process runs without NODE_ENV set,
so libraries that gate performance optimizations on
`process.env.NODE_ENV === 'production'` silently fall back to dev
mode — Express view cache off, Sequelize debug paths active, pg
pool sized differently, etc.

This isn't a functional bug — every code path works — but it's an
operational quality issue: compose deployments aren't actually
running in production mode by libraries' standards, despite the
operator's intent.

Add `NODE_ENV: ${NODE_ENV:-production}` so:
- Default compose deployments run in production mode automatically
- Operators who want dev compose (e.g. live-reload testing) can
  override via `NODE_ENV=development` in .env

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit bd258c1 into master May 19, 2026
3 checks passed
@CryptoJones CryptoJones deleted the chore/docker-compose-api-node-env-production branch May 19, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compose: api service missing NODE_ENV=production — libs gate prod optimizations on it

1 participant