Skip to content

Local Development Setup

  • Node.js 20+ (or Bun 1.0+)
  • Git 2.30+
  • PostgreSQL 14+ (recommended) or SQLite (for quick setup)
  • Redis 7+ (optional for local dev, required for background workers)
Terminal window
# Clone the repository
git clone https://github.com/swadhinbiswas/OpencodeHub.git
cd OpencodeHub
# Install dependencies
npm install
# Copy environment config
cp .env.example .env
# Edit .env with your settings (at minimum, set the secrets)
# Generate secrets with: openssl rand -base64 32
Terminal window
# Push schema to database (creates tables)
npm run db:push
# Or generate and run migrations
npm run db:generate
npm run db:migrate
# Open Drizzle Studio GUI
npm run db:studio

For SQLite (simplest setup), set in .env:

DATABASE_DRIVER=sqlite
DATABASE_URL=file:./data/opencodehub.db
Terminal window
bun run scripts/seed-admin.ts
Terminal window
# Main app (Web UI + API + Git HTTP)
npm run dev
# SSH Git server (optional, for ssh:// clone/push)
npm run git:start
# Background worker (optional, for webhooks/notifications)
npm run worker:start
# CI runner (optional, for pipeline execution)
npm run runner:start

The dev server runs at http://localhost:4321.

CommandPurpose
npm run devStart Astro dev server
npm run buildProduction build
npm run testRun Vitest test suite
npm run test:coverageRun tests with coverage
npm run lintRun Astro check
npm run typecheckTypeScript type checking
npm run db:pushPush schema to database
npm run db:generateGenerate Drizzle migrations
npm run db:migrateRun migrations
npm run db:studioOpen Drizzle Studio
npm run git:startStart SSH git server
npm run worker:startStart background worker
npm run runner:startStart CI runner

For a full stack with PostgreSQL and Redis:

Terminal window
docker-compose up -d
docker-compose exec app bun run scripts/seed-admin.ts

This starts the app on port 4321 and SSH on port 2222.

  • VS Code: Install the Astro extension for syntax highlighting
  • Recommended extensions: Tailwind CSS IntelliSense, ESLint