C.api — API Monitoring Platform
Monitor any REST API endpoint manually — track uptime, latency, and health in real-time.
┌─────────────────────────────────────────────────────────────┐
│ BROWSER │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Next.js Frontend (port 3000) │ │
│ │ │ │
│ │ Dashboard ──→ APIs List ──→ API Detail │ │
│ │ │ │ │ │ │
│ │ SSE stream Add/Edit/ Check Now │ │
│ │ (live update) Delete APIs Edit/Delete │ │
│ └────────┬─────────────────────────┬───────────────────┘ │
└───────────│─────────────────────────│────────────────────── ┘
│ HTTP(REST) │ HTTP(REST)
▼ ▼
┌───────────────────────────────────────────────────────────┐
│ Express.js Backend (port 3001) │
│ │
│ POST /api/apis → Add API endpoint │
│ PUT /api/apis/:id → Edit API │
│ DEL /api/apis/:id → Delete API │
│ POST /api/apis/:id/check → On-demand check │
│ GET /api/stream → SSE live data stream │
│ GET /api/stats/* → Dashboard overview stats │
└───────────────┬───────────────────────────────────────────┘
│ PostgreSQL (pg)
▼
┌───────────────────────────────────────────────────────────┐
│ PostgreSQL Database (port 5432) │
│ │
│ apis → API configs (url, method, headers, ...) │
│ api_checks → Check history (status, latency, ...) │
└───────────────────────────────────────────────────────────┘
▲
│ writes results
┌───────────────┴───────────────────────────────────────────┐
│ BullMQ Worker │
│ │
│ Scheduler (every 60s) │
│ └─→ reads all APIs from DB │
│ └─→ enqueues check job per API ──→ Redis Queue │
│ │
│ Processor (concurrent, up to 5) │
│ └─→ HTTP request (with method, headers, body) │
│ └─→ compares response vs expected_status │
│ └─→ saves result to api_checks table │
└───────────────────────────────────────────────────────────┘
▲
│ Redis pub/sub
┌───────────────┴───────────────────────────────────────────┐
│ Redis (port 6379) │
│ BullMQ job queue │
└───────────────────────────────────────────────────────────┘
Monitoring Flow (step-by-step)
You add an API via the dashboard form (name, URL, method, headers, etc.)
Worker scheduler (runs every 60s) picks up all APIs from the DB
Worker processor fires an HTTP request to each API endpoint with the configured method/headers/body
Results (status code, latency, success/fail) are saved to api_checks table
Backend SSE stream broadcasts live stats to all connected browsers every 5s
Dashboard updates automatically — uptime %, avg latency, recent activity
apps/
backend/ → Express.js REST API + SSE stream (port 3001)
worker/ → BullMQ background monitoring worker
frontend/ → Next.js dashboard (port 3000)
shared/
database/ → SQL schema (schema.sql)
migrate.js → DB migration script (adds new columns to existing DB)
Layer
Tech
Frontend
Next.js 15, Recharts, SSE
Backend
Node.js, Express.js, pg, Axios
Worker
BullMQ, ioredis, Axios
Database
PostgreSQL 16
Queue
Redis 7
1. Start Services (PostgreSQL + Redis)
DATABASE_URL = postgresql://capi:capi_password@localhost:5432/capi_db
REDIS_URL = redis://localhost:6379
CHECK_INTERVAL = 60000 # ms between monitoring rounds
REQUEST_TIMEOUT = 10000 # ms before HTTP timeout
BACKEND_PORT = 3001
Fresh install:
docker exec capi-postgres psql -U capi -d capi_db -f /dev/stdin < shared/database/schema.sql
Existing DB (add new columns):
npm install # root
cd apps/backend && npm install
cd apps/frontend && npm install
cd apps/worker && npm install
# Terminal 1
cd apps/backend && npm run dev
# Terminal 2
cd apps/worker && npm run dev
# Terminal 3
cd apps/frontend && npm run dev
Open http://localhost:3000
Go to http://localhost:3000/apis
Click "+ Add API"
Fill in the form:
Field
Example
Name
GitHub API Status
Endpoint URL
https://api.github.com
Method
GET
Category
Developer Tools
Expected Status
200 (optional, default: any 2xx/3xx)
Custom Headers
{"Authorization": "Bearer token"} (optional)
Request Body
{"key": "value"} (optional, POST/PUT only)
Click "Add API" → the worker will monitor it automatically every 60 seconds
Click "Check Now" on the detail page to trigger an immediate check
Method
Endpoint
Description
GET
/api/apis
List all APIs (search, filter, paginate)
POST
/api/apis
Add a new API
GET
/api/apis/:id
Single API details
PUT
/api/apis/:id
Edit an API
DELETE
/api/apis/:id
Delete an API
POST
/api/apis/:id/check
On-demand check
GET
/api/apis/:id/stats
Uptime, latency, error rate
GET
/api/apis/:id/history
Check history (paginated)
GET
/api/apis/categories
All categories
GET
/api/stats/overview
Dashboard summary
GET
/api/stats/recent-activity
Last 20 checks
GET
/api/stream
SSE live data stream
Page
URL
Description
Dashboard
/
Overview stats, uptime ring, recent activity
APIs List
/apis
All monitored APIs — add, edit, delete, filter
API Detail
/apis/:id
Charts, stats, history, Check Now button