Overview
Nectr uses environment variables for all configuration. Copy.env.example to .env and fill in the values.
Required Variables
These variables must be set for Nectr to start and review PRs.AI
Anthropic API key for Claude Sonnet. Get it from console.anthropic.com.
Claude model to use for PR reviews.
Database
PostgreSQL connection string in SQLAlchemy async format. Supabase free tier recommended.Format:Supabase example (use Connection Pooling → Session Mode):
GitHub
GitHub OAuth App Client ID. Get it from github.com/settings/developers.
GitHub OAuth App Client Secret.
GitHub Personal Access Token (classic) with
repo scope. Used to post PR review comments.Get it from github.com/settings/tokens → Generate new token (classic).Authentication
Secret key for JWT signing and token encryption. Generate with:
URLs
URL where the FastAPI backend is hosted.Local development:Production (Railway):
URL where the Next.js frontend is hosted. Used for CORS and OAuth redirects.Local development:Production (Vercel):
Neo4j Knowledge Graph
Neo4j database URI. Free tier available at neo4j.com/cloud/aura.
Use
neo4j+s:// for encrypted connections (required for Neo4j Aura).Neo4j username.
Neo4j password.
Mem0 Memory Layer
Mem0 API key for semantic memory. Get it from mem0.ai.
Mem0 enables Nectr to learn per-project patterns and per-developer habits over time.
Optional Variables
These variables are optional. Leave blank to disable the feature.MCP Integrations
Pull live context from third-party tools into every PR review. Each integration is independent.Linear MCP server base URL.
Linear personal API key. Get it from Linear settings → API.
When set, Nectr pulls linked Linear issues and task descriptions into PR reviews.
Sentry MCP server base URL.
Sentry authentication token.
When set, Nectr fetches production errors for files changed in the PR.
Slack MCP server base URL.
When set, Nectr pulls relevant Slack channel messages as review context.
Feature Flags
Enable parallel review mode: runs 3 specialized agents concurrently (security, performance, style) instead of a single agentic loop.Options:
false— Single agentic review loop (default, faster, lower token usage)true— 3 parallel specialized agents + synthesis agent (more thorough, higher token usage)
Slack Bot
Slack bot token for direct notifications (separate from MCP context integration).
Slack signing secret for webhook verification.
Webhook
Global fallback webhook secret. Per-repo secrets are stored in the database automatically on repo connect.
Only used if no per-repo secret is found in the database. Nectr generates unique secrets per repo.
App Settings
These settings control app behavior. Safe to leave as-is for local development.Application name (displayed in logs and API docs).
Environment name.
Enable debug mode (detailed error messages in API responses).
Logging level.Options:
DEBUG, INFO, WARNING, ERROR, CRITICALHost to bind the server to.
Port to run the server on. Railway overrides this with
$PORT.JWT token expiration in minutes (default: 24 hours).
JWT signing algorithm.
Frontend Environment Variables
The Next.js frontend (nectr-web/) uses separate environment variables in .env.local.
URL of the Nectr backend API.Local development:Production:
NEXT_PUBLIC_* variables are embedded in the browser bundle at build time. Only set public, non-sensitive values.Example Configurations
Local Development
Backend.env:
.env.local:
Production (Railway + Vercel)
Railway environment variables:Security Best Practices
- Never commit
.envfiles to git (already in.gitignore) - Use unique
SECRET_KEYper environment (generate withsecrets.token_hex(32)) - Set
DEBUG=Falsein production - Rotate
GITHUB_PATperiodically - Use Supabase connection pooling (Session mode, port 5432)
- Store production secrets in Railway/Vercel dashboards, not in code
- Use Neo4j Aura IP whitelisting (add Railway/Vercel IPs only)
- Enable HTTPS (Railway and Vercel handle this automatically)
Troubleshooting
Environment variables not loading
Environment variables not loading
- Verify
.envfile exists in repository root - Check file is named exactly
.env(not.env.txtor.env.example) - Ensure
python-dotenvis installed (pip list | grep dotenv) - Restart the server after changing
.env
Database connection fails
Database connection fails
- Verify
DATABASE_URLformat:postgresql+asyncpg://... - Check username, password, host, port, database name
- For Supabase: use Connection Pooling → Session Mode (port 5432)
- Test connection:
psql $DATABASE_URL(requirespsqlCLI)
Neo4j connection fails
Neo4j connection fails
- Verify
NEO4J_URIusesneo4j+s://(notbolt://) - Check Neo4j Aura database is running
- Verify IP is whitelisted in Neo4j console
- Test credentials in Neo4j Browser
GitHub OAuth fails
GitHub OAuth fails
- Verify
GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETare correct - Check OAuth callback URL in GitHub settings matches
{BACKEND_URL}/auth/github/callback - Ensure
FRONTEND_URLis in CORS allowed origins (seeapp/main.py)
Anthropic API errors
Anthropic API errors
- Verify
ANTHROPIC_API_KEYis valid - Check API key has sufficient credits at console.anthropic.com
- Ensure model name is correct:
claude-sonnet-4-5-20250929
Next Steps
Local Development
Set up Nectr on your local machine
Deployment
Deploy to Railway and Vercel
Database Setup
Configure PostgreSQL and Neo4j
Architecture
Understand Nectr’s architecture