Prerequisites
Before you begin, ensure you have:- A GitHub account with access to the repositories you want to review
- Access to create OAuth apps in GitHub
- API keys for the required services (see below)
Nectr is designed to be self-hosted. You own your data, your API keys, and your infrastructure.
Overview
Nectr requires five core services:1
Railway (Backend)
Hosts the FastAPI backend that orchestrates PR reviews
2
Vercel (Frontend)
Hosts the Next.js dashboard for managing repos and viewing analytics
3
Neo4j (Knowledge Graph)
Tracks file ownership, developer expertise, and related PRs
4
Mem0 (Semantic Memory)
Remembers per-project patterns and per-developer habits
5
Anthropic Claude
Powers the AI analysis with Claude Sonnet 4.6
Step 1: Get Your API Keys
1
Anthropic API Key
- Go to console.anthropic.com
- Create an account or sign in
- Generate a new API key
- Copy the key (starts with
sk-ant-)
2
Neo4j Cloud Instance
- Visit neo4j.com/cloud/platform/aura-graph-database
- Create a free tier instance
- Note your connection URI (starts with
neo4j+s://) - Save your username (default:
neo4j) and password
3
Mem0 API Key
- Go to mem0.ai
- Sign up for an account
- Generate an API key
- Copy the key (starts with
m0-)
4
GitHub Personal Access Token
- Go to github.com/settings/tokens
- Click Generate new token → Classic
- Select scope:
repo(full control of private repositories) - Generate and copy the token (starts with
ghp_)
This token is used by Nectr to post PR review comments on your behalf.
5
PostgreSQL Database
- Go to supabase.com and create a free project
- Navigate to Database → Connection Pooling
- Select Session Mode (port 5432)
- Copy the connection string
- Convert to async format:
Step 2: Create GitHub OAuth App
1
Register OAuth App
- Go to github.com/settings/developers
- Click New OAuth App
- Fill in the following:
- Application name: Nectr AI PR Review
- Homepage URL:
https://your-app.vercel.app(use your actual Vercel URL) - Authorization callback URL:
https://your-backend.up.railway.app/auth/github/callback
- Click Register application
2
Get Client Credentials
- Copy the Client ID
- Click Generate a new client secret
- Copy the Client Secret immediately (it’s only shown once)
Step 3: Deploy Backend to Railway
1
Create Railway Project
- Go to railway.app and sign in
- Click New Project → Deploy from GitHub repo
- Select your forked Nectr repository
- Choose the root directory (backend is in the root)
2
Configure Environment Variables
In Railway’s Variables tab, add the following:
3
Deploy
Railway will automatically deploy your backend. Once complete:
- Copy your Railway URL (e.g.,
https://nectr-production.up.railway.app) - Update
BACKEND_URLin Railway variables - Redeploy if necessary
Step 4: Deploy Frontend to Vercel
1
Create Vercel Project
- Go to vercel.com and sign in
- Click Add New → Project
- Import your forked Nectr repository
- Set Root Directory to
nectr-web
2
Configure Environment Variables
Add the following environment variable:
Replace with your actual Railway backend URL from Step 3.
3
Deploy
Click Deploy. Vercel will build and deploy your Next.js frontend.
Step 5: Connect Your First Repository
1
Open Dashboard
- Navigate to your Vercel URL (e.g.,
https://your-app.vercel.app) - Click Sign in with GitHub
- Authorize the OAuth app
2
Connect a Repository
- Go to Repos in the sidebar
- Click Connect Repository
- Select a repository from the list
- Click Install
- Install a webhook on the repository
- Build the initial Neo4j knowledge graph
- Index all files and contributors
3
Open a Pull Request
- Create a new branch in your connected repository
- Make some changes and push
- Open a pull request on GitHub
What Happens Next?
When a PR is opened or updated, Nectr automatically:1
Receives Webhook
GitHub sends a webhook event to
/api/v1/webhooks/github2
Fetches Context
- Pulls PR diff and changed files
- Queries Neo4j for file experts and related PRs
- Retrieves project patterns and developer habits from Mem0
- (Optional) Fetches linked Linear issues, Sentry errors, and Slack messages
3
AI Analysis
Claude Sonnet 4.6 analyzes the PR for:
- Bugs: Logic errors, edge cases, race conditions
- Security: Injection risks, exposed secrets, auth issues
- Performance: N+1 queries, memory leaks, inefficient algorithms
- Style: Code consistency, naming conventions, best practices
4
Posts Review
- Posts a structured comment on GitHub with:
- Executive summary
- Verdict (APPROVE / REQUEST_CHANGES / COMMENT)
- Inline suggestions for each file
- Severity ratings (🔴 critical, 🟡 moderate, 🟢 minor)
5
Learns & Remembers
- Indexes PR in Neo4j knowledge graph
- Extracts and stores memories in Mem0:
- Project patterns (e.g., “Always use prepared statements for SQL”)
- Developer strengths (e.g., “Alice excels at React hooks”)
- Risk modules (e.g., “auth/ is security-critical”)
Example Review Output
Here’s what a typical Nectr review looks like:Moderate Issues 🟡
2. Missing Rate Limiting on /login
The login endpoint has no rate limiting, making it vulnerable to brute-force attacks.
Suggested fix: Add @limiter.limit("5 per minute") decorator.
Minor Issues 🟢
3. Inconsistent Error Messages
Some endpoints return{"error": ...}, others return {"message": ...}.
Context: This project uses {"error": ...} consistently (see api/v1/users.py).