| layout | default |
|---|---|
| title | Contributing — WebRTC |
| description | WebRTC project contribution guidelines, code standards, and spec-driven workflow |
[← Back to Home]({{ site.baseurl }}/)
Thank you for your interest in contributing! This project follows Spec-Driven Development (SDD). The /specs directory is the Single Source of Truth.
- Spec-Driven Development Workflow
- How to Participate in Spec Writing
- Development Workflow
- Development Environment
- Testing & Quality
- Code Standards
- Commit Convention
This project uses the /specs directory as the Single Source of Truth:
| Directory | Purpose |
|---|---|
/specs/product/ |
Product feature definitions and acceptance criteria |
/specs/rfc/ |
Technical design documents and architecture decisions |
/specs/api/ |
API interface definitions (OpenAPI signaling spec) |
/specs/db/ |
Storage schema specifications |
/specs/testing/ |
BDD test specifications |
- Read the relevant spec in
/specs/(product specs, RFCs, API definitions) - If the feature doesn't exist in specs, propose a spec update first
- Wait for spec approval before implementing
| Step | Action | Description |
|---|---|---|
| 1. Review Specs | Read /specs/ |
Understand existing definitions before coding |
| 2. Spec-First Update | Update spec first | For new features or interface changes, update spec before code |
| 3. Implementation | Write code | Code must 100% comply with spec definitions |
| 4. Test Against Spec | Write tests | Cover all acceptance criteria from spec |
See AGENTS.md for the complete AI/human workflow.
-
Create a Product Spec in
/specs/product/with:- Feature description
- User stories
- Acceptance criteria
- State diagrams (if applicable)
-
Create an RFC in
/specs/rfc/with:- Technical approach
- Architecture decisions
- Trade-offs considered
- Security implications
-
Update API Spec in
/specs/api/if the feature adds/modifies:- WebSocket message types
- HTTP endpoints
- Data structures
- Reference the relevant spec that defines expected behavior
- Identify the gap between spec and implementation
- Decide: Should the spec change, or should the code?
- Open a Pull Request with spec changes
- Maintainers review for:
- Completeness
- Consistency with existing specs
- Technical feasibility
- Once approved, implementation can begin
# Fork the repository on GitHub
git clone https://github.com/YOUR_USERNAME/webrtc.git
cd webrtc
git checkout -b feature/your-feature- Read relevant specs in
/specs/ - Update specs if needed (spec-first!)
- Implement code following spec definitions
- Write tests based on acceptance criteria
git add .
git commit -m "feat: add your feature"
git push origin feature/your-feature- Reference any spec changes in your PR description
- Ensure all CI checks pass
- Link to relevant issues
| Requirement | Version |
|---|---|
| Go | 1.22+ |
| Browser | Chrome 90+ / Firefox 88+ / Safari 14+ |
| golangci-lint | Latest (optional, for local lint) |
go mod tidy
go run ./cmd/server
# Visit http://localhost:8080Before submitting, ensure all checks pass:
# Build
go build ./...
# Unit tests (with race detector on Linux/macOS)
go test -race -count=1 ./...
# Static analysis
go vet ./...
# Lint (requires golangci-lint)
golangci-lint runCI automatically runs:
- golangci-lint (11 linters)
- Multi-version Go tests
- staticcheck
- Follow
gofmtformatting - Pass
go vetchecks - Comply with
.golangci.ymllint rules - Use tabs for indentation
- US English spelling
- 2-space indentation (see
.editorconfig) - Vanilla JavaScript only (no frameworks)
- ES6+ features allowed
'use strict'at module level
- Keep implementations simple
- No gold-plating (only implement what's in the spec)
- Document public APIs
Use Conventional Commits:
| Prefix | Usage |
|---|---|
feat: |
New feature |
fix: |
Bug fix |
docs: |
Documentation update |
refactor: |
Code refactoring |
test: |
Adding/updating tests |
chore: |
Build/tooling changes |
feat: add screen sharing support
fix: resolve ICE candidate ordering issue
docs: update deployment guide for TURN
refactor: simplify Hub message routing
test: add edge cases for room limits
chore: update golangci-lint config
- Questions? Open a Discussion
- Found a bug? Open an Issue
- Want to understand the architecture? Read the RFCs