# go-gitea/gitea architecture

> Architecture diagram of the GitHub repository go-gitea/gitea, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/go-gitea/gitea
- Repository: https://github.com/go-gitea/gitea
- Video tour (about a minute): https://gitdiagram.com/go-gitea/gitea/video

## Overview

Gitea is a self-hosted, all-in-one development service. The principal workflow begins with a user or Git client reaching the web server, which authenticates the request and coordinates repository, issue, review, project, package, or Actions operations. Results are persisted in the relational database and Git/object storage, then rendered or delivered through the web interface. The graph also preserves documented automation, search, collaboration, administration, migration, and diagnostics capabilities. Several application routes are represented from directory responsibilities; sampled excerpts chiefly confirm persistence, storage, queues, and operational wiring.

Main entry points: [`cmd/web.go`](https://github.com/go-gitea/gitea/blob/main/cmd/web.go) (Web Server), [`models/db/engine.go`](https://github.com/go-gitea/gitea/blob/main/models/db/engine.go) (Database Engine), [`modules/storage/storage.go`](https://github.com/go-gitea/gitea/blob/main/modules/storage/storage.go) (Object Storage Layer), [`modules/actions/workflows.go`](https://github.com/go-gitea/gitea/blob/main/modules/actions/workflows.go) (Actions Workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry And Identity"]
  node_web_entry["Web Server<br/>[web.go]"]
  node_auth_service["Authentication<br/>[common.go]"]
end

subgraph group_collaboration["Code Collaboration"]
  node_repo_domain["Repositories<br/>[repo.go]"]
  node_git_service["Git Operations<br/>[git.go]"]
  node_issue_domain["Issues And Reviews<br/>[issue.go]"]
  node_org_domain["Teams And Organizations<br/>[org.go]"]
  node_project_domain["Project Boards<br/>[project.go]"]
  node_wiki_domain["Repository Wiki<br/>[wiki.go]"]
  node_search_service["Code Search<br/>[indexer.go]"]
end

subgraph group_automation["Automation Delivery"]
  node_actions_service["Actions Workflows<br/>[workflows.go]"]
  node_package_domain["Package Registry<br/>[package.go]"]
  node_webhook_domain["Webhooks<br/>[webhook.go]"]
  node_queue_service["Managed Queues<br/>[manager.go]"]
end

subgraph group_platform["Platform Persistence"]
  node_db_layer["Database Engine<br/>[engine.go]"]
  node_storage_layer["Object Storage Layer<br/>[storage.go]"]
  node_storage_config["Storage Configuration<br/>[storage.go]"]
end

subgraph group_operations["Administration Operations"]
  node_admin_service["Administration<br/>[admin.go]"]
  node_migration_service["Model Migrations<br/>[migrations.go]"]
  node_doctor_service["Storage Doctor<br/>[storage.go]"]
  node_process_service["Process Diagnostics<br/>[manager_process.go]"]
end

node_actor_user(("User"))
node_actor_git(("Git Client"))
node_actor_runner(("Action Runner"))
node_svc_db[("Relational Database")]
node_svc_object[("Object Storage")]
node_svc_email["Mail Provider"]

node_actor_user -->|"sends requests"| node_web_entry
node_actor_git -->|"pushes and fetches"| node_web_entry
node_web_entry -->|"authenticates requests"| node_auth_service
node_web_entry -->|"dispatches repository work"| node_repo_domain
node_web_entry -->|"dispatches collaboration"| node_issue_domain
node_web_entry -->|"dispatches automation"| node_actions_service
node_web_entry -->|"dispatches packages"| node_package_domain
node_web_entry -->|"dispatches organization work"| node_org_domain
node_web_entry -->|"dispatches project work"| node_project_domain
node_web_entry -->|"dispatches wiki work"| node_wiki_domain
node_web_entry -->|"dispatches searches"| node_search_service
node_auth_service -->|"reads and writes"| node_db_layer
node_repo_domain -->|"manages repositories"| node_git_service
node_repo_domain -->|"persists metadata"| node_db_layer
node_git_service -->|"stores Git data"| node_svc_object
node_issue_domain -->|"persists issues"| node_db_layer
node_org_domain -->|"persists memberships"| node_db_layer
node_project_domain -->|"persists boards"| node_db_layer
node_wiki_domain -->|"stores wiki history"| node_git_service
node_search_service -->|"indexes records"| node_db_layer
node_actions_service -->|"queues tasks"| node_queue_service
node_actions_service -->|"stores logs and artifacts"| node_storage_layer
node_actions_service -.->|"dispatches jobs"| node_actor_runner
node_package_domain -->|"stores package blobs"| node_storage_layer
node_package_domain -->|"persists package metadata"| node_db_layer
node_webhook_domain -.->|"sends notifications"| node_svc_email
node_db_layer -->|"executes SQL"| node_svc_db
node_storage_config -->|"configures storage"| node_storage_layer
node_storage_layer -->|"reads and writes objects"| node_svc_object
node_admin_service -->|"manages accounts"| node_auth_service
node_migration_service -->|"migrates schemas"| node_db_layer
node_doctor_service -->|"checks orphaned objects"| node_storage_layer
node_process_service -->|"reports processes"| node_process_service

click node_web_entry "https://github.com/go-gitea/gitea/blob/main/cmd/web.go"
click node_auth_service "https://github.com/go-gitea/gitea/blob/main/modules/auth/common.go"
click node_repo_domain "https://github.com/go-gitea/gitea/blob/main/models/repo/repo.go"
click node_git_service "https://github.com/go-gitea/gitea/blob/main/modules/git/git.go"
click node_issue_domain "https://github.com/go-gitea/gitea/blob/main/models/issues/issue.go"
click node_org_domain "https://github.com/go-gitea/gitea/blob/main/models/organization/org.go"
click node_project_domain "https://github.com/go-gitea/gitea/blob/main/models/project/project.go"
click node_wiki_domain "https://github.com/go-gitea/gitea/blob/main/models/repo/wiki.go"
click node_search_service "https://github.com/go-gitea/gitea/blob/main/modules/indexer/code/indexer.go"
click node_actions_service "https://github.com/go-gitea/gitea/blob/main/modules/actions/workflows.go"
click node_package_domain "https://github.com/go-gitea/gitea/blob/main/models/packages/package.go"
click node_webhook_domain "https://github.com/go-gitea/gitea/blob/main/models/webhook/webhook.go"
click node_queue_service "https://github.com/go-gitea/gitea/blob/main/modules/queue/manager.go"
click node_db_layer "https://github.com/go-gitea/gitea/blob/main/models/db/engine.go"
click node_storage_layer "https://github.com/go-gitea/gitea/blob/main/modules/storage/storage.go"
click node_storage_config "https://github.com/go-gitea/gitea/blob/main/modules/setting/storage.go"
click node_admin_service "https://github.com/go-gitea/gitea/blob/main/cmd/admin.go"
click node_migration_service "https://github.com/go-gitea/gitea/blob/main/modelmigration/migrations.go"
click node_doctor_service "https://github.com/go-gitea/gitea/blob/main/services/doctor/storage.go"
click node_process_service "https://github.com/go-gitea/gitea/blob/main/routers/private/manager_process.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_entry,node_auth_service,node_actor_user,node_actor_git toneBlue
class node_repo_domain,node_git_service,node_issue_domain,node_org_domain,node_project_domain,node_wiki_domain,node_search_service,node_svc_db,node_svc_object toneAmber
class node_actions_service,node_package_domain,node_webhook_domain,node_queue_service toneMint
class node_db_layer,node_storage_layer,node_storage_config toneRose
class node_admin_service,node_migration_service,node_doctor_service,node_process_service,node_actor_runner,node_svc_email toneIndigo
```

## Components

### Entry And Identity

- [Web Server](https://github.com/go-gitea/gitea/blob/main/cmd/web.go): `cmd/web.go`
- [Authentication](https://github.com/go-gitea/gitea/blob/main/modules/auth/common.go): `modules/auth/common.go`

### Code Collaboration

- [Repositories](https://github.com/go-gitea/gitea/blob/main/models/repo/repo.go): `models/repo/repo.go`
- [Git Operations](https://github.com/go-gitea/gitea/blob/main/modules/git/git.go): `modules/git/git.go`
- [Issues And Reviews](https://github.com/go-gitea/gitea/blob/main/models/issues/issue.go): `models/issues/issue.go`
- [Teams And Organizations](https://github.com/go-gitea/gitea/blob/main/models/organization/org.go): `models/organization/org.go`
- [Project Boards](https://github.com/go-gitea/gitea/blob/main/models/project/project.go): `models/project/project.go`
- [Repository Wiki](https://github.com/go-gitea/gitea/blob/main/models/repo/wiki.go): `models/repo/wiki.go`
- [Code Search](https://github.com/go-gitea/gitea/blob/main/modules/indexer/code/indexer.go): `modules/indexer/code/indexer.go`

### Automation Delivery

- [Actions Workflows](https://github.com/go-gitea/gitea/blob/main/modules/actions/workflows.go): `modules/actions/workflows.go`
- [Package Registry](https://github.com/go-gitea/gitea/blob/main/models/packages/package.go): `models/packages/package.go`
- [Webhooks](https://github.com/go-gitea/gitea/blob/main/models/webhook/webhook.go): `models/webhook/webhook.go`
- [Managed Queues](https://github.com/go-gitea/gitea/blob/main/modules/queue/manager.go): `modules/queue/manager.go`

### Platform Persistence

- [Database Engine](https://github.com/go-gitea/gitea/blob/main/models/db/engine.go): `models/db/engine.go`
- [Object Storage Layer](https://github.com/go-gitea/gitea/blob/main/modules/storage/storage.go): `modules/storage/storage.go`
- [Storage Configuration](https://github.com/go-gitea/gitea/blob/main/modules/setting/storage.go): `modules/setting/storage.go`

### Administration Operations

- [Administration](https://github.com/go-gitea/gitea/blob/main/cmd/admin.go): `cmd/admin.go`
- [Model Migrations](https://github.com/go-gitea/gitea/blob/main/modelmigration/migrations.go): `modelmigration/migrations.go`
- [Storage Doctor](https://github.com/go-gitea/gitea/blob/main/services/doctor/storage.go): `services/doctor/storage.go`
- [Process Diagnostics](https://github.com/go-gitea/gitea/blob/main/routers/private/manager_process.go): `routers/private/manager_process.go`

### Other components

- **User**
- **Git Client**
- **Action Runner**
- **Relational Database**
- **Object Storage**
- **Mail Provider**

## Connections

- User → Web Server: sends requests
- Git Client → Web Server: pushes and fetches
- Web Server → Authentication: authenticates requests
- Web Server → Repositories: dispatches repository work
- Web Server → Issues And Reviews: dispatches collaboration
- Web Server → Actions Workflows: dispatches automation
- Web Server → Package Registry: dispatches packages
- Web Server → Teams And Organizations: dispatches organization work
- Web Server → Project Boards: dispatches project work
- Web Server → Repository Wiki: dispatches wiki work
- Web Server → Code Search: dispatches searches
- Authentication → Database Engine: reads and writes
- Repositories → Git Operations: manages repositories
- Repositories → Database Engine: persists metadata
- Git Operations → Object Storage: stores Git data
- Issues And Reviews → Database Engine: persists issues
- Teams And Organizations → Database Engine: persists memberships
- Project Boards → Database Engine: persists boards
- Repository Wiki → Git Operations: stores wiki history
- Code Search → Database Engine: indexes records
- Actions Workflows → Managed Queues: queues tasks
- Actions Workflows → Object Storage Layer: stores logs and artifacts
- Actions Workflows → Action Runner: dispatches jobs
- Package Registry → Object Storage Layer: stores package blobs
- Package Registry → Database Engine: persists package metadata
- Webhooks → Mail Provider: sends notifications
- Database Engine → Relational Database: executes SQL
- Storage Configuration → Object Storage Layer: configures storage
- Object Storage Layer → Object Storage: reads and writes objects
- Administration → Authentication: manages accounts
- Model Migrations → Database Engine: migrates schemas
- Storage Doctor → Object Storage Layer: checks orphaned objects
- Process Diagnostics → Process Diagnostics: reports processes
