gitlab-org/gitlab
Project
The unit of GitLab work — owns a Git repository, issues, MRs, CI configuration, packages, and most user-facing surfaces.
Source
app/models/project.rb (the largest model in the codebase), plus extensions:
ee/app/models/ee/project.rb— EE-only behavior.- Dozens of concerns under
app/models/concerns/. - A nested
app/models/projects/namespace for support models.
Key associations
| Association | What it owns |
|---|---|
repository |
The Git repo (via Gitaly) |
wiki |
The wiki repo |
merge_requests, issues, notes |
The issuable graph |
pipelines, builds, runners, runner_projects |
CI |
packages, package_files |
Packages |
container_repositories |
Container images |
releases, tags, protected_branches |
SCM lifecycle |
members, project_namespace.namespace_settings |
Access |
integrations |
70+ integrations |
web_hooks |
Outbound hooks |
audit_events, audit_events_streaming_destination |
Audit |
vulnerabilities, vulnerability_findings, merge_request_approvals (EE) |
Security |
labels, milestones, iterations |
Planning |
Visibility
Projects have visibility levels matching their namespace plus optional override:
private— explicit members only.internal— any logged-in user.public— everyone.
The Gitlab::VisibilityLevel mixin enforces.
Storage layout
Projects use "hashed storage": the on-disk path is @hashed/<sha>/<sha>.git. The mapping is computed from the project ID. This avoids renames on disk when the project moves between groups.
Lifecycle
| State | Triggered by |
|---|---|
| Created | Projects::CreateService |
| Updated | Projects::UpdateService |
| Transferred | Projects::TransferService |
| Forked | Projects::ForkService (creates a fork relation) |
| Imported | Projects::ImportService (and importer pipelines) |
| Archived | Projects::UpdateService setting archived = true |
| Marked for deletion | EE-only delayed deletion |
| Destroyed | Projects::DestroyService |
A "fork" relationship lives in fork_network / fork_network_member.
Key services
| Service | What it does |
|---|---|
Projects::CreateService |
Provisions repo, default branch, README, CI config option |
Projects::ImportService |
Drives the importer pipeline |
Projects::TransferService |
Moves a project between namespaces |
Projects::DestroyService |
Cleans up repo, packages, CI artifacts, ML metadata, etc. |
Projects::HousekeepingService |
Periodic git gc / pack-objects |
Projects::AfterImportService |
Post-import normalization |
Performance hot spots
Project is touched by nearly every request. Common N+1 sources:
- Loading project members in nested loops — use
BatchLoaderand theMemberscopes. - Reading wiki/repo size for project-list pages — cache on
project_statistics. - Computing a project's effective visibility — use the cached
effective_visibility_level.
Related
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.