go-gitea/gitea architecture diagram
How go-gitea/gitea is built, drawn from its code at 8cb6fb2 on 2026-11-08 by Plotix's agent.
Data model
Core entities of Gitea (users, orgs, repos, issues, pull requests, actions runs) and how they relate. Read from models/.
Open the picture for full size (SVG).
Parts
- User
id: int64 PK · name: string UQ · email: string · is_admin: bool - Organization
id: int64 PK · name: string UQ · visibility: int - Team
id: int64 PK · org_id: int64 FK · name: string · permission: int - Repository
id: int64 PK · owner_id: int64 FK · name: string · default_branch: string - Issue
id: int64 PK · repo_id: int64 FK · index: int64 · title: string - Pull request
id: int64 PK · issue_id: int64 FK · head_branch: string · base_branch: string - Comment
id: int64 PK · issue_id: int64 FK · poster_id: int64 FK · content: text - Review
id: int64 PK · pull_id: int64 FK · reviewer_id: int64 FK · type: int - Label
id: int64 PK · repo_id: int64 FK · name: string - Action run
id: int64 PK · repo_id: int64 FK · workflow_id: string · status: int
How they connect
- User → Repository
- Organization → Repository
- Organization → Team
- User → Team
- Repository → Issue
- Issue → Pull request
- Issue → Comment
- Pull request → Review
- Issue → Label
- Repository → Action run
Overview
How the single Gitea binary is split: HTTP and Git entry points, the services layer, models, shared modules and storage.
Open the picture for full size (SVG).
Parts
- Developer
- Actions runner
- Web and API routers
HTML pages and REST API · Sessions and auth - Git protocol endpoints
Smart HTTP and LFS · SSH server bridge - Internal hook API
Git hook callbacks · Actions task API - Web frontend
Vue components · Tailwind styles - Services layer
Repo, issue and pull logic · Actions, webhooks, mail - Models
Entities and queries · Schema migrations - Shared modules
Git wrapper and settings · Markup, cache, queue - Task queue
- Git repositories
Bare repos on disk · LFS objects - Database
Relational tables · SQLite, MySQL or PostgreSQL - Git binary
How they connect
- Developer → Web and API routers HTTPS pages and API
- Developer → Git protocol endpoints git clone and push
- Actions runner → Web and API routers task polling API
- Web and API routers → Web frontend
- Web and API routers → Services layer page and API logic
- Git protocol endpoints → Services layer authorize access
- Internal hook API → Services layer hook rules
- Services layer → Models queries
- Models → Database SQL
- Services layer → Task queue enqueue jobs
- Task queue → Services layer worker jobs
- Services layer → Shared modules
- Services layer → Git binary git commands
- Git binary → Git repositories
- Git binary → Internal hook API pre-receive hooks
Git push flow
What happens when a developer pushes over SSH or HTTP: authorization, git receive-pack, the pre-receive and post-receive hooks, then database updates.
Open the picture for full size (SVG).
Parts
- Developer
- Git HTTP/SSH
- Git binary
- Internal hook API
- Services
- Database
- Git repositories
How they connect
- Developer → Git HTTP/SSH git push
- Git HTTP/SSH → Services authorize push
- Services → Database check permissions
- Git HTTP/SSH → Git binary run receive-pack
- Git binary → Internal hook API pre-receive
- Internal hook API → Services check branch protection
- Internal hook API → Git binary allow or reject
- Git binary → Git repositories write refs and objects
- Git binary → Internal hook API post-receive
- Internal hook API → Services update branches, queue actions
- Services → Database save commits and runs
- Git HTTP/SSH → Developer push result
Deployment
A typical self-hosted setup: reverse proxy in front of the Gitea server, its repository volume and database, and an optional Actions runner host.
Open the picture for full size (SVG).
Parts
- Reverse proxy
- Gitea server
gitea binary · app.ini config - Repository volume
Bare git repos · LFS and attachments - Database server
SQLite, MySQL or PostgreSQL - Actions runner host
Runs workflow jobs
How they connect
- Reverse proxy → Gitea server HTTP and Git
- Gitea server → Repository volume git data
- Gitea server → Database server SQL
- Actions runner host → Gitea server task polling
Draw your own repo
Plotix's agent reads your code and draws its architecture, and the diagram warns you when the code moves on.
Try Plotix