GitHub TeamBrain is an AI-powered repository intelligence dashboard. It imports GitHub repositories, pull requests, reviews, and inline review comments, stores structured data in PostgreSQL, indexes useful review evidence in ChromaDB, and uses Gemini for grounded Q&A and repository summaries.
flowchart LR
UI[React + TypeScript + Vite] --> API[FastAPI Routers]
API --> Services[Service Layer]
Services --> DB[(PostgreSQL)]
Services --> Chroma[(ChromaDB)]
Services --> GitHub[GitHub REST API]
Services --> Gemini[Google Gemini]
Gemini --> Services
Chroma --> Services
DB --> Services
Services --> API
API --> UI
- Imports repository metadata from a GitHub URL.
- Syncs pull requests, PR reviews, and inline review comments.
- Filters low-signal comments before embedding.
- Indexes review bodies and inline review comments in ChromaDB.
- Answers questions with source citations from retrieved evidence.
- Generates Markdown engineering summaries by repository.
- Provides a SaaS-style React dashboard with overview stats, import progress, chat, evidence cards, and summary regeneration.
- Frontend: React, TypeScript, Vite, Tailwind CSS, Lucide icons
- Backend: FastAPI, Pydantic, SQLAlchemy, Alembic
- Data: PostgreSQL, ChromaDB
- AI: Google Gemini text generation and embeddings
- Tooling: Docker Compose, pytest, npm build
Create environment files:
cp .env.example .env
cp .env.example api/.env
cp .env.example frontend/.envSet these values before running imports or AI endpoints:
JWT_SECRET=your_long_random_jwt_secret
BOOTSTRAP_ADMIN_EMAIL=admin@teambrain.local
BOOTSTRAP_ADMIN_PASSWORD=your_strong_admin_password
GITHUB_TOKEN=your_github_personal_access_token
GEMINI_API_KEY=your_gemini_api_key
DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5433/github_team_brain
CHROMA_HOST=localhost
CHROMA_PORT=8001
VITE_API_BASE_URL=http://127.0.0.1:8000/api/v1Run the full stack:
docker compose up --buildServices:
- Frontend: http://127.0.0.1:5173
- API: http://127.0.0.1:8000
- PostgreSQL: 127.0.0.1:5433
- ChromaDB: http://127.0.0.1:8001
Run locally without Docker:
docker compose up -d postgres chromadb
cd api
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --reloadcd frontend
npm install
npm run devPOST /api/v1/auth/registerPOST /api/v1/auth/loginGET /api/v1/auth/meGET /api/v1/healthGET /api/v1/dashboard/overviewGET /api/v1/repositoriesPOST /api/v1/repositories/importPOST /api/v1/repositories/import/{owner}/{repo}/pull-requestsPOST /api/v1/repositories/import/{owner}/{repo}/reviewsPOST /api/v1/repositories/import/{owner}/{repo}/review-commentsPOST /api/v1/ai/index-all-reviewsGET /api/v1/ai/search?question=...&repository_id=...GET /api/v1/ai/ask?question=...&repository_id=...GET /api/v1/ai/repository-summary?repository_id=...
All endpoints except /health and /auth/register and /auth/login require a JWT Bearer token:
- Register or log in:
POST /api/v1/auth/register Content-Type: application/json {"email": "you@example.com", "password": "your_password"}
POST /api/v1/auth/login Content-Type: application/x-www-form-urlencoded username=you@example.com&password=your_password
- Use the returned
access_tokenon every protected request:Authorization: Bearer <access_token>
Repositories are private to the user who imports them. Dashboard statistics, repository CRUD, and all AI/RAG operations (search, ask, summaries, and knowledge indexing) are scoped to the authenticated user's repositories. Indexing never touches another user's repositories.
The 0003_repository_user_id migration assigns every pre-existing repository
to the bootstrap admin account (BOOTSTRAP_ADMIN_EMAIL). Set
BOOTSTRAP_ADMIN_PASSWORD before the first application start so that account
can be logged into. The password is only ever read from the environment and is
never stored in source code or migrations.
- Import repository metadata from GitHub.
- Sync pull requests.
- Sync PR review bodies.
- Sync inline PR review comments.
- Filter empty, very short, bot-like, or approval-only text.
- Embed useful review bodies and inline comments.
- Upsert documents into ChromaDB with repository, reviewer, PR, file, and line metadata.
- Retrieve semantically similar documents for a question.
- Ask Gemini to answer only from retrieved evidence and cite source numbers.
If retrieval is empty for Ask TeamBrain, the API indexes available database review material once and retries retrieval before answering.
Backend:
.venv/bin/pytestFrontend:
cd frontend
npm run buildAdd screenshots of the dashboard, import flow, Ask TeamBrain chat, and AI summary here after running the app locally.