This guide provides detailed instructions for setting up your local Opik development environment. We offer multiple development modes optimized for different workflows.
Choose the approach that best fits your development needs:
Working with multiple branches? Opik supports multi-worktree development - run multiple environments simultaneously with automatic port isolation.
Best for: Testing complete system, integration testing, or when you need an environment closest to production.
The opik.sh script manages Docker Compose profiles to start different combinations of services:
Best for: Rapid backend and frontend development with instant code reloading.
The dev-runner.sh script:
Backend Process:
/tmp/opik-<worktree-id>-backend.log/tmp/opik-<worktree-id>-backend.pidapps/opik-backendFrontend Process:
/tmp/opik-<worktree-id>-frontend.log/tmp/opik-<worktree-id>-frontend.pidInfrastructure (Docker):
Port assignments are shown when the environment starts. With multi-worktree support, ports may be offset from the defaults.
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:
If using multi-worktree support, replace 8080 with your actual backend port (shown when the environment starts).
Best for: Backend-focused development when you don’t need to modify frontend code.
This mode:
The frontend in Docker proxies API calls to your local backend process.
Backend Process (Local):
/tmp/opik-backend.logFrontend (Docker):
Infrastructure (Docker):
Configure SDK without the manual edit requirement:
Or with environment variables:
Best for: SDK development, integration testing, or when you need just the databases.
This gives you access to:
Opik supports running multiple development environments simultaneously from different git worktrees. This is useful when you need to work on multiple features or compare branches side-by-side.
Each worktree automatically gets:
The port offset (0-99) is deterministically calculated from an MD5 hash of your project path, ensuring consistent port assignments across restarts.
If you need specific ports (e.g., to use standard ports or avoid conflicts):
The script automatically checks for port conflicts before starting:
Containers are prefixed with the worktree project name:
opik-opik-mysql-1, opik-opik-backend-1opik-feature-xyz-mysql-1, opik-feature-xyz-backend-1Configure the SDK to use your worktree’s backend port (shown when the environment starts):
Or edit ~/.opik.config:
All scripts have PowerShell equivalents for Windows developers.
$env:TEMP directory$env:TEMP directoryGet-Content -Wait instead of tail -f for log following$env:USERPROFILE\.opik.configIf migrations fail, you may need to clean up:
If you have port conflicts from another worktree, you can override the port offset:
--start instead of --restart when dependencies haven’t changed--buildAlways 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:
Opik provides AI coding rules and configurations for editors like Cursor, Codex, and Claude Code. These are stored in .agents/ and can be synced to your editor of choice using Makefile.
make codex keeps .codex linked to .agents and generates AGENTS.override.md plus .agents/generated/codex/rules/*.md so Codex can consume rule content derived from .mdc files.
Install pre-commit hooks to automatically run linting before commits: