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: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 usesdocker-compose.dev.yml which extends the base 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:- Web UI: http://localhost:8080
- API Documentation: http://localhost:8080/api/docs
- Admin Panel: http://localhost:8080/admin
- Username:
admin1 - Password: See the logs or documentation
Development Ports
The development configuration exposes these debug ports:9090: Backend server (cvat_server)9091: Annotation worker9092: Export worker9093: Import worker9094: Quality reports worker9096: 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:-
Set the environment variable:
-
Optionally, make the server wait for debugger connection:
-
Restart the services:
- Connect your debugger to the appropriate port (default: 9090)
Frontend Development
For frontend development with hot-reload:-
Navigate to the UI directory:
-
Install dependencies:
-
Start the development server:
Working with Specific Components
Backend (Django)
The backend code is in thecvat/ directory. To run Django management commands:
python manage.py migrate- Run database migrationspython manage.py makemigrations- Create new migrationspython manage.py shell- Open Django shellpython 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:-
Install SDK in editable mode:
-
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: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:- Review the code style guidelines
- Learn about writing tests
- Explore the system architecture
- Create your first pull request