Skip to main content

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:

Clone Repository

Backend Setup

1

Create Virtual Environment

Create and activate a Python virtual environment:
2

Install Dependencies

Install all required Python packages:
This installs FastAPI, Uvicorn, SQLAlchemy, Neo4j driver, Anthropic SDK, and all other dependencies.
3

Configure Environment Variables

Copy the example environment file and fill in your values:
Edit .env and set the required variables:
4

Set Up Local PostgreSQL

If using local PostgreSQL:
Or use Supabase for a cloud database:
  1. Create a free project at supabase.com
  2. Get the connection string from SettingsDatabase
  3. Use the Session Mode pooler (port 5432)
5

Run Database Migrations

Apply all database migrations:
This creates all required tables:
  • users
  • installations
  • events
  • workflows
  • oauth_states
6

Start Backend Server

Run the FastAPI backend with hot-reload:
You should see:
7

Verify Backend

Test the health endpoint:
Expected response:

Frontend Setup

1

Navigate to Frontend Directory

2

Install Dependencies

This installs Next.js 15, React 19, TailwindCSS 4, and all other dependencies.
3

Configure Environment

Copy the example environment file:
Edit .env.local:
Do NOT include a trailing slash in NEXT_PUBLIC_API_URL.
4

Start Development Server

The Next.js dev server starts on port 3000:
5

Access Frontend

Open your browser and navigate to:
You should see the Nectr landing page.

GitHub OAuth Setup

To test authentication locally:
1

Create GitHub OAuth App

  1. Go to github.com/settings/developers
  2. Click New OAuth App
  3. Fill in the details:
    • Application name: Nectr Local Dev
    • Homepage URL: http://localhost:3000
    • Authorization callback URL: http://localhost:8000/auth/github/callback
  4. Click Register application
2

Get Credentials

Copy the Client ID and generate a Client Secret.Update your backend .env:
3

Create Personal Access Token

Create a classic token at github.com/settings/tokens:
  1. Click Generate new tokenClassic
  2. Select scope: repo (full control of private repositories)
  3. Generate and copy the token
Update your backend .env:
4

Test Authentication

  1. Go to http://localhost:3000
  2. Click Sign in with GitHub
  3. Authorize the app
  4. 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

Use curl or tools like Postman/Insomnia:
Backend logs appear in the terminal where you ran uvicorn. Increase verbosity:

Testing Webhooks Locally

GitHub webhooks require a public URL. Use ngrok to expose your local server:
1

Install ngrok

Download from ngrok.com or install via package manager:
2

Start ngrok Tunnel

Copy the public URL (e.g., https://abc123.ngrok.io).
3

Update Environment Variables

Update your .env temporarily:
4

Configure GitHub Webhook

In your GitHub repo settings:
  1. Go to SettingsWebhooksAdd webhook
  2. Set Payload URL: https://abc123.ngrok.io/api/v1/webhooks/github
  3. Set Content type: application/json
  4. Set Secret: (generate a random string)
  5. Select events: Pull requests
  6. Click Add webhook
5

Test Webhook

Open or update a PR in your repo. Check the backend logs to see the webhook event.

Troubleshooting

If port 8000 or 3000 is in use:
Update NEXT_PUBLIC_API_URL and FRONTEND_URL accordingly.
Ensure PostgreSQL is running:
Verify connection string in .env.
If using local Neo4j:
Verify URI in .env: bolt://localhost:7687
Ensure virtual environment is activated and dependencies are installed:
Verify FRONTEND_URL is set correctly in backend .env:
CORS middleware in 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