🚀 Getting Started

Get OpenCodeHub running locally in under 5 minutes. This guide covers installation, configuration, and creating your first repository.

📋 Prerequisites

📦 Node.js 18+

JavaScript runtime for the application. Download Node.js

🗄️ Database

PostgreSQL 14+ (recommended), MySQL 8+, or SQLite 3.35+

🔀 Git 2.30+

For repository management. Usually pre-installed on Linux/macOS.

📥 Installation

Clone the Repository
$ git clone https://github.com/swadhinbiswas/OpencodeHub.git
$ cd OpenCodeHub
Install Dependencies
$ npm install

Or use Bun for faster installation:

$ bun install
Configure Environment
$ cp .env.example .env

Edit .env with your database connection and secrets.

Setup Database
$ npm run db:push

This creates all required database tables.

Create Admin User
$ bun run scripts/seed-admin.ts

Follow the prompts to set username, email, and password.

Start Server
$ npm run dev

Open http://localhost:3000 in your browser!

⚙️ Configuration

Key environment variables to configure:

Variable Required Description
DATABASE_URL Database connection string
JWT_SECRET Secret for JWT tokens (32+ chars)
SESSION_SECRET Secret for sessions (32+ chars)
SITE_URL Your site URL (e.g., https://git.example.com)
INTERNAL_HOOK_SECRET Secret for Git hooks (32+ chars)
STORAGE_TYPE local, s3, gcs, or azure
💡 Generating Secrets

Generate secure secrets with: openssl rand -hex 32

📁 Create Your First Repository

Login to OpenCodeHub

Navigate to http://localhost:3000/login and sign in with your admin credentials.

Create Repository

Click the + button in the header and select New Repository.

Fill in the repository name, description, and visibility settings.

Clone Locally
$ git clone http://localhost:3000/your-username/repo-name.git
Push Your Code
cd repo-name
echo "# My Project" > README.md
git add .
git commit -m "Initial commit"
git push origin main

📚 Next Steps