OpenCodeHub
The self-hosted Git platform built for speed, control, and modern software engineering workflows.
OpenCodeHub is an open-source alternative to GitHub/GitLab featuring native Graphite-style Stacked PRs, a Merge Queue with speculative builds, a GitHub Actions-compatible CI/CD engine, and multi-provider AI Code Review.
Key Features
- π₯ Stacked PRs β Native stacked branch workflows in Web UI & CLI (
och stack create/submit/sync) - π¦ Merge Queue β Priority lanes, speculatively tested builds, and auto-merge controls
- β‘ CI/CD Pipeline Engine β GitHub Actions workflow runner using Docker-in-Docker execution
- π€ AI Code Review β Multi-provider support (OpenAI, Anthropic, Gemini, Groq, local Ollama)
- π Enterprise Security β Secret scanning, Trivy vulnerability scans, license compliance, OIDC SSO, 2FA/TOTP, and path permissions
- π¦ Pluggable Storage β Local filesystem, AWS S3, Cloudflare R2, MinIO, Ceph, Garage, and any S3-compatible backend
- ποΈ Multi-Database Support β PostgreSQL (recommended for production), SQLite, and Turso/LibSQL
- π§° Developer CLI β
opencodehub-cli(och) with interactive terminal cockpit (och focus) and stack visualization
Architecture Overview
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENTS β
β Browser β Git CLI (HTTP/SSH) β OpenCodeHub CLI (och) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OPENCODEHUB PLATFORM β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
β β Web UI β β REST API β β GraphQL Endpoint β β
β β (Astro+React)ββ (140+ routes)ββ (src/pages/api/) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
β β Git Server β β SSH Server β β Pipeline Runner β β
β β (HTTP RPC) β β (ssh2) β β (Docker executor) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PERSISTENCE & INFRASTRUCTURE β
β PostgreSQL / SQLite β Redis β S3 / MinIO / Local β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Quick Start
1. Single Container (Quick Test)
docker run -d \
--name opencodehub \
-p 4321:4321 \
-p 2222:2222 \
-v opencodehub-data:/data \
-e JWT_SECRET=$(openssl rand -hex 32) \
-e SESSION_SECRET=$(openssl rand -hex 32) \
-e INTERNAL_HOOK_SECRET=$(openssl rand -hex 32) \
-e SITE_URL=http://localhost:4321 \
opencodehub/opencodehub:latest
Open http://localhost:4321 in your browser to get started.
2. Production Docker Compose Stack (Recommended)
version: "3.8"
services:
app:
image: opencodehub/opencodehub:latest
container_name: opencodehub-app
restart: always
ports:
- "4321:4321" # Web UI & API
- "2222:2222" # Git SSH Server
environment:
- NODE_ENV=production
- SITE_URL=https://git.yourdomain.com
- DATABASE_DRIVER=postgres
- DATABASE_URL=postgresql://opencodehub:secretpass@postgres:5432/opencodehub?sslmode=disable
- REDIS_URL=redis://redis:6379
- JWT_SECRET=${JWT_SECRET}
- SESSION_SECRET=${SESSION_SECRET}
- INTERNAL_HOOK_SECRET=${INTERNAL_HOOK_SECRET}
- RUNNER_SECRET=${RUNNER_SECRET}
- WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET_ENCRYPTION_KEY}
volumes:
- app-data:/data
depends_on:
- postgres
- redis
worker:
image: opencodehub/opencodehub-worker:latest
container_name: opencodehub-worker
restart: always
environment:
- NODE_ENV=production
- DATABASE_DRIVER=postgres
- DATABASE_URL=postgresql://opencodehub:secretpass@postgres:5432/opencodehub?sslmode=disable
- REDIS_URL=redis://redis:6379
volumes:
- app-data:/data
depends_on:
- postgres
- redis
runner:
image: opencodehub/opencodehub-runner:latest
container_name: opencodehub-runner
restart: always
privileged: true
environment:
- OPENCODEHUB_URL=http://app:4321
- RUNNER_SECRET=${RUNNER_SECRET}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- app
postgres:
image: postgres:16-alpine
container_name: opencodehub-postgres
restart: always
environment:
POSTGRES_USER: opencodehub
POSTGRES_PASSWORD: secretpass
POSTGRES_DB: opencodehub
volumes:
- pg-data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
container_name: opencodehub-redis
restart: always
volumes:
- redis-data:/data
volumes:
app-data:
pg-data:
redis-data:
Start the stack:
docker compose up -d
docker compose exec app bun run scripts/seed-admin.ts
Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
SITE_URL |
Yes | http://localhost:4321 |
Base URL of your platform (e.g. https://git.company.com) |
DATABASE_DRIVER |
No | postgres |
Database driver (postgres, sqlite, turso) |
DATABASE_URL |
Yes | β | Connection string (PostgreSQL/SQLite) |
REDIS_URL |
Yes | β | Redis connection URI for sessions & locks |
JWT_SECRET |
Yes | β | 32+ char secret for JWT token signing |
SESSION_SECRET |
Yes | β | 32+ char secret for cookie encryption |
INTERNAL_HOOK_SECRET |
Yes | β | Shared secret for Git hook callbacks |
STORAGE_TYPE |
No | local |
Storage backend (local or s3) |
STORAGE_BUCKET |
If STORAGE_TYPE=s3 |
β | S3 bucket name |
STORAGE_REGION |
If STORAGE_TYPE=s3 |
us-east-1 |
S3 region |
STORAGE_ENDPOINT |
Optional | β | S3-compatible custom endpoint (MinIO / R2 / Garage) |
STORAGE_ACCESS_KEY_ID |
If STORAGE_TYPE=s3 |
β | Access Key ID |
STORAGE_SECRET_ACCESS_KEY |
If STORAGE_TYPE=s3 |
β | Secret Access Key |
METRICS_TOKEN |
Optional | β | Bearer token for GET /api/metrics |
OpenCodeHub CLI (och)
Install the official CLI to manage stacks, merge queues, and reviews:
npm install -g opencodehub-cli
# Authenticate with your self-hosted instance
och auth login --url https://git.yourdomain.com
# Create stacked PR branches
och stack create feature/part-1
och stack submit
Useful Links & Community
- Official Repository: github.com/swadhinbiswas/OpencodeHub
- Documentation: docs.opencodehub.space
- Bug Tracker: github.com/swadhinbiswas/OpencodeHub/issues
- License: MIT