Skip to content

HTTP API

The serve feature — browser UI, REST endpoints under /api/v1, CORS, and access logging.

Start the server

Built with the serve feature, codeweb serve loads the project store and starts an HTTP server with an embedded browser UI:

cargo build --release --features serve
codeweb serve --addr 127.0.0.1:3000 --open
FlagDefaultMeaning
-p, --project.Project directory
-a, --addr127.0.0.1:3000Bind address (host:port)
--openoffOpen the browser after startup
--log-levelinfoAccess log level: info or debug

The UI offers a node list with search, a Cytoscape.js graph canvas with dagre layout, and a detail panel with callers/callees. Requests are CORS-permissive and logged to .codeweb/ in the project directory.

REST endpoints

All endpoints live under /api/v1 and return JSON unless noted.

MethodPathParametersDescription
GET/api/v1/stats—Node counts by type, edge count, project name
GET/api/v1/files—Analyzed files with node counts
GET/api/v1/nodessearch, node_type, orphan, low_degree, limit (default 100), offset (default 0)Filter and paginate node summaries; search sorts by match rank
GET/api/v1/nodes/:id—Node properties, direct callers, callees
GET/api/v1/nodes/:id/callerslimit, offset, depthUpstream neighbors
GET/api/v1/nodes/:id/calleeslimit, offset, depthDownstream neighbors
GET/api/v1/nodes/search-sqlq (required)Search mapper/sql nodes by SQL content, scored
GET/api/v1/tracefrom (required), depth (default 2, capped at 10), max_nodes (default 500)Bidirectional call chain trees; response reports truncated
GET/api/v1/columnsexactly one of procedure, package; optional tableAggregated column analysis (issue #165 JSON)
GET/api/v1/lineagetarget (required), direction (upstream/downstream/both), depth (default 5)Table/column lineage
POST/api/v1/querybody: QuerySpec JSONDeclarative traversal
GET/api/v1/exportformat: dot, json, ndjson, mermaidDownload the graph
GET/api/v1/graph—Full graph payload used by the browser UI canvas

Status codes follow the convention: 404 when a name matches nothing, 400 for ambiguous names or invalid parameters (for example passing both procedure and package to /api/v1/columns).

Examples

codeweb serve -p my-project --addr 127.0.0.1:3000 &

curl -s http://127.0.0.1:3000/api/v1/stats
curl -s "http://127.0.0.1:3000/api/v1/nodes?search=order&node_type=proc&limit=10"
curl -s "http://127.0.0.1:3000/api/v1/trace?from=process_order&depth=3"
curl -s "http://127.0.0.1:3000/api/v1/lineage?target=orders&direction=upstream"
curl -s "http://127.0.0.1:3000/api/v1/nodes/search-sql?q=UPDATE%20inventory"
curl -s -X POST http://127.0.0.1:3000/api/v1/query \
  -H 'Content-Type: application/json' \
  -d '{"start":{"type":"proc","name":"order"},"collect":"paths"}'
curl -s "http://127.0.0.1:3000/api/v1/export?format=ndjson" -o graph.ndjson

Security boundaries

The server reads the project store and binds the address you give it. It does not authenticate requests, and CORS is fully permissive, so treat it as a local development tool: do not expose it to untrusted networks. Read paths may point anywhere under analysis.paths; the serve mode has no write endpoints.