Why Use Backend Mode?
No Re-Indexing
Browse any CLI-indexed repo instantly — no need to re-upload or re-index
No Size Limits
Bypass browser memory constraints. Explore repos with 100k+ files
Persistent Storage
CLI indexes are persistent — refresh the page without losing your graph
AI Chat Access
Use the Web UI’s chat interface with full CLI graph data
How It Works
Backend mode creates a bridge between the Web UI and CLI:- CLI indexes your repositories locally (persistent storage)
gitnexus servestarts an HTTP server onlocalhost:4747- Web UI auto-detects the local server and offers to connect
- All queries route through the HTTP API to the native KuzuDB database
The Web UI becomes a frontend client for the CLI’s graph database. No WASM indexing happens — you’re viewing the native CLI index.
Quick Start
Index Your Repo (CLI)
First, index your repository with the CLI:This creates
.gitnexus/ in your repo and registers it globally.Start the Server
Launch the HTTP server:The server starts at
http://127.0.0.1:4747 by default.Custom port or host
Custom port or host
Open the Web UI
Navigate to:
- gitnexus.vercel.app (production)
http://localhost:5173(if running from source)
HTTP API Routes
When connected to the backend, the Web UI uses these API endpoints:| Endpoint | Method | Purpose |
|---|---|---|
/api/repos | GET | List all indexed repositories |
/api/repo | GET | Get repository metadata |
/api/graph | GET | Download full graph (nodes + edges) |
/api/query | POST | Execute raw Cypher queries |
/api/search | POST | Hybrid search (BM25 + semantic) |
/api/file | GET | Read file content from disk |
/api/processes | GET | List all execution flows |
/api/process | GET | Get process detail with steps |
/api/clusters | GET | List all communities |
/api/cluster | GET | Get community members |
?repo=name query parameter for multi-repo selection.
Multi-Repo Support
The server can serve multiple indexed repositories:- The repo selector (header dropdown) shows all indexed repos
- Switch between repos without reloading
- Each repo’s graph loads on-demand
Security & CORS
CORS policy:- Allows
http://localhost:*(local dev) - Allows
http://127.0.0.1:*(local dev) - Allows
https://gitnexus.vercel.app(production Web UI) - Blocks all other origins
- The
/api/fileendpoint validates all paths - Requests outside the repo root are rejected
0.0.0.0 or a public IP:
- Anyone on the network can access your code
- Use this only in trusted networks or behind a firewall
- Consider setting up authentication (not built-in)
Benefits vs WASM Mode
| Feature | WASM Mode | Backend Mode |
|---|---|---|
| Max repo size | ~5k files | Unlimited |
| Indexing speed | Slow (WASM) | Fast (native) |
| Persistence | Session-only | Persistent |
| Re-index cost | High (every session) | Low (once via CLI) |
| Network required | No | Localhost only |
| Graph loading | Immediate | ~1-5s download |
Auto-Connect URL
Bookmark a direct connection with the?server query parameter:
- Parse the
?serverparam - Connect to the backend automatically
- Load the default repo (first in registry)
- Remove the query param from the URL (so refresh doesn’t re-trigger)
Embeddings in Backend Mode
Semantic search works in backend mode:- The CLI generates embeddings during
gitnexus analyze - The Web UI uses the server’s
/api/searchendpoint - The backend runs hybrid search (BM25 + semantic) server-side
Skipping embeddings in CLI
Skipping embeddings in CLI
If you indexed with This is faster but less accurate for semantic queries.
--skip-embeddings, the backend falls back to BM25-only search:AI Chat in Backend Mode
The Web UI’s AI chat routes all tool calls through the backend:query_code→/api/searchrun_cypher→/api/queryread_file→/api/fileget_symbol_references→ Cypher via/api/querylist_processes→/api/processes
Troubleshooting
Web UI doesn't auto-detect the server
Web UI doesn't auto-detect the server
- Ensure
gitnexus serveis running (check terminal output) - Verify the server is on
http://localhost:4747(default) - Check browser console for CORS errors
- Manually enter the server URL in the connection dialog
Connection refused or timeout
Connection refused or timeout
- Confirm the server is running:
curl http://localhost:4747/api/repos - Check firewall settings (may block local connections)
- Try
http://127.0.0.1:4747instead oflocalhost
Empty repo list
Empty repo list
You haven’t indexed any repositories yet:Then restart
gitnexus serve.Graph loading is slow
Graph loading is slow
Large repos take time to serialize and download:
- 50k nodes: ~5-10 seconds
- 100k nodes: ~20-30 seconds
CORS error from custom domain
CORS error from custom domain
The server only allows
localhost and gitnexus.vercel.app. If you’re hosting the Web UI elsewhere:- Fork the CLI repo
- Edit
gitnexus/src/server/api.ts(line 112) - Add your domain to the CORS allowlist
- Run from your fork:
npx my-fork serve
Architecture Details
Connection Flow
KuzuDB Connection Pooling
The server uses a lazy connection pool (fromLocalBackend):
- Connections open on first query per repo
- Max 5 concurrent connections
- 5-minute TTL — idle connections close automatically
- Graceful shutdown on
SIGINT/SIGTERM
Next Steps
CLI Overview
Learn more about CLI indexing and MCP
MCP Integration
Connect AI agents to your indexed repos