Nectr is open-source and designed to be self-hosted. You maintain full control over your data, API keys, and infrastructure.
Architecture Overview
Before we begin, here’s how Nectr components connect:Prerequisites
GitHub Account
You need a GitHub account with:
- Admin access to repositories you want to review
- Ability to create OAuth apps
- Ability to create personal access tokens
Required Services
Sign up for API access:
- Anthropic Claude - AI model
- Neo4j Aura - Knowledge graph
- Mem0 - Semantic memory
- Supabase - PostgreSQL database
Part 1: Service Setup
1.1 PostgreSQL Database (Supabase)
Create Project
- Go to supabase.com and create an account
- Click New Project
- Enter:
- Name: nectr-db
- Database Password: Generate a strong password
- Region: Choose closest to your users
- Click Create new project (takes ~2 minutes)
1.2 Neo4j Knowledge Graph
Create Instance
- Go to neo4j.com/cloud/aura
- Click Start Free
- Create an account or sign in
- Click Create Free Instance
- Select:
- Instance Type: AuraDB Free
- Region: Choose closest to your backend
- Click Create
1.3 Mem0 Semantic Memory
Create Account
- Go to mem0.ai
- Sign up for an account
- Verify your email
1.4 Anthropic Claude
Get API Key
- Go to console.anthropic.com
- Create an account or sign in
- Navigate to API Keys
- Click Create Key
- Copy the key (starts with
sk-ant-)
Part 2: GitHub Configuration
2.1 Create GitHub OAuth App
Register Application
- Go to github.com/settings/developers
- Click OAuth Apps → New OAuth App
- Fill in:
- Application name:
Nectr AI PR Review - Homepage URL:
https://your-app.vercel.app(temporary, update later) - Application description:
AI-powered PR review agent - Authorization callback URL:
https://your-app.up.railway.app/auth/github/callback(temporary, update later)
- Application name:
- Click Register application
2.2 Create GitHub Personal Access Token
Generate Token
- Go to github.com/settings/tokens
- Click Generate new token → Generate new token (classic)
- Configure:
- Note:
Nectr PR Review Bot - Expiration:
No expiration(or set a reminder to rotate) - Scopes: Select
repo(full control of private repositories)
- Note:
- Click Generate token
Part 3: Backend Deployment (Railway)
3.1 Deploy from GitHub
Fork Repository
- Go to the Nectr repository on GitHub
- Click Fork in the top-right
- Select your account
Create Railway Project
- Go to railway.app
- Click New Project
- Select Deploy from GitHub repo
- Authenticate with GitHub
- Select your forked Nectr repository
- Click Deploy Now
3.2 Configure Environment Variables
In Railway, go to your project → Variables and add the following:Required Variables
Required Variables
Optional Variables (MCP Integrations)
Optional Variables (MCP Integrations)
3.3 Get Backend URL
Wait for Deployment
Railway will automatically deploy your backend. Wait for the build to complete (~2-3 minutes).
Copy URL
- Go to your Railway project → Settings
- Scroll to Domains
- Click Generate Domain
- Copy the URL (e.g.,
nectr-production.up.railway.app)
3.4 Update GitHub OAuth Callback
Update Callback URL
- Go to github.com/settings/developers
- Click on your Nectr AI PR Review OAuth app
- Update Authorization callback URL to:
- Click Update application
Part 4: Frontend Deployment (Vercel)
4.1 Deploy from GitHub
Import Project
- Go to vercel.com
- Click Add New → Project
- Import your forked Nectr repository
Configure Build Settings
- Framework Preset: Next.js
- Root Directory:
nectr-web - Build Command:
npm run build(auto-detected) - Output Directory:
.next(auto-detected)
Add Environment Variable
In Environment Variables, add:
Replace with your actual Railway backend URL from Part 3.
4.2 Get Frontend URL
Update Backend Environment
- Go back to Railway → Variables
- Update
FRONTEND_URL:
- Railway will auto-redeploy
Update GitHub OAuth Homepage
- Go to github.com/settings/developers
- Click on your Nectr AI PR Review OAuth app
- Update Homepage URL to your Vercel URL
- Click Update application
Part 5: Verification
5.1 Test Backend Health
5.2 Test Frontend
5.3 Connect First Repository
Install Webhook
- Find a test repository
- Click Connect or Install
- Wait for the installation to complete
- Installs a webhook on the repo
- Scans all files and creates Neo4j nodes
- Indexes contributors and file ownership
Part 6: Configuration
6.1 Database Migrations
Railway automatically runs database migrations on startup viaalembic. If you need to run migrations manually:
6.2 Neo4j Schema Initialization
Nectr automatically creates Neo4j constraints and indexes on first startup. To verify:Open Neo4j Browser
- Go to your Neo4j instance in the Aura console
- Click Open → Neo4j Browser
- Enter your credentials
Check Constraints
Run:You should see unique constraints on:
Repository.full_nameFile.pathDeveloper.github_idPullRequest.pr_numberIssue.number
Troubleshooting
Railway build fails
Railway build fails
Common causes:
- Missing environment variables: Check that all required variables are set
- Python version mismatch: Nectr requires Python 3.14+. Check
runtime.txtor Railway settings - Dependency conflicts: Check Railway logs for pip errors
Vercel build fails
Vercel build fails
Common causes:
- Wrong root directory: Must be set to
nectr-web - Missing NEXT_PUBLIC_API_URL: Required environment variable
- Node version mismatch: Requires Node 20+
- Go to Vercel project → Settings → General
- Set Root Directory to
nectr-web - Go to Environment Variables
- Add
NEXT_PUBLIC_API_URL=https://your-backend.up.railway.app - Redeploy from Deployments tab
Database connection errors
Database connection errors
Symptoms:Fix:
- Verify
DATABASE_URLusespostgresql+asyncpg://prefix - Check Supabase connection pooling is enabled (Session Mode)
- Test connection:
Neo4j connection errors
Neo4j connection errors
Symptoms:Fix:
- Verify
NEO4J_URIstarts withneo4j+s://(notbolt://) - Check credentials in Neo4j Aura console
- Test connection:
Webhook not triggering
Webhook not triggering
Symptoms:
- PR opened but no review posted
- No webhook events in Railway logs
- Check webhook is installed:
- Go to GitHub repo → Settings → Webhooks
- Verify webhook URL matches
{BACKEND_URL}/api/v1/webhooks/github
- Test webhook delivery:
- Click on the webhook → Recent Deliveries
- Click Redeliver on a recent event
- Check Railway logs for incoming requests:
OAuth login fails
OAuth login fails
Symptoms:
- Redirects to GitHub but never returns
- “Invalid client” error
- Verify GitHub OAuth app callback URL:
- Check
GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETin Railway - Verify
FRONTEND_URLmatches your Vercel domain - Check CORS configuration in
app/main.py:
Review posted but empty/incomplete
Review posted but empty/incomplete
Symptoms:
- Review comment appears but has no content
- Review is cut off mid-sentence
- Check
ANTHROPIC_API_KEYis valid - Verify API key has sufficient credits
- Check Railway logs for Anthropic API errors:
- Increase timeout if reviews are large:
Next Steps
Quickstart Guide
Get your first PR reviewed in under 10 minutes
MCP Integrations
Connect Linear, Sentry, and Slack for richer context
Memory Configuration
Customize project patterns and coding rules
API Reference
Explore all backend endpoints and webhooks
Local Development
To run Nectr locally for development:Production Checklist
Before going to production, verify:- All environment variables are set in Railway and Vercel
-
SECRET_KEYis a cryptographically secure random value (not the default) -
BACKEND_URLandFRONTEND_URLmatch your actual domains - GitHub OAuth callback URL points to Railway backend
-
DATABASE_URLuses connection pooling (Session Mode) - Neo4j instance is running and accessible
- Mem0 API key is valid and has quota
- Anthropic API key has sufficient credits
-
GITHUB_PAThasreposcope and doesn’t expire soon - Railway auto-deploys from
mainbranch - Vercel auto-deploys from
mainbranch - Health endpoint returns
{"status": "healthy"} - Test PR review completes successfully
- MCP integrations are configured (or intentionally disabled)
- Logging level is set to
INFOorWARNING(notDEBUG) - CORS origins are restricted to your frontend domain