This guide demonstrates how to use the Rapid Dev Proxy for local development.
-
Install the proxy:
uv pip install -e . -
Create a sample configuration:
uv run python -m rapid_dev_proxy.cli init
The init command creates a config.json file with sample routes:
{
"proxy": {
"host": "127.0.0.1",
"port": 8080
},
"routes": {
"api.local": {
"target": "http://127.0.0.1:3000",
"metadata": {
"description": "API Server"
}
},
"app.local": {
"target": "http://127.0.0.1:8080",
"metadata": {
"description": "Frontend App"
}
}
},
"default": {
"target": "http://127.0.0.1:3000"
}
}Start your backend services on the configured ports:
# Start API server on port 3000
python -m http.server 3000
# Start frontend app on port 8080
python -m http.server 8080uv run python -m rapid_dev_proxy.cli start# Test API route
curl -H "Host: api.local" http://127.0.0.1:8080/
# Test app route
curl -H "Host: app.local" http://127.0.0.1:8080/
# Test health endpoint
curl http://127.0.0.1:8080/health
# List routes
curl http://127.0.0.1:8080/routes# Create a development configuration
uv run python -m rapid_dev_proxy.cli init dev-config.json
# Edit the configuration for your services
# Add routes for your frontend, API, admin panel, etc.# Terminal 1: Start your React app
cd frontend && npm start
# Terminal 2: Start your API server
cd api && python app.py
# Terminal 3: Start your admin panel
cd admin && python server.pyuv run python -m rapid_dev_proxy.cli start -c dev-config.json --reload- Frontend: http://app.local:8080
- API: http://api.local:8080
- Admin: http://admin.local:8080
{
"proxy": {
"host": "0.0.0.0",
"port": 9000,
"timeout": 60.0,
"max_connections": 200
},
"routes": {
"api.dev.local": {
"target": "http://127.0.0.1:3000",
"metadata": {
"description": "Development API"
}
},
"*.dev.local": {
"target": "http://127.0.0.1:8080",
"metadata": {
"description": "Wildcard route"
}
}
},
"default": {
"target": "http://127.0.0.1:3000"
},
"security": {
"cors_enabled": true,
"auth_headers": {
"X-API-Key": "dev-key-123"
}
}
}uv run python -m rapid_dev_proxy.cli start -c custom-config.json --port 9000 --debuguv run python -m rapid_dev_proxy.cli validate -c config.jsonuv run python -m rapid_dev_proxy.cli routes -c config.jsoncurl http://127.0.0.1:8080/healthResponse:
{
"status": "healthy",
"request_count": 42,
"error_count": 0,
"uptime": 1234.567
}For easier access, add entries to your hosts file:
127.0.0.1 api.local
127.0.0.1 app.local
127.0.0.1 admin.local
127.0.0.1 api.local
127.0.0.1 app.local
127.0.0.1 admin.local
Then access your services directly:
- Port already in use: Change the proxy port in configuration
- Backend service not responding: Check if your backend service is running
- Configuration errors: Use
validatecommand to check configuration - CORS issues: Ensure CORS is enabled in configuration
Run with debug mode for detailed logging:
uv run python -m rapid_dev_proxy.cli start --debugThe proxy logs all requests and errors. Look for:
- Request/response details
- Routing decisions
- Error messages
- Performance metrics