Workspaces
Documents live in isolated workspaces — each with its own uploads, documents, and conversation history. One instance, many independent knowledge bases.
A self-hosted AI RAG workspace — upload documents, and chat with them over a real-time stream with cited answers.
Queue-based indexing. Hybrid search. Fully self-hosted.
Nexus turns a pile of documents into an answerable knowledge base — ingesting asynchronously in the background, retrieving with hybrid search, and answering with sources you can verify.
Documents live in isolated workspaces — each with its own uploads, documents, and conversation history. One instance, many independent knowledge bases.
Uploads never block the API. A BullMQ worker on Redis extracts pages from PDFs, recursively chunks documents (1000-token chunks, 200-token overlap), and embeds them in batches of 100 with exponential-backoff retries — one bad document never blocks the queue.
Retrieval fuses semantic similarity (pgvector cosine distance) with PostgreSQL full-text ranking using configurable weights (default 0.6 vector / 0.4 keyword, top-6), with an automatic fallback to pure vector search.
Answers stream token-by-token over a real-time WebSocket (tRPC subscription): sources first, then tokens, then a done event with final citations. A strict system prompt enforces grounded answers with inline [1], [2] references and explicit refusal to guess.
Set AUTH_PASSWORD and Nexus shows a login screen with httpOnly session cookies (30-day lifetime); leave it unset for a single-user dev mode. Ownership checks scope every document and query to its workspace.
Chunk size, top-K, model, temperature, and even the OpenAI key are managed from a Settings panel — secrets encrypted at rest with AES-256-GCM, with UI → env → default precedence. No .env edits or restarts needed.
A fault-tolerant pipeline — each stage is decoupled so indexing never blocks chatting, and one failing document never stalls the queue.
Drag PDF, TXT, Markdown, CSV, or JSON files (up to 25 MB each) into a workspace. Uploads are staged safely, validated, and enqueued.
A BullMQ embedding worker extracts text, splits it into overlapping chunks, and generates embeddings (1536-dim, batches of 100) with retries and per-document failure isolation.
At query time, hybrid retrieval scores chunks by weighted vector + full-text similarity and returns the most relevant context with per-workspace ownership enforcement.
The LLM streams a grounded answer with inline citations over WebSocket. Every conversation turn is persisted with its sources for later review.
Frontend (React + tRPC) ── HTTP /trpc + WS /ws ──▶ Express API ──▶ BullMQ (Redis)
│ │ │
│ tRPC router embedding.worker
│ + uploads │
│ │ chunk + embed
│ ▼ ▼
└────────────────────────────── PostgreSQL 16 + pgvector ◀────────┘
(documents, chunks, chat)End-to-end TypeScript, type-safe across every boundary.