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
Create Virtual Environment
Install Dependencies
Configure Environment Variables
.env and set the required variables:Set Up Local PostgreSQL
- Create a free project at supabase.com
- Get the connection string from Settings → Database
- Use the Session Mode pooler (port 5432)
Run Database Migrations
usersinstallationseventsworkflowsoauth_states
Start Backend Server
Verify Backend
Frontend Setup
Navigate to Frontend Directory
Install Dependencies
Configure Environment
.env.local:Start Development Server
Access Frontend
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
Get Credentials
.env:Create Personal Access Token
- Click Generate new token → Classic
- Select scope:
repo(full control of private repositories) - Generate and copy the token
.env:Test Authentication
- Go to
http://localhost:3000 - Click Sign in with GitHub
- Authorize the app
- You should be redirected to
/dashboard
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
curl or tools like Postman/Insomnia:View logs
View logs
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
Start ngrok Tunnel
https://abc123.ngrok.io).Update Environment Variables
.env temporarily:Configure GitHub Webhook
- 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
Test Webhook
Troubleshooting
Port already in use
Port already in use
NEXT_PUBLIC_API_URL and FRONTEND_URL accordingly.Database connection errors
Database connection errors
.env.Neo4j connection errors
Neo4j connection errors
.env: bolt://localhost:7687Module import errors
Module import errors
CORS errors in browser
CORS errors in browser
FRONTEND_URL is set correctly in backend .env:app/main.py allows requests from this URL.