Skip to content

Conversation

@anth-volk
Copy link
Collaborator

Summary

  • Adds automatic port discovery for dev servers, allowing multiple instances to run simultaneously
  • Creates a launcher script (scripts/dev-server.mjs) that finds available ports starting from 3000
  • Ports are automatically passed to Vite via environment variables
  • Each instance gets its own consecutive port pair (e.g., 3000/3001, 3002/3003)

How it works

When running make dev:

  1. The launcher script checks ports starting from 3000
  2. It detects occupied ports by attempting TCP connections on both IPv4 and IPv6
  3. Once two consecutive available ports are found, it passes them to the Vite dev servers
  4. The vite config reads WEBSITE_PORT and CALCULATOR_PORT and configures servers accordingly
  5. Cross-app URLs are derived from these ports automatically

Usage

# Terminal 1
make dev
# → "Dev servers: Website :3000, Calculator :3001"

# Terminal 2 (while first is running)
make dev
# → "Dev servers: Website :3002, Calculator :3003"

Test plan

  • Run make dev in one terminal - verify website on :3000, calculator on :3001
  • Run make dev in second terminal - verify it auto-discovers :3002/:3003
  • Verify cross-app navigation works correctly (website links to its paired calculator)
  • Manual testing of both instances simultaneously

Fixes #539

🤖 Generated with Claude Code

@vercel
Copy link

vercel bot commented Dec 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
policyengine-app-v2 Ready Ready Preview, Comment Dec 29, 2025 11:14am
policyengine-calculator Ready Ready Preview, Comment Dec 29, 2025 11:14am
policyengine-website Ready Ready Preview, Comment Dec 29, 2025 11:14am

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.

Create dev script to allow multiple simultaneous runs of site

3 participants