Core Concepts
Understand what projects, repositories, services, worktrees, environments, and the main environment mean and how they relate.
A few terms appear throughout Kovra. Understanding them upfront makes the rest of the docs easy to follow.
| Concept | Meaning |
|---|---|
| Project | One or more Git repositories developed together—whether separate frontend, backend, and auth repos, or a single repository. |
| Repository | A Git repository within a project. |
| Service | A runnable process inside a repository, such as a frontend dev server or an API server. |
| Worktree | A checked-out directory of a repository. The repository’s original directory is the main directory; all others are additional worktrees. |
| Environment | A group of services that run together, with one worktree per repository. The one made up of each repository’s main directory is the main environment. |
Repositories in an environment
Each repository in an environment is in one of two states:
- Own: The environment has its own worktree for this repository. Its service runs from that directory on its own port.
- Borrowed from main: The environment has no worktree for this repository and uses the instance running in the main environment instead.
For example, when you only change a frontend branch, the backend can simply be borrowed from the main environment without spinning up a second copy.
Where environments come from
Environments come from three sources:
- Auto-discovery: Kovra detects worktrees created anywhere by any tool and groups them into environments.
- Created in Kovra: See New Environment.
- Manual adjustments: You can change which directory each repository uses or hide an environment at any time.
An environment tracks which directory each repository uses—not the branch name. Switching branches inside an environment will not regroup it, rename it, or drop its running state.
Ports and links
The main environment uses the project’s default configured ports. Services in other environments automatically claim free ports and keep them across restarts. Service-to-service links are resolved per environment, so the frontend in an environment connects to the backend in the same environment. See Ports & Service Links for details.