Local Development
Unified Dev Environment
The easiest way to run everything is through the unified dev proxy:
# Start all services (site on :3000, workers on :8787–8790)node scripts/dev.js
# With a fresh site build firstnode scripts/dev.js --build
# Stop all servicesnode scripts/dev-stop.jsAccess Points
| Service | URL |
|---|---|
| Static Site | http://localhost:3000 |
| API (via proxy) | http://localhost:3000/api/… |
| Chat Worker | http://localhost:8787 |
| Auth Worker | http://localhost:8788 |
| Billing Worker | http://localhost:8789 |
| Listings Worker | http://localhost:8790 |
Proxy Routing
The dev proxy routes /api/* based on path prefix:
| Prefix | Target Worker |
|---|---|
/api/auth/* | auth-worker (8788) |
/api/billing/* | billing-worker (8789) |
/api/listings* | listings-worker (8790) |
All other /api/* | chat-worker (8787) |
Individual Worker Development
You can also run workers independently:
# Auth workercd auth-worker && npm run dev
# Billing workercd billing-worker && npm run dev
# Listings workercd listings-worker && npm run dev
# Chat workercd chat-workernpx wrangler d1 migrations apply redecasas-chat --localnpm run devSite Generator Development
The site generator is a Go CLI with many commands:
cd site
# Full rebuildgo run . build-pages
# Build only static assets (JS/CSS/images)go run . build-static
# Build a single pagego run . build-page homego run . build-page scope:energia-solargo run . build-page topic:iptu
# Run rotating daily updatego run . daily-update --force
# Generate sitemapgo run . generate-sitemap
# Start a local file servergo run . serverDatabase (Local SQLite)
cd db
# Create database and run migrationssqlite3 redecasas.db < schema.sql
# Build and run seedercd seedergo build -o seeder ../seeder --db-url="../redecasas.db" --site-dir="../site" --csv-file="../Table.csv"
# Run post-seed resolutionsqlite3 redecasas.db < post_seed.sqlTroubleshooting
Port already in use
# Find what's using port 3000lsof -i :3000
# Kill it or change the port in scripts/dev.jsChat worker D1 errors
Make sure you apply migrations first:
cd chat-workernpx wrangler d1 migrations apply redecasas-chat --localMissing pages
If you see 404s for city or state pages, run a full build:
cd site && go run . build-pages