Contributing to OmniRoute (ไธญๆ–‡ (็ฎ€ไฝ“))

May 13, 2026 ยท View on GitHub

๐ŸŒ Languages: ๐Ÿ‡บ๐Ÿ‡ธ English ยท ๐Ÿ‡ธ๐Ÿ‡ฆ ar ยท ๐Ÿ‡ง๐Ÿ‡ฌ bg ยท ๐Ÿ‡ง๐Ÿ‡ฉ bn ยท ๐Ÿ‡จ๐Ÿ‡ฟ cs ยท ๐Ÿ‡ฉ๐Ÿ‡ฐ da ยท ๐Ÿ‡ฉ๐Ÿ‡ช de ยท ๐Ÿ‡ช๐Ÿ‡ธ es ยท ๐Ÿ‡ฎ๐Ÿ‡ท fa ยท ๐Ÿ‡ซ๐Ÿ‡ฎ fi ยท ๐Ÿ‡ซ๐Ÿ‡ท fr ยท ๐Ÿ‡ฎ๐Ÿ‡ณ gu ยท ๐Ÿ‡ฎ๐Ÿ‡ฑ he ยท ๐Ÿ‡ฎ๐Ÿ‡ณ hi ยท ๐Ÿ‡ญ๐Ÿ‡บ hu ยท ๐Ÿ‡ฎ๐Ÿ‡ฉ id ยท ๐Ÿ‡ฎ๐Ÿ‡น it ยท ๐Ÿ‡ฏ๐Ÿ‡ต ja ยท ๐Ÿ‡ฐ๐Ÿ‡ท ko ยท ๐Ÿ‡ฎ๐Ÿ‡ณ mr ยท ๐Ÿ‡ฒ๐Ÿ‡พ ms ยท ๐Ÿ‡ณ๐Ÿ‡ฑ nl ยท ๐Ÿ‡ณ๐Ÿ‡ด no ยท ๐Ÿ‡ต๐Ÿ‡ญ phi ยท ๐Ÿ‡ต๐Ÿ‡ฑ pl ยท ๐Ÿ‡ต๐Ÿ‡น pt ยท ๐Ÿ‡ง๐Ÿ‡ท pt-BR ยท ๐Ÿ‡ท๐Ÿ‡ด ro ยท ๐Ÿ‡ท๐Ÿ‡บ ru ยท ๐Ÿ‡ธ๐Ÿ‡ฐ sk ยท ๐Ÿ‡ธ๐Ÿ‡ช sv ยท ๐Ÿ‡ฐ๐Ÿ‡ช sw ยท ๐Ÿ‡ฎ๐Ÿ‡ณ ta ยท ๐Ÿ‡ฎ๐Ÿ‡ณ te ยท ๐Ÿ‡น๐Ÿ‡ญ th ยท ๐Ÿ‡น๐Ÿ‡ท tr ยท ๐Ÿ‡บ๐Ÿ‡ฆ uk-UA ยท ๐Ÿ‡ต๐Ÿ‡ฐ ur ยท ๐Ÿ‡ป๐Ÿ‡ณ vi ยท ๐Ÿ‡จ๐Ÿ‡ณ zh-CN


Thank you for your interest in contributing! This guide covers everything you need to get started.


Development Setup

Prerequisites

  • Node.js >= 18 < 24 (recommended: 22 LTS)
  • npm 10+
  • Git

Clone & Install

git clone https://github.com/diegosouzapw/OmniRoute.git
cd OmniRoute
npm install

Environment Variables

# Create your .env from the template
cp .env.example .env

# Generate required secrets
echo "JWT_SECRET=$(openssl rand -base64 48)" >> .env
echo "API_KEY_SECRET=$(openssl rand -hex 32)" >> .env

Key variables for development:

VariableDevelopment DefaultDescription
PORT20128Server port
NEXT_PUBLIC_BASE_URLhttp://localhost:20128Base URL for frontend
JWT_SECRET(generate above)JWT signing secret
INITIAL_PASSWORDCHANGEMEFirst login password
APP_LOG_LEVELinfoLog verbosity level

Dashboard Settings

The dashboard provides UI toggles for features that can also be configured via environment variables:

Setting LocationToggleDescription
Settings โ†’ AdvancedDebug ModeEnable debug request logs (UI)
Settings โ†’ GeneralSidebar VisibilityShow/hide sidebar sections

These settings are stored in the database and persist across restarts, overriding env var defaults when set.

Running Locally

# Development mode (hot reload)
npm run dev

# Production build
npm run build
npm run start

# Common port configuration
PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run dev

