Overview
NYC Permit Pulse uses Vite as its development server, providing instant hot module replacement (HMR) and a built-in proxy to handle CORS restrictions when fetching data from external APIs and tile servers.Starting the Dev Server
Start the development server
Run the dev script from package.json:The server will start on port 5177 by default:
Open the application
Navigate to http://localhost:5177 in your browser. You should see the isometric NYC map with permit overlays.
Vite Proxy Configuration
The dev server proxies all external API and tile requests to avoid CORS issues. This is configured invite.config.ts:10-35.
Proxy Rules
Here’s the complete proxy configuration fromvite.config.ts:
vite.config.ts
How Proxy Paths Map
Each proxy rule transforms a local request into an external API call:| Local Request | External Target | Purpose |
|---|---|---|
GET /api/permits?$where=... | https://data.cityofnewyork.us/resource/rbx6-tga4.json?$where=... | DOB NOW approved work permits |
GET /api/jobs?$where=... | https://data.cityofnewyork.us/resource/w9ak-ipjd.json?$where=... | DOB NOW job filings (NB/DM) |
GET /dzi/nyc.dzi | https://isometric-nyc-tiles.cannoneyed.com/dzi/nyc.dzi | OpenSeadragon DZI descriptor |
GET /dzi/nyc_files/12/0_0.jpg | https://isometric-nyc-tiles.cannoneyed.com/dzi/nyc_files/12/0_0.jpg | Isometric NYC tile images |
GET /api/adsb/lat/40.7/lon/-74.0/dist/50 | https://api.adsb.lol/v2/lat/40.7/lon/-74.0/dist/50 | Live helicopter tracking |
The
changeOrigin: true option ensures the proxy sends the correct Host header to the target server, which is required for these APIs to respond correctly.Hot Module Replacement
Vite provides instant HMR for React components. When you edit a.tsx or .ts file:
- Vite detects the change and recompiles only the affected module
- React Fast Refresh updates the component in-place without losing state
- CSS changes are applied instantly without a full page reload
Files with HMR
- React components (
src/App.tsx,src/NeighborhoodLabels.ts) — full state preservation - CSS (
src/App.css) — instant style updates - TypeScript utilities (
src/permits.ts,src/coordinates.ts) — component re-renders on import
When HMR Fails
If you see[vite] hmr update was blocked or the page doesn’t update:
- Manual reload: Press
Ctrl+RorCmd+R - Full restart: Stop the dev server (
Ctrl+C) and runnpm run devagain
Debugging Tips
Check the browser console
Open Chrome/Firefox DevTools (
F12) and check for:- API errors: Failed permit/tile fetches
- TypeScript errors: Type mismatches caught at runtime
- React warnings: State update issues, key prop errors
Inspect network requests
Open the Network tab in DevTools to verify:
- Permit API calls return 200 OK with JSON
- Tile images load correctly (
.jpgfiles from/dzi/nyc_files/*) - No CORS errors (all requests should go through the proxy)
Use React DevTools
Install the React DevTools extension to:
- Inspect component state (
permits,selectedPermit,filters) - Track re-renders and performance
- Debug props passed to child components
Common Issues
No permits appear on the map- Check the browser console for API errors
- Verify the NYC Open Data API is responding: [https://data.cityofnewyork.us/resource/rbx6-tga4.json?limit=1)
- Ensure the proxy is running (restart the dev server if needed)
- Verify the isometric.nyc tile server is up: https://isometric-nyc-tiles.cannoneyed.com/dzi/nyc.dzi
- Check DevTools Network tab for 404s on tile images
- Restart the dev server to reset the proxy
- Run
npm run lintto see all type errors - Check
tsconfig.app.json:2-27for strict type-checking rules - Ensure all dependencies are installed (
npm install)
Port Configuration
The dev server uses port 5177 by default (configured invite.config.ts:11). To change it:
vite.config.ts
Next Steps
- Build for production — Create optimized static assets
- Deploy to Vercel — Configure production rewrites and custom domain