Contributing Guide
Thank you for your interest in contributing to OpenCodeHub! We welcome contributions from everyone.
Local Development Setup
Section titled “Local Development Setup”Prerequisites
Section titled “Prerequisites”- Node.js 20+ (or Bun 1.0+)
- Docker (for PostgreSQL and Redis)
- Git 2.30+
Step 1: Clone & Install
Section titled “Step 1: Clone & Install”git clone https://github.com/swadhinbiswas/OpencodeHub.gitcd OpencodeHubnpm installStep 2: Database Setup
Section titled “Step 2: Database Setup”Start PostgreSQL and Redis:
docker-compose up -d postgres redisCopy and configure environment:
cp .env.example .env# The default .env.example works with docker-compose servicesPush schema to database:
npm run db:pushStep 3: Seed & Run
Section titled “Step 3: Seed & Run”# Create admin userbun run scripts/seed-admin.ts
# Start dev servernpm run devVisit http://localhost:4321.
Running Tests
Section titled “Running Tests”We use Vitest for unit/integration tests and Playwright for E2E tests.
# Run all testsnpm run test
# Run with coveragenpm run test:coverage
# Run specific test filenpx vitest run tests/unit/auth.test.ts
# Watch modenpx vitest --watchCurrent status: 546 tests passing across 114 test files (100% pass rate)
Code Quality
Section titled “Code Quality”npm run lint # Astro checknpm run typecheck # TypeScript checknpm run test # Test suiteCommit Messages
Section titled “Commit Messages”We follow Conventional Commits:
feat: add new login pagefix: resolve crash on startupdocs: update troubleshooting guiderefactor: simplify permission checktest: add coverage for merge queue
Submitting a Pull Request
Section titled “Submitting a Pull Request”- Fork the repository
- Create a feature branch:
git checkout -b feat/my-feature - Make your changes with tests
- Run
npm run testandnpm run typecheckto verify - Commit with a conventional commit message
- Push to your fork
- Open a Pull Request against
main - Wait for CI checks to pass
Project Structure
Section titled “Project Structure”src/├── pages/ # Astro file-based routing│ ├── api/ # REST API routes (175+ endpoints)│ └── [owner]/[repo]/ # Repository pages├── lib/ # Core business logic (130+ modules)├── db/ # Database layer (Drizzle ORM)│ ├── schema/ # 38 schema table definitions│ └── index.ts # DB connection factory├── components/ # React components├── runner/ # CI runner (Docker executor)└── middleware.ts # Auth, rate limit, CSRF
cli/├── src/commands/ # CLI command groups (20+)└── src/lib/ # CLI utilities
docs-site/ # This documentation site (Starlight)Areas for Contribution
Section titled “Areas for Contribution”- CI/CD Features: Matrix builds, caching, workflow templates
- Package Registry: npm and Docker registry enhancements
- AI Review: New provider integrations, review quality improvements
- CLI: New commands, better error messages
- Tests: Increase coverage, especially for edge cases
- Documentation: Tutorials, guides, API examples
- Accessibility: WCAG compliance, keyboard navigation
Thank you for helping build OpenCodeHub!