Default URLs:

  • Dashboard: http://localhost:20128/dashboard
  • API: http://localhost:20128/v1

Git Workflow

โš ๏ธ NEVER commit directly to main. Always use feature branches.

git checkout -b feat/your-feature-name
# ... make changes ...
git commit -m "feat: describe your change"
git push -u origin feat/your-feature-name
# Open a Pull Request on GitHub

Branch Naming

PrefixPurpose
feat/New features
fix/Bug fixes
refactor/Code restructuring
docs/Documentation changes
test/Test additions/fixes
chore/Tooling, CI, dependencies

Commit Messages

Follow Conventional Commits:

feat: add circuit breaker for provider calls
fix: resolve JWT secret validation edge case
docs: update SECURITY.md with PII protection
test: add observability unit tests
refactor(db): consolidate rate limit tables

Scopes: db, sse, oauth, dashboard, api, cli, docker, ci, mcp, a2a, memory, skills.


Running Tests

# All tests (unit + vitest + ecosystem + e2e)
npm run test:all

# Single test file (Node.js native test runner โ€” most tests use this)
node --import tsx/esm --test tests/unit/your-file.test.ts

# Vitest (MCP server, autoCombo, cache)
npm run test:vitest

# E2E tests (requires Playwright)
npm run test:e2e

# Protocol clients E2E (MCP transports, A2A)
npm run test:protocols:e2e

# Ecosystem compatibility tests
npm run test:ecosystem

# Coverage (60% min statements/lines/functions/branches)
npm run test:coverage
npm run coverage:report

# Lint + format check
npm run lint
npm run check

