Skip to main content
This guide will help you set up a local development environment for CVAT, enabling you to run the application, make changes, and test your contributions.

Prerequisites

Before setting up CVAT for development, ensure you have:
  • Docker (20.10.0 or higher) and Docker Compose (1.29.0 or higher)
  • Git for version control
  • Python 3.10+ (for SDK/CLI development)
  • Node.js 16+ and Yarn (for frontend development)
  • At least 8GB of RAM and 20GB of disk space
  • Linux, macOS, or Windows with WSL2

Add User to Docker Group (Linux/WSL)

On Debian/Ubuntu systems, add your user to the docker group:
Log out and back in for the changes to take effect.

Cloning the Repository

Clone the CVAT repository and navigate to it:

Running CVAT for Development

CVAT provides a special Docker Compose configuration for development that includes debugging capabilities and hot-reload support.

Start Development Environment

The development environment uses docker-compose.dev.yml which extends the base configuration:
This configuration:
  • Exposes debug ports for backend services (9090-9096)
  • Enables hot-reload for frontend changes
  • Mounts source code directories for live editing
  • Exposes database ports for direct access (PostgreSQL: 5432, Redis: 6379, ClickHouse: 8123)

Accessing the Application

Once the containers are running: Default credentials:
  • Username: admin1
  • Password: See the logs or documentation

Development Ports

The development configuration exposes these debug ports:
  • 9090: Backend server (cvat_server)
  • 9091: Annotation worker
  • 9092: Export worker
  • 9093: Import worker
  • 9094: Quality reports worker
  • 9096: Consensus worker

Database Access

Direct database access is available on:
  • PostgreSQL: localhost:5432
  • Redis (in-memory): localhost:6379
  • Redis (on-disk): localhost:6666
  • ClickHouse: localhost:8123
  • OPA: localhost:8181
  • Vector: localhost:8282

Debugging

Backend Debugging

To enable debugging for the backend:
  1. Set the environment variable:
  2. Optionally, make the server wait for debugger connection:
  3. Restart the services:
  4. Connect your debugger to the appropriate port (default: 9090)

Frontend Development

For frontend development with hot-reload:
  1. Navigate to the UI directory:
  2. Install dependencies:
  3. Start the development server:
Changes to frontend code will automatically reload in the browser.

Working with Specific Components

Backend (Django)

The backend code is in the cvat/ directory. To run Django management commands:
Common commands:
  • python manage.py migrate - Run database migrations
  • python manage.py makemigrations - Create new migrations
  • python manage.py shell - Open Django shell
  • python manage.py test - Run Django tests

Frontend (React + TypeScript)

The frontend is organized into several packages:
  • cvat-ui: Main UI application
  • cvat-core: Core business logic and API client
  • cvat-canvas: 2D annotation canvas
  • cvat-canvas3d: 3D annotation canvas
  • cvat-data: Data handling utilities

SDK and CLI

For Python SDK and CLI development:
  1. Install SDK in editable mode:
  2. Install CLI in editable mode:

Running Tests Locally

See the Testing Guide for detailed information on running tests. Quick test commands:

Stopping the Development Environment

To stop all containers:
To also remove volumes (database data):

Troubleshooting

Port Conflicts

If you get port binding errors, ensure no other CVAT instances or services are using the required ports:

Permission Issues

If you encounter permission issues with Docker, verify your user is in the docker group and try restarting your session.

Database Issues

If the database becomes corrupted:

Fresh Start

For a completely fresh start:

Additional Resources

Next Steps

Now that your development environment is set up:
  1. Review the code style guidelines
  2. Learn about writing tests
  3. Explore the system architecture
  4. Create your first pull request