Development Environment Setup
This guide will help you set up Excalidraw for local development and testing.Prerequisites
Before you begin, ensure you have the following installed:- Node.js - Version 18.0.0 or higher
- Yarn - v1.22.22 (specified in package manager)
- Git - For version control
Installation Options
Option 1: Local Setup (Recommended)
Fork and Clone the Repository
- Fork the Excalidraw repository on GitHub
- Clone your fork locally:
- Set up the upstream remote to keep your fork in sync:
Install Dependencies
Install all project dependencies using Yarn:This will install dependencies for all packages in the monorepo using Yarn workspaces.
Start the Development Server
Option 2: CodeSandbox
For quick contributions without local setup:Open in CodeSandbox
Option 3: Docker Compose
For containerized development without Node.js setup:Available Scripts
Development
Package Development
Testing
Code Quality
Cleanup
Setting Up Collaboration Features
To test real-time collaboration locally, you’ll need to set up the Excalidraw collaboration server. Follow the instructions in the collaboration server repository to run it alongside the main application.Verifying Your Setup
After setup, verify everything works:Git Hooks
Excalidraw uses Husky for Git hooks:- Pre-commit: Runs
lint-stagedto automatically lint and format staged files - Staged files are checked with:
- ESLint for
.js,.ts,.tsxfiles - Prettier for
.css,.scss,.json,.md,.html,.ymlfiles
- ESLint for
Troubleshooting
Port Already in Use
If port 3000 is already in use, the dev server will try the next available port. Check your terminal for the actual URL.Dependency Issues
If you encounter dependency-related errors:Type Errors
Make sure your editor is using the workspace TypeScript version:Test Failures
Update snapshots if your changes intentionally affect test outputs:Next Steps
Now that your environment is set up:- Read the Architecture Overview to understand the codebase structure
- Review the Contribution Guidelines before making changes
- Check the Testing Guide to learn how to write tests