Skip to content

feat: add graceful shutdown handling to Node.js template#77

Merged
PAMulligan merged 1 commit intomainfrom
14-add-graceful-shutdown-handling-to-nodejs-template
Apr 13, 2026
Merged

feat: add graceful shutdown handling to Node.js template#77
PAMulligan merged 1 commit intomainfrom
14-add-graceful-shutdown-handling-to-nodejs-template

Conversation

@PAMulligan
Copy link
Copy Markdown
Contributor

Summary

  • Adds SIGTERM/SIGINT signal handlers to the Node.js server template in setup-project.sh
  • On signal, the server stops accepting new connections, drains in-flight requests, and exits cleanly
  • Includes a 10-second force-exit timeout to prevent stalled shutdowns in production
  • Duplicate signal guard prevents double-shutdown race conditions
  • Placeholder included for database connection pool cleanup

Test plan

  • Run ./scripts/setup-project.sh test-app --node and verify the generated src/index.ts contains the shutdown handlers
  • Start the generated server with pnpm dev, send SIGTERM (e.g. kill <pid>), and confirm clean shutdown logs
  • Send SIGINT (Ctrl+C) and confirm clean shutdown logs
  • Verify Cloudflare Workers template (--cloudflare) is unchanged
  • CI passes (shell syntax check + ShellCheck)

Closes #14

🤖 Generated with Claude Code

Add SIGTERM/SIGINT signal handlers to the Node.js server template in
setup-project.sh so generated APIs handle rolling updates and container
stops without dropping in-flight requests or leaking connections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan linked an issue Apr 13, 2026 that may be closed by this pull request
7 tasks
@github-actions github-actions bot added the area: scripts Automation scripts label Apr 13, 2026
@PAMulligan PAMulligan self-assigned this Apr 13, 2026
@PAMulligan PAMulligan merged commit 0554815 into main Apr 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: scripts Automation scripts

Projects

Development

Successfully merging this pull request may close these issues.

Add graceful shutdown handling to Node.js template

1 participant