Development
Running Tollbooth without Docker for local development.
Running Services Locally
Backend
The backend runs on:
- REST API:
http://localhost:3000 - Proxy WebSocket:
ws://localhost:3001 - Frontend WebSocket:
ws://localhost:3002
Frontend
The frontend runs on http://localhost:5173.
Proxy
The proxy listens on http://localhost:8080.
Environment Variables
When running locally, you may need to set these environment variables:
Backend
Frontend
Proxy
Development Workflow
- Start all three services in separate terminals
- Make changes to source files
- Backend and frontend support hot reload
- Proxy requires restart after changes to
addon.py
Testing with Local Agent
When running locally (not in Docker), configure your agent to use:
export HTTP_PROXY=http://localhost:8080
export HTTPS_PROXY=http://localhost:8080
export SSL_CERT_FILE=/path/to/tollbooth/certs/mitmproxy-ca-cert.pem
export NODE_EXTRA_CA_CERTS=/path/to/tollbooth/certs/mitmproxy-ca-cert.pem
Building Docker Images
# Build all services
docker compose build
# Build specific service
docker compose build backend
# Build without cache
docker compose build --no-cache
Project Structure
tollbooth/
├── backend/ # Node.js backend
│ ├── src/ # TypeScript source
│ │ ├── parsers.ts # API provider parsers
│ │ ├── conversations.ts # Conversation correlation & tree building
│ │ ├── intercept.ts # Request/response interception
│ │ ├── rules.ts # Rules engine
│ │ ├── storage.ts # Traffic & data storage
│ │ ├── persistence.ts # Disk persistence
│ │ ├── message-filter.ts # Message content filters
│ │ └── refusal/ # Refusal detection system
│ └── Dockerfile
├── frontend/ # React frontend
│ ├── src/ # TypeScript/React source
│ │ ├── components/
│ │ │ ├── conversation/ # Conversation views (list, detail, tree, compare)
│ │ │ ├── intercept/ # Intercept queue
│ │ │ ├── rules/ # Rules editor
│ │ │ ├── traffic/ # Traffic list and detail
│ │ │ ├── settings/ # Settings view
│ │ │ └── shared/ # Shared components (annotations, etc.)
│ │ ├── hooks/ # React hooks (WebSocket, etc.)
│ │ └── stores/ # Zustand state stores
│ └── Dockerfile
├── proxy/ # mitmproxy addon
│ ├── addon.py # Python addon script
│ └── Dockerfile
├── agent/ # Agent container
│ └── Dockerfile
├── docs/ # Documentation (MkDocs)
├── certs/ # Generated certificates
├── tollbooth-data/ # Persistent data (gitignored)
└── docker-compose.yml