Prerequisites
Before you begin, ensure you have the following installed:- Node.js: Version 20-22 (we recommend using nvm to manage Node versions)
- Yarn: Version 4 (package manager)
- Redis: For storing room state and user sessions
- Rust toolchain: Required for building the load balancer (optional for monolith-only development)
- Git: For version control
- GitHub CLI: Recommended for creating pull requests
Setup Methods
There are two ways to set up your development environment:- Local machine setup (recommended) - Faster and more responsive
- Dev containers - Isolated environment using Docker
Local Machine Setup
Local Machine Setup
Linux/WSL Dependencies
If you’re using Ubuntu or a Debian-based system, install the required system dependencies:Installation Steps
- Clone the repository:
- Enable Yarn and install dependencies:
- Copy the example configuration file:
-
(Optional) Add API keys to
env/development.toml:- Create a project on Google Cloud Console
- Enable “YouTube Data API v3” and “Google Drive API”
- Obtain API keys and add them to your configuration file
- Initialize the database:
- Install and start Redis:
Dev Container Setup
Dev Container Setup
Using Visual Studio Code and Docker, you can set up a consistent development environment:
- Install VSCode and Docker
- Install the Dev Containers extension:
ms-vscode-remote.remote-containers - Open the project in VSCode
- Press
Ctrl+Shift+P(orCmd+Shift+Pon macOS) and run Dev Containers: Reopen in Container - Follow steps 3-6 from the Local Machine Setup above
Running the Application
OpenTogetherTube has two main components that run simultaneously:Development Mode
Linux/macOS:Running Components Separately
For debugging with breakpoints: Server:- Using VSCode:
Debug > Select "Launch Program" > Start - Or manually:
yarn workspace ott-server debug
Monorepo Structure
The project uses Yarn workspaces with the following structure:Building the Project
TypeScript/JavaScript
Rust (Load Balancer)
Database Management
Running Migrations
Test Database Setup
Before running tests, initialize the test database:Common Issues
Redis Connection Error
Redis Connection Error
If you see connection errors, ensure Redis is running:
Port Already in Use
Port Already in Use
If port 8080 or 3000 is already in use, you can change the port:
Dependency Installation Issues
Dependency Installation Issues
If you encounter issues installing dependencies:
Next Steps
Now that your environment is set up:- Learn about the system architecture
- Read the contribution guidelines
- Explore testing practices