Sign inSign up
opencodehub logo

opencodehub/opencodehub

By opencodehub

•Updated 3 months ago

Self-hosted Git platform with stacked PRs, merge queue, CI/CD, and AI code review

Image
API management
Developer tools
Web servers
1

2.6K

opencodehub/opencodehub repository overview

⁠OpenCodeHub

Docker Image Size Docker Pulls License: MIT Documentation

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.


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

VariableRequiredDefaultDescription
SITE_URLYeshttp://localhost:4321Base URL of your platform (e.g. https://git.company.com)
DATABASE_DRIVERNopostgresDatabase driver (postgres, sqlite, turso)
DATABASE_URLYes—Connection string (PostgreSQL/SQLite)
REDIS_URLYes—Redis connection URI for sessions & locks
JWT_SECRETYes—32+ char secret for JWT token signing
SESSION_SECRETYes—32+ char secret for cookie encryption
INTERNAL_HOOK_SECRETYes—Shared secret for Git hook callbacks
STORAGE_TYPENolocalStorage backend (local or s3)
STORAGE_BUCKETIf STORAGE_TYPE=s3—S3 bucket name
STORAGE_REGIONIf STORAGE_TYPE=s3us-east-1S3 region
STORAGE_ENDPOINTOptional—S3-compatible custom endpoint (MinIO / R2 / Garage)
STORAGE_ACCESS_KEY_IDIf STORAGE_TYPE=s3—Access Key ID
STORAGE_SECRET_ACCESS_KEYIf STORAGE_TYPE=s3—Secret Access Key
METRICS_TOKENOptional—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

Tag summary

Content type

Image

Digest

sha256:9aeaebf5d…

Size

239.8 MB

Last updated

3 months ago

docker pull opencodehub/opencodehub