Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Nectr-AI/nectr-ai-pr-review-agent/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This guide walks you through setting up Nectr for local development. You’ll run the FastAPI backend and Next.js frontend on your machine with hot-reload for rapid iteration.Prerequisites
Ensure you have these installed:- Python 3.14+ (download)
- Node.js 20+ and npm (download)
- Git (download)
- PostgreSQL (or use a cloud provider like Supabase)
- Neo4j (local or AuraDB free tier)
Clone Repository
Backend Setup
Install Dependencies
Install all required Python packages:
This installs FastAPI, Uvicorn, SQLAlchemy, Neo4j driver, Anthropic SDK, and all other dependencies.
Configure Environment Variables
Copy the example environment file and fill in your values:Edit
.env and set the required variables:Set Up Local PostgreSQL
If using local PostgreSQL:Or use Supabase for a cloud database:
- Create a free project at supabase.com
- Get the connection string from Settings → Database
- Use the Session Mode pooler (port 5432)
Run Database Migrations
Apply all database migrations:This creates all required tables:
usersinstallationseventsworkflowsoauth_states
Frontend Setup
GitHub OAuth Setup
To test authentication locally:Create GitHub OAuth App
- Go to github.com/settings/developers
- Click New OAuth App
- Fill in the details:
- Application name: Nectr Local Dev
- Homepage URL:
http://localhost:3000 - Authorization callback URL:
http://localhost:8000/auth/github/callback
- Click Register application
Create Personal Access Token
Create a classic token at github.com/settings/tokens:
- Click Generate new token → Classic
- Select scope:
repo(full control of private repositories) - Generate and copy the token
.env:Development Workflow
Hot Reload
Both backend and frontend support hot-reload:- Backend: Uvicorn automatically restarts when you edit Python files
- Frontend: Next.js Fast Refresh updates the browser instantly
Project Structure
Common Development Tasks
Create a new database migration
Create a new database migration
Reset database
Reset database
Test API endpoints
Test API endpoints
Use
curl or tools like Postman/Insomnia:View logs
View logs
Backend logs appear in the terminal where you ran
uvicorn. Increase verbosity:Run type checks
Run type checks
Testing Webhooks Locally
GitHub webhooks require a public URL. Use ngrok to expose your local server:Install ngrok
Download from ngrok.com or install via package manager:
Configure GitHub Webhook
In your GitHub repo settings:
- Go to Settings → Webhooks → Add webhook
- Set Payload URL:
https://abc123.ngrok.io/api/v1/webhooks/github - Set Content type:
application/json - Set Secret: (generate a random string)
- Select events:
Pull requests - Click Add webhook
Troubleshooting
Port already in use
Port already in use
If port 8000 or 3000 is in use:Update
NEXT_PUBLIC_API_URL and FRONTEND_URL accordingly.Database connection errors
Database connection errors
Ensure PostgreSQL is running:Verify connection string in
.env.Neo4j connection errors
Neo4j connection errors
If using local Neo4j:Verify URI in
.env: bolt://localhost:7687Module import errors
Module import errors
Ensure virtual environment is activated and dependencies are installed:
CORS errors in browser
CORS errors in browser
Verify CORS middleware in
FRONTEND_URL is set correctly in backend .env:app/main.py allows requests from this URL.Next Steps
Deploy to Railway
Deploy the backend to production
Deploy to Vercel
Deploy the frontend to production