Coverage notes:

  • npm run test:coverage measures source coverage for the main unit test suite, excludes tests/**, and includes open-sse/**
  • Pull requests must keep the overall coverage gate at 60% or higher for statements, lines, functions, and branches
  • If a PR changes production code in src/, open-sse/, electron/, or bin/, it must add or update automated tests in the same PR
  • npm run coverage:report prints the detailed file-by-file report from the latest coverage run
  • npm run test:coverage:legacy preserves the older metric for historical comparison
  • See docs/ops/COVERAGE_PLAN.md for the phased coverage improvement roadmap

Pull Request Requirements

Before opening or merging a PR:

  • Run npm run test:unit
  • Run npm run test:coverage
  • Ensure the coverage gate stays at 60%+ for all metrics
  • Include the changed or added test files in the PR description when production code changed
  • Check the SonarQube result on the PR when the project secrets are configured in CI

Current test status: 122 unit test files covering:

  • Provider translators and format conversion
  • Rate limiting, circuit breaker, and resilience
  • Semantic cache, idempotency, progress tracking
  • Database operations and schema (21 DB modules)
  • OAuth flows and authentication
  • API endpoint validation (Zod v4)
  • MCP server tools and scope enforcement
  • Memory and Skills systems

Code Style

  • ESLint โ€” Run npm run lint before committing
  • Prettier โ€” Auto-formatted via lint-staged on commit (2 spaces, semicolons, double quotes, 100 char width, es5 trailing commas)
  • TypeScript โ€” All src/ code uses .ts/.tsx; open-sse/ uses .ts/.js; document with TSDoc (@param, @returns, @throws)
  • No eval() โ€” ESLint enforces no-eval, no-implied-eval, no-new-func
  • Zod validation โ€” Use Zod v4 schemas for all API input validation
  • Naming: Files = camelCase/kebab-case, components = PascalCase, constants = UPPER_SNAKE

Project Structure

src/                        # TypeScript (.ts / .tsx)
โ”œโ”€โ”€ app/                    # Next.js 16 App Router
โ”‚   โ”œโ”€โ”€ (dashboard)/        # Dashboard pages (23 sections)
โ”‚   โ”œโ”€โ”€ api/                # API routes (51 directories)
โ”‚   โ””โ”€โ”€ login/              # Auth pages (.tsx)
โ”œโ”€โ”€ domain/                 # Policy engine (policyEngine, comboResolver, costRules, etc.)
โ”œโ”€โ”€ lib/                    # Core business logic (.ts)
โ”‚   โ”œโ”€โ”€ a2a/                # Agent-to-Agent v0.3 protocol server
โ”‚   โ”œโ”€โ”€ acp/                # Agent Communication Protocol registry
โ”‚   โ”œโ”€โ”€ compliance/         # Compliance policy engine
โ”‚   โ”œโ”€โ”€ db/                 # SQLite database layer (21 modules + 16 migrations)
โ”‚   โ”œโ”€โ”€ memory/             # Persistent conversational memory
โ”‚   โ”œโ”€โ”€ oauth/              # OAuth providers, services, and utilities
โ”‚   โ”œโ”€โ”€ skills/             # Extensible skill framework
โ”‚   โ”œโ”€โ”€ usage/              # Usage tracking and cost calculation
โ”‚   โ””โ”€โ”€ localDb.ts          # Re-export layer only โ€” never add logic here
โ”œโ”€โ”€ middleware/              # Request middleware (promptInjectionGuard)
โ”œโ”€โ”€ mitm/                   # MITM proxy (cert, DNS, target routing)
โ”œโ”€โ”€ shared/
โ”‚   โ”œโ”€โ”€ components/         # React components (.tsx)
โ”‚   โ”œโ”€โ”€ constants/          # Provider definitions (60+), MCP scopes, routing strategies
โ”‚   โ”œโ”€โ”€ utils/              # Circuit breaker, sanitizer, auth helpers
โ”‚   โ””โ”€โ”€ validation/         # Zod v4 schemas
โ””โ”€โ”€ sse/                    # SSE proxy pipeline

open-sse/                   # @omniroute/open-sse workspace
โ”œโ”€โ”€ executors/              # 14 provider-specific request executors
โ”œโ”€โ”€ handlers/               # 11 request handlers (chat, responses, embeddings, images, etc.)
โ”œโ”€โ”€ mcp-server/             # MCP server (25 tools, 3 transports, 10 scopes)
โ”œโ”€โ”€ services/               # 36+ services (combo, autoCombo, rateLimitManager, etc.)
โ”œโ”€โ”€ translator/             # Format translators (OpenAI โ†” Claude โ†” Gemini โ†” Responses โ†” Ollama)
โ”œโ”€โ”€ transformer/            # Responses API transformer
โ””โ”€โ”€ utils/                  # 22 utility modules (stream, TLS, proxy, logging)

electron/                   # Electron desktop app (cross-platform)

tests/
โ”œโ”€โ”€ unit/                   # Node.js test runner (122 test files)
โ”œโ”€โ”€ integration/            # Integration tests
โ”œโ”€โ”€ e2e/                    # Playwright tests
โ”œโ”€โ”€ security/               # Security tests
โ”œโ”€โ”€ translator/             # Translator-specific tests
โ””โ”€โ”€ load/                   # Load tests

docs/                       # Documentation
โ”œโ”€โ”€ ARCHITECTURE.md         # System architecture
โ”œโ”€โ”€ API_REFERENCE.md        # All endpoints
โ”œโ”€โ”€ USER_GUIDE.md           # Provider setup, CLI integration
โ”œโ”€โ”€ TROUBLESHOOTING.md      # Common issues
โ”œโ”€โ”€ MCP-SERVER.md           # MCP server (25 tools)
โ”œโ”€โ”€ A2A-SERVER.md           # A2A agent protocol
โ”œโ”€โ”€ AUTO-COMBO.md           # Auto-combo engine
โ”œโ”€โ”€ CLI-TOOLS.md            # CLI tools integration
โ”œโ”€โ”€ COVERAGE_PLAN.md        # Test coverage improvement plan
โ”œโ”€โ”€ openapi.yaml            # OpenAPI specification
โ””โ”€โ”€ adr/                    # Architecture Decision Records

Adding a New Provider

Step 1: Register Provider Constants

Add to src/shared/constants/providers.ts โ€” Zod-validated at module load.

Step 2: Add Executor (if custom logic needed)

Create executor in open-sse/executors/your-provider.ts extending the base executor.

Step 3: Add Translator (if non-OpenAI format)

Create request/response translators in open-sse/translator/.

Step 4: Add OAuth Config (if OAuth-based)

Add OAuth credentials in src/lib/oauth/constants/oauth.ts and service in src/lib/oauth/services/.

Step 5: Register Models

Add model definitions in open-sse/config/providerRegistry.ts.

Step 6: Add Tests

Write unit tests in tests/unit/ covering at minimum:

  • Provider registration
  • Request/response translation
  • Error handling

Pull Request Checklist

  • Tests pass (npm test)
  • Linting passes (npm run lint)
  • Build succeeds (npm run build)
  • TypeScript types added for new public functions and interfaces
  • No hardcoded secrets or fallback values
  • All inputs validated with Zod schemas
  • CHANGELOG updated (if user-facing change)
  • Documentation updated (if applicable)

Releasing

Releases are managed via the /generate-release workflow. When a new GitHub Release is created, the package is automatically published to npm via GitHub Actions.


Getting Help