Welcome Contributors
We appreciate your interest in contributing to OpenTogetherTube! This guide will help you get started with contributing code, documentation, or other improvements.Getting Started
Before contributing:- Set up your development environment
- Familiarize yourself with the architecture
- Read through the testing guide
- Check existing issues and pull requests to avoid duplicate work
Code Style Guidelines
Formatting with Prettier
We use Prettier for consistent code formatting. Run the linter before committing:- Indentation: Tabs (not spaces)
- Tab Width: 4
- Print Width: 100 characters
- Semicolons: Required
- Quotes: Double quotes (no single quotes)
- Trailing Commas: ES5 style
- Arrow Functions: Avoid parentheses when possible
TypeScript Style
Modern JavaScript:- Target: ESNext with ES modules
- Always use
constorlet, nevervar - Prefer arrow functions over function expressions
- Use type imports:
import type { Foo } from "bar"
- Strict null checks enabled
- Avoid using
any- useunknownor proper types - Use Zod for runtime validation
- Leverage TypeScript’s type inference
- Prefer
awaitover.then()chains - Always use
try/catchfor async operations - Handle errors appropriately
Rust Style
For Rust code in thecrates/ directory:
- Follow standard Rust naming conventions
- Use
anyhowfor error handling - Prefer
async/awaitover callbacks - Add documentation comments for public APIs
Import Order
Organize imports in the following order:- Node.js built-ins (e.g.,
node:url,node:http) - External dependencies (e.g.,
axios,lodash) - Internal workspace packages (e.g.,
ott-common/*) - Local project imports
Naming Conventions
| Type | Convention | Example |
|---|---|---|
| Files | kebab-case | room-manager.ts |
| Classes | PascalCase | RoomManager |
| Functions/Variables | camelCase | getVideoInfo |
| Constants | UPPER_SNAKE_CASE | MAX_ROOM_SIZE |
| Types/Interfaces | PascalCase | UserPermissions |
Error Handling
TypeScript:- Use custom exceptions extending
OttExceptionfromott-common/exceptions.js - Always wrap async operations in
try/catch - Use Zod for runtime validation with descriptive error messages
- Log errors with appropriate severity levels
Workspace Commands
Run commands in specific workspaces:ott-server- Backend serverott-client- Frontend clientott-common- Shared codeott-vis- Visualization libraryott-vis-panel- Grafana panel pluginott-vis-datasource- Grafana datasource plugin
Making Changes
Branch Strategy
- Create a feature branch from
master:
- Make your changes and commit frequently with clear messages
- Keep your branch up to date with
master
Commit Messages
Write clear, descriptive commit messages: Format:feat: New featurefix: Bug fixdocs: Documentation changesstyle: Formatting changes (no code changes)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Pull Request Process
- Ensure all tests pass:
- Update documentation if needed
- Push your branch to GitHub
- Create a pull request with a clear description:
- What changes were made
- Why the changes were necessary
- Any related issues
Code Review
- Address review feedback promptly
- Keep discussions focused and professional
- Be open to suggestions and alternative approaches
- Request re-review after making changes
Testing Your Changes
All changes should include appropriate tests. See the testing guide for details. Before submitting:Documentation
If your changes affect user-facing features or developer workflows:- Update relevant documentation
- Add code comments for complex logic
- Include JSDoc comments for public APIs
- Update type definitions if needed
Reporting Issues
When reporting bugs:- Check if the issue already exists
- Use a clear, descriptive title
- Provide steps to reproduce
- Include relevant logs or screenshots
- Specify your environment (OS, Node version, etc.)
Feature Requests
When requesting features:- Explain the use case
- Describe the desired behavior
- Consider implementation complexity
- Discuss alternatives you’ve considered
Community Guidelines
- Be respectful and professional
- Welcome newcomers and help them get started
- Focus on constructive feedback
- Follow the project’s code of conduct
Development Tools
Recommended VSCode Extensions
- ESLint
- Prettier
- Volar (Vue Language Features)
- rust-analyzer
- GitLens
Debugging
VSCode Launch Configuration: The project includes VSCode debug configurations:- Launch Program: Debug the server
- Attach to Process: Attach to a running Node process
License
By contributing to OpenTogetherTube, you agree that your contributions will be licensed under the AGPL-3.0-or-later license.Getting Help
If you need help:- Check existing documentation
- Search closed issues and PRs
- Ask in GitHub Discussions
- Join the community Discord
Recognition
Contributors are recognized in:- The project’s GitHub contributors page
- Release notes for significant contributions
- The project README