Skip to content

Make generated Express apps production-ready#40

Merged
theinfosecguy merged 6 commits into
mainfrom
feat/production-ready-express
Jun 14, 2026
Merged

Make generated Express apps production-ready#40
theinfosecguy merged 6 commits into
mainfrom
feat/production-ready-express

Conversation

@theinfosecguy

Copy link
Copy Markdown
Owner

Problem & Solution Overview

Generated Express apps are now production-ready:

  • Load .env via dotenv, and the mongoose config uses MONGODB_URI (falling back to a local DB).
  • A /health endpoint returning { status: 'ok' }.
  • Centralized error-handling middleware.
  • Graceful shutdown on SIGINT/SIGTERM (closes the server, and the Mongo connection for --db).
  • Binds to 0.0.0.0 so it works in Docker.
  • start, dev, and test scripts.
  • The app is exported (and only listens when run directly), so it ships with a basic integration test (node --test + supertest) hitting /health and /.

These apply to the Express templates only; Node apps are unchanged.

Testing Done

  • npm test: 231 passing (8 new integration tests covering the health endpoint, dotenv/export, 0.0.0.0 + signal handlers, error middleware, the start/dev/test scripts + supertest, the generated test file, MONGODB_URI, and that node apps don't get the express scaffolding).
  • npm run test:package (release smoke): from the installed tarball, generates an Express app, installs it, runs the generated app's own npm test, boots it, asserts 200 on / and /health, and confirms a clean exit-0 shutdown on SIGTERM.
  • Verified the full lifecycle locally end to end (install, generated npm test 2/2, /health 200, graceful SIGTERM).

@theinfosecguy theinfosecguy merged commit a23f1ff into main Jun 14, 2026
5 checks passed
@theinfosecguy theinfosecguy deleted the feat/production-ready-express branch June 14, 2026 19:15
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.

1 participant