Skip to main content

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

1

Fork and Clone the Repository

  1. Fork the Excalidraw repository on GitHub
  2. Clone your fork locally:
  1. Set up the upstream remote to keep your fork in sync:
2

Install Dependencies

Install all project dependencies using Yarn:
This will install dependencies for all packages in the monorepo using Yarn workspaces.
3

Start the Development Server

Start the development server:
The application will be available at http://localhost:3000.
4

Create a Feature Branch

Create a new branch for your changes:

Option 2: CodeSandbox

For quick contributions without local setup:
2

Connect GitHub Account

Sign in with your GitHub account and reload the page if needed.
3

Fork the Sandbox

  1. Navigate to the Git tab on the left side
  2. Click “Fork Sandbox”
  3. Start coding immediately
  4. Commit and create PRs directly from 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:
1

Check Type Safety

This should complete without errors.
2

Run Tests

All tests should pass.
3

Check Code Style

This ensures your code follows the project’s style guidelines.

Git Hooks

Excalidraw uses Husky for Git hooks:
  • Pre-commit: Runs lint-staged to automatically lint and format staged files
  • Staged files are checked with:
    • ESLint for .js, .ts, .tsx files
    • Prettier for .css, .scss, .json, .md, .html, .yml files

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:
  1. Read the Architecture Overview to understand the codebase structure
  2. Review the Contribution Guidelines before making changes
  3. Check the Testing Guide to learn how to write tests

Resources