RepoQuery is an open-source, self-hosted repository intelligence app: connect public GitHub repos, index code, docs, issues, pull requests, discussions, and commits into PostgreSQL with pgvector, then chat with an AI that answers from retrieved evidence (RAG-style workflow). Run it locally with Docker for the database, Node.js for the React + Vite frontend and NestJS + Prisma backend, and configure OpenAI, OpenAI-compatible APIs (e.g. OpenRouter), or Ollama plus an optional GitHub personal access token in Settings (stored in the database) for higher GitHub API rate limits.
If you are looking for a self-hosted GitHub Q&A, repo search with embeddings, pgvector NestJS example, or Docker Compose Postgres setup for a TypeScript monorepo, this README walks through clone → install → .env → Docker & database (first time) → npm run dev → Settings in order.
Do not run npm run dev until Docker is running and the database has been initialized (first-time: npm run setup:dev). Typical order:
- Docker Desktop (or Docker Engine) is installed and running.
- From the repo root:
npm install→ copy.envfrom.env.example. - First time on this machine:
npm run setup:dev— runsdb:up(PostgreSQL + pgvector in Docker), initializes the DB (vectorextension + Prisma), and buildsshared. Docker must be running before this command. - Later sessions: if the DB container was stopped, run
npm run db:upagain (no need to repeatsetup:devunless you reset the DB). npm run dev(repo root) — starts both the NestJS backend (watch) and the Vite frontend (dev server) in one command.
After the UI loads, open Settings and add your AI provider and optional GitHub token.
- Projects: Each project maps to one public GitHub repository (owner/name).
- Ingestion & indexing: Fetches repository tree, file contents, README/docs-style paths, issues, PRs, discussions, and commit history, then chunks and stores vectors for semantic search.
- Chats: Multiple conversations per project; messages and assistant replies are persisted.
- Answers: The assistant uses tools (code search, history, file view) so responses stay tied to repository evidence rather than guessing.
- Sync: Manual refresh per project and scheduled checks to keep the index fresh.
| Layer | Technology | Role |
|---|---|---|
| Frontend | React 19, Vite, TypeScript, React Router, TanStack Query, Zustand | SPA UI; calls the API via VITE_API_BASE_URL. |
| Backend | NestJS, Prisma | REST API, orchestration, scheduling, GitHub + LLM calls. |
| Database | PostgreSQL 16 + pgvector (Docker image pgvector/pgvector:pg16) |
App data + vector embeddings (docker/postgres/init.sql enables vector). |
| Shared package | @repo-intel/shared |
Shared enums/DTOs/types across frontend and backend. |
| GitHub API | Octokit | Repo metadata, trees, files, issues, PRs, discussions; optional token from Settings only (unauthenticated if unset). |
| AI | OpenAI SDK–style HTTP to configured base URL | Chat + embeddings per Settings: OpenAI, OpenAI-compatible URL, or Ollama’s OpenAI-compatible endpoint. |
Data flow (simplified):
Browser (React) ──HTTP──► NestJS API ──► Prisma ──► PostgreSQL + pgvector
│
├──► GitHub REST (Octokit)
└──► LLM / embeddings (provider from Settings)
- Docker Desktop (or Docker Engine + Compose) — required before
npm run devso PostgreSQL can run locally. - Node.js 20+ (LTS recommended) and npm.
- A GitHub account (optional token in Settings for higher API limits).
- An AI provider: OpenAI API key, an OpenAI-compatible host (e.g. OpenRouter), or Ollama running locally with chat + embedding models pulled.
git clone https://github.com/SSujitX/RepoQuery.git
cd RepoQueryFrom the repository root (the folder that contains package.json, frontend/, backend/, and shared/):
npm installThis installs root tooling and all npm workspaces (frontend, backend, shared).
Copy the example env file at the repo root:
cp .env.example .envEdit .env if needed:
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | Must match Docker Compose (default): postgresql://postgres:postgres@localhost:5432/repo_intel |
PORT |
No | Backend port (default 4000) |
APP_ORIGIN |
No | Frontend origin for CORS (default http://localhost:5173) |
VITE_API_BASE_URL |
No | API base URL the Vite app calls (default http://localhost:4000) |
Secrets: GitHub and AI credentials are not set in .env. Configure them in the Settings page in the app (stored in the database).
The stack uses Docker Compose only for Postgres + pgvector (the app itself runs on Node, not in Docker for local dev).
First-time setup already starts the DB via npm run setup:dev (Step 5), which includes db:up. Use this step when you only need to start or verify the container.
- Start Docker Desktop (or your Docker daemon).
- From the repo root:
npm run db:upThis runs docker compose up -d postgres using docker-compose.yml:
- Image:
pgvector/pgvector:pg16 - Container name:
repo-intel-postgres - Port:
5432on the host - Database:
repo_intel(user/passwordpostgres/postgresin the default compose file)
Verify the container is running:
docker ps --filter name=repo-intel-postgresOptional: view database logs.
npm run db:logsTo stop the database:
npm run db:downRun once per machine (or after wiping the DB volume). Docker must be running.
npm run setup:devThis runs: db:up → db:init (SQL CREATE EXTENSION IF NOT EXISTS vector, Prisma generate + db push) → npm run build --workspace shared.
If you already ran npm run db:up in Step 4, setup:dev simply runs db:up again (harmless) then continues with init.
Manual equivalent (if you prefer):
npm run db:up
docker exec repo-intel-postgres psql -U postgres -d repo_intel -c "CREATE EXTENSION IF NOT EXISTS vector;"
npm run prisma:generate --workspace backend
npm run prisma:push --workspace backend
npm run build --workspace sharedFor migration-based workflows in other environments:
npm run prisma:migrate --workspace backendOnly after Docker is up and Step 5 has succeeded, from the repo root:
npm run devThis builds the shared workspace once, then runs two processes together:
- Backend: NestJS in watch mode (API + Prisma).
- Frontend: Vite dev server (React SPA).
| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| Backend | http://localhost:4000 |
| Health | http://localhost:4000/health |
Run workspaces separately if needed:
npm run dev:backend
npm run dev:frontendOpen http://localhost:5173 → Settings.
Without a token, GitHub unauthenticated rate limits apply. Add a personal access token in Settings (classic or fine-grained with appropriate read access to public repo data you need).
Create a token: GitHub → Settings → Developer settings → Personal access tokens.
Supported provider types:
| Provider type | API key | Base URL | Typical use |
|---|---|---|---|
| OpenAI | Required | Leave default / empty for official API | Production-quality models and embeddings |
| OpenAI-compatible | Usually required | e.g. https://openrouter.ai/api/v1 |
OpenRouter, LM Studio, vLLM, etc. |
| Ollama | Not used | e.g. http://localhost:11434/v1 |
Local models; ensure Ollama is running and models are pulled |
Set chat model and embedding model names to match your provider.
Check configuration status:
- GET
/settings/status→aiConfiguredand a human-readablereasonif something is missing.
- Open Settings and confirm AI (and optionally GitHub) are configured.
- Create a project with a public repo
owner/name. - Wait for indexing / sync to progress (use the project’s Sync control as needed).
- Open or create a chat and ask questions; use evidence / sources in the UI to verify what the model relied on.
The system is designed to avoid misleading claims: when evidence is missing, replies should indicate uncertainty or lack of repository support.
npm run buildBackend start in production typically uses DATABASE_URL and npm run start:prod --workspace backend after a deploy step; adjust hosting, reverse proxy, and secrets for your environment.
| Script | Purpose |
|---|---|
npm run dev |
Build shared, then run backend + frontend together in watch/dev mode |
npm run setup:dev |
db:up + DB init (vector + Prisma) + build shared — use first time (or after reset) |
npm run db:up / db:down / db:logs |
Docker Compose lifecycle for Postgres |
npm run build |
Build shared, backend, and frontend |
npm run lint |
Lint backend and frontend |
RepoQuery/
frontend/ # React + Vite SPA
backend/ # NestJS API + Prisma schema
shared/ # Shared TypeScript package
docker/
postgres/
init.sql # CREATE EXTENSION vector;
docker-compose.yml # PostgreSQL + pgvector service
.env.example # Template for root .env (no secrets)
README.md
Use the GitHub issue tracker for bug reports and feature discussions; pull requests are welcome when they match project scope.

