Skip to main content

Overview

Nectr is designed to be self-hosted. You own your data, your API keys, and your infrastructure. This guide covers deploying Nectr using Docker on any server, cloud provider, or Kubernetes cluster.
Self-hosting gives you complete control but requires managing your own database, Neo4j instance, and SSL certificates.

Why Self-Host?

  • Data Ownership: All code, PRs, and reviews stay on your infrastructure
  • Custom Integrations: Modify the codebase to fit your workflow
  • Security: Meet compliance requirements for sensitive codebases
  • Cost Control: No usage-based pricing for high-volume teams

Prerequisites

  • Linux server (Ubuntu 22.04+ recommended) or any Docker-compatible host
  • Docker and Docker Compose installed
  • Domain name with DNS access (for SSL certificates)
  • PostgreSQL database (self-hosted or managed)
  • Neo4j database (self-hosted or AuraDB)

Architecture

A self-hosted Nectr deployment consists of:

Docker Deployment

Using Docker Compose

The easiest way to self-host Nectr is with Docker Compose.
1

Clone Repository

2

Create docker-compose.yml

Create a docker-compose.yml file in the project root:
docker-compose.yml
3

Create Frontend Dockerfile

Create nectr-web/Dockerfile:
nectr-web/Dockerfile
4

Configure Environment Variables

Create a .env file in the project root:
.env
Never commit .env to version control. Add it to .gitignore.
5

Start Services

This starts:
  • Backend (FastAPI) on port 8000
  • Frontend (Next.js) on port 3000
  • PostgreSQL on port 5432
  • Neo4j on ports 7474 (browser) and 7687 (bolt)
6

Run Migrations

Apply database migrations:
7

Verify Deployment

Expected response:

SSL & Reverse Proxy

Use Nginx as a reverse proxy with Let’s Encrypt for SSL certificates.
1

Install Nginx

2

Configure Nginx

Create /etc/nginx/sites-available/nectr:
/etc/nginx/sites-available/nectr
3

Enable Site

4

Get SSL Certificates

Follow the prompts. Certbot automatically updates your Nginx config.
5

Auto-Renewal

Test auto-renewal:
Certbot automatically renews certificates before they expire.

Alternative: Single Server Without Docker

If you prefer not to use Docker:
1

Install Dependencies

2

Set Up Backend

3

Set Up Frontend

4

Create Systemd Services

Create /etc/systemd/system/nectr-backend.service:
Create /etc/systemd/system/nectr-frontend.service:
5

Start Services

Managed Services

For easier maintenance, use managed services:
Using managed databases simplifies backups, scaling, and maintenance.

Monitoring & Backups

Health Monitoring

Set up uptime monitoring:

Database Backups

Automated daily backups:

Log Management

Rotate logs to prevent disk space issues:

Scaling

Horizontal Scaling

Run multiple backend instances behind a load balancer:
docker-compose.yml (excerpt)

Vertical Scaling

Increase server resources:
  • CPU: 2+ cores for production
  • RAM: 4GB minimum, 8GB recommended
  • Storage: 20GB+ (depends on PR volume)

Security Best Practices

1

Use Strong Secrets

Generate cryptographically secure secrets:
2

Restrict Database Access

Configure PostgreSQL to only accept connections from localhost:
3

Enable Firewall

4

Regular Updates

Keep system packages updated:
5

Secure GitHub PAT

Store GitHub PAT in environment variables, never in code. Rotate it every 90 days.

Troubleshooting

Check logs:
Common issues:
  • Missing environment variables
  • Database connection failures
  • Port conflicts
Verify PostgreSQL is accessible:
Check DATABASE_URL format:
Reset Neo4j password:
Check disk usage:
Clean up unused images:

Next Steps

Configure GitHub App

Set up OAuth and webhooks

Connect Repository

Connect your first repo