Local Development Setup
This guide provides detailed instructions for setting up your local Opik development environment. We offer multiple development modes optimized for different workflows.
Quick Start
Choose the approach that best fits your development needs:
Prerequisites
Required Tools
- Docker and Docker Compose - For running infrastructure services
- Java 21 and Maven - For backend development
- Node.js 18+ and npm - For frontend development
- Python 3.8+ and pip - For SDK development
Verify Installation
Development Modes
1. Docker Mode (Full Stack)
Best for: Testing complete system, integration testing, or when you need an environment closest to production.
How It Works
The opik.sh
script manages Docker Compose profiles to start different combinations of services:
- Infrastructure: MySQL, ClickHouse, Redis, MinIO, ZooKeeper
- Backend: Java backend application
- Frontend: React application
- Optional: Guardrails service
Starting Opik in Docker
Available Profiles
Managing Docker Services
Accessing Services
- UI: http://localhost:5173
- Backend API: http://localhost:8080
- MySQL: localhost:3306
- ClickHouse: localhost:8123
- Redis: localhost:6379
2. Local Process Mode (Fast Development)
Best for: Rapid backend and frontend development with instant code reloading.
How It Works
The dev-runner.sh
script:
- Starts infrastructure services in Docker (MySQL, Redis, ClickHouse, etc.)
- Builds backend and runs it as a local process
- Runs frontend with Vite dev server as a local process
- Runs database migrations automatically
Starting Development Environment
Debug Mode
Service Details
Backend Process:
- Port: 8080
- Logs:
/tmp/opik-backend.log
- PID file:
/tmp/opik-backend.pid
- CORS enabled for local frontend
- Auto-built from
apps/opik-backend
Frontend Process:
- Port: 5174
- Logs:
/tmp/opik-frontend.log
- PID file:
/tmp/opik-frontend.pid
- Hot-reload enabled
- Proxies API calls to backend at localhost:8080
Infrastructure (Docker):
- Same services as Docker mode
- Ports mapped for local access
Accessing Services
- UI: http://localhost:5174 (local Vite dev server)
- Backend API: http://localhost:8080
- Infrastructure: Same ports as Docker mode
SDK Configuration
After starting, configure the SDK to use your local instance:
IMPORTANT: You must manually edit ~/.opik.config
to remove /api
from the URL:
Or use environment variables:
3. BE-Only Mode (Backend Development)
Best for: Backend-focused development when you don’t need to modify frontend code.
How It Works
This mode:
- Starts infrastructure services in Docker
- Starts frontend in Docker (pre-built)
- Runs backend as a local process with hot-reload
The frontend in Docker proxies API calls to your local backend process.
Starting BE-Only Mode
Service Details
Backend Process (Local):
- Port: 8080
- Logs:
/tmp/opik-backend.log
- Auto-built and hot-reloadable
Frontend (Docker):
- Port: 5173 (Docker container)
- Pre-built image
- Proxies to localhost:8080
Infrastructure (Docker):
- All infrastructure services
Accessing Services
- UI: http://localhost:5173 (Docker frontend)
- Backend API: http://localhost:8080 (local process)
SDK Configuration
Configure SDK without the manual edit requirement:
Or with environment variables:
4. Infrastructure Only Mode
Best for: SDK development, integration testing, or when you need just the databases.
This gives you access to:
- MySQL on port 3306
- ClickHouse on port 8123
- Redis on port 6379
- MinIO on port 9000
Windows Development
All scripts have PowerShell equivalents for Windows developers.
Docker Mode (Windows)
Local Process Mode (Windows)
Windows-Specific Notes
- Logs location:
$env:TEMP
directory - PID files:
$env:TEMP
directory - Use
Get-Content -Wait
instead oftail -f
for log following - Configuration file:
$env:USERPROFILE\.opik.config
Common Development Tasks
Building Components
Database Migrations
If migrations fail, you may need to clean up:
Viewing Logs
Working with Docker Services
Troubleshooting
Services Won’t Start
Build Failures
Database Connection Issues
Process Management Issues
Clean Slate Restart
Development Workflow Examples
Backend Feature Development
Frontend Feature Development
Full Stack Feature Development
SDK Development
Integration Testing
Performance Tips
- Use local process mode for fastest development cycle
- Use BE-only mode if you’re not changing frontend
- Use
--start
instead of--restart
when dependencies haven’t changed - Enable debug mode only when needed - it increases log verbosity
- Keep Docker images up to date - rebuild periodically with
--build
Best Practices
-
Always run linters before committing:
-
Test migrations locally before committing:
-
Clean up regularly to free disk space:
-
Use debug mode for troubleshooting:
-
Check service status before reporting issues:
Next Steps
- Backend Development Guide - Deep dive into backend development
- Frontend Development Guide - Deep dive into frontend development
- Python SDK Development Guide - SDK contribution guidelines
- Testing Guide - Running and writing tests