A pip-installable CLI tool for API monitoring, analytics, and route improvement suggestions.
- Proxy-based Monitoring: Sits between clients and your API server to capture all traffic
- Hit Count Tracking: See which routes are most frequently accessed
- Request/Response Capture: Full details of every request and response
- Analytics Dashboard: Rich terminal UI showing performance metrics
- Advanced Pattern Detection: Automatically suggests improvements for 'chatty' APIs, slow writes, and security anomalies
- ASCII Graphs: Visualize request activity over time via CLI
- Dual UI: React+Ink UI for live monitoring, Textual fallback for pure Python
- Automated Testing: Comprehensive test suite for storage and analytics
pip install apimon- Start the proxy server (forwarding to your API on port 3000):
apimon proxy --target-port 3000- In another terminal, make some API requests to
http://localhost:8080(the proxy):
curl http://localhost:8080/api/users- View the dashboard:
apimon dashboard| Command | Description |
|---|---|
apimon proxy |
Start the proxy server for monitoring |
apimon dashboard |
Show analytics dashboard |
apimon stats |
Show route statistics |
apimon requests |
Show recent requests |
apimon request <id> |
Show detailed view of a request |
apimon suggestions |
Show improvement suggestions |
apimon graph |
Show ASCII graphs of activity |
apimon ui |
Launch interactive TUI |
apimon export |
Export data to JSON |
apimon clear |
Clear all stored data |
apimon proxy --target-host localhost --target-port 3000 --port 8080--target-host: Your API server host (default: localhost)--target-port: Your API server port (default: 3000)--port: Proxy listen port (default: 8080)--db-path: Path to SQLite database (default: apimon.db)
apimon dashboard
apimon stats --hours 24
apimon requests --limit 50
apimon suggestions- Python Backend: Proxy server using aiohttp, data storage with SQLite/SQLAlchemy
- Node.js Frontend: React+Ink CLI UI for interactive dashboards
- Textual Fallback: Pure Python TUI when Node.js is unavailable
All data is stored in a local SQLite database (apimon.db by default). The schema includes:
requests: Individual request/response recordsroute_stats: Aggregated statistics per route
The proxy automatically normalizes routes like:
/users/123→/users/{id}/posts/abc123→/posts/{id}
This allows aggregating statistics for parameterized routes.
APIMON_PORT: Port for the proxy server (default: 8080)APIMON_DB_PATH: Path to database fileAPIMON_LISTEN_HOST: Proxy listen host (default:127.0.0.1, set to0.0.0.0for Docker)
You'll need 4 terminals:
Terminal 1 — start your API server (or use the built-in dummy API for testing):
uv run python scripts/dummy_api.pyTerminal 2 — build and start the apimon proxy:
docker compose up --buildThe proxy starts on http://localhost:8080 and forwards to your API on port 3000. On Mac/Windows host.docker.internal resolves to your host machine automatically. On Linux, extra_hosts: host-gateway in docker-compose.yml handles it.
Terminal 3 — send requests through the proxy (or use the simulator):
uv run --with requests python scripts/simulate_requests.pyTerminal 4 — view analytics after traffic accumulates:
docker compose run --rm apimon apimon --db-path /data/apimon.db dashboard
docker compose run --rm apimon apimon --db-path /data/apimon.db stats
docker compose run --rm apimon apimon --db-path /data/apimon.db suggestionsEdit the command in docker-compose.yml:
command: apimon --db-path /data/apimon.db proxy --target-host my-api.internal --target-port 8000docker build -f cicd/Dockerfile -t apimon .
docker run -d \
-p 8080:8080 \
-v apimon-data:/data \
-e APIMON_LISTEN_HOST=0.0.0.0 \
--add-host host.docker.internal:host-gateway \
apimon apimon --db-path /data/apimon.db proxy --target-host host.docker.internal --target-port 3000The SQLite database is stored in a Docker volume (apimon-data) mounted at /data inside the container. All analytics data survives container restarts. To wipe it:
docker compose down -v# Install in development mode
pip install -e .
# Install frontend dependencies
cd frontend && npm install
# Run the proxy
apimon proxy --target-port 3000
# Run the UI
apimon ui
# Or use the Textual UI directly
apimon dashboardMIT