Skip to content

feat: production static serving + configurable port/state#9

Open
chrismdp wants to merge 2 commits intoJamsusMaximus:mainfrom
chrismdp:feat/production-serving
Open

feat: production static serving + configurable port/state#9
chrismdp wants to merge 2 commits intoJamsusMaximus:mainfrom
chrismdp:feat/production-serving

Conversation

@chrismdp
Copy link

@chrismdp chrismdp commented Mar 3, 2026

Summary

  • Serve client/dist/ via express.static() so one process handles everything in production
  • Add catch-all route for React Router paths (/, /hotel)
  • Make PORT configurable via env var (default 5174)
  • Make state file path configurable via CODEMAP_STATE_FILE env var

Rationale

For production deployment behind a reverse proxy, the Express server should serve the built client directly rather than requiring a separate Vite dev server. The state file path needs to be configurable to avoid writing into the watched project directory (which triggers unnecessary file-watcher events).

Test plan

  • npm run build compiles cleanly
  • PORT=3000 node server/dist/index.js starts on port 3000
  • CODEMAP_STATE_FILE=/tmp/state.json node server/dist/index.js writes state to specified path
  • Visiting http://localhost:5174/hotel serves the React app
  • API endpoints still work at /api/*

🤖 Generated with Claude Code

chrismdp and others added 2 commits March 3, 2026 14:32
- Serve client/dist/ via express.static() so one process handles
  everything in production (no separate Vite dev server needed)
- Add catch-all route for React Router paths (/, /hotel)
- Make PORT configurable via env var (default 5174)
- Make state file path configurable via CODEMAP_STATE_FILE env var
  to avoid writing into the watched project directory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The server uses "type": "module" so __dirname is unavailable.
Use fileURLToPath(import.meta.url) to resolve the client dist
directory path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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