repowisego-gitea/gitea

Architecture of go-gitea/gitea

go-gitea/gitea is 3,691 source files holding 23,871 symbols across 14 modules, written mainly in Go, TypeScript, Shell. The largest module is modules, with 1,025 files, and 24 files are entry points into the dependency graph.

How gitea fits together

The cmd directory holds the command-line interface, which registers subcommands, parses global flags, sets up logging and runtime paths, and wires command handlers. The modules directory provides shared building blocks such as configuration access, structured logging, JSON encoding and decoding, and common utilities. The models directory defines the persistence and query layer for domain objects such as issues, repos, users and actions, backed by a shared database engine and session context. The modelmigration directory defines an ordered set of database migration tasks that bring the database schema up to date. The routers directory contains the web and API handlers, for example routers/web/repo/pull.go for pull requests, and the services directory holds the logic they call, such as services/gitdiff/gitdiff.go for diffs. The build directory contains generators like build/generate-openapi.go that produce embedded artifacts from source inputs.

Largest modules

  • modules: 1,025 files and 97,160 lines of code
  • services: 555 files and 83,445 lines of code
  • routers: 474 files and 76,241 lines of code
  • models: 390 files and 55,148 lines of code
  • tests: 376 files and 56,809 lines of code
  • modelmigration: 354 files and 12,871 lines of code
  • web_src: 244 files and 20,132 lines of code
  • cmd: 58 files and 8,649 lines of code

Languages

By file count: Go 3,137 files, TypeScript 269 files, Shell 103 files, Vue 23 files, Makefile 2 files, Dockerfile 1 file.

Documentation

Repowise documents gitea in 4,034 pages generated from the source, 105 of them written explanations of the repository and its modules. Module guides include:

  • routers/api/actions: API Actions Router
  • routers/api: API Overview
  • routers/api/v1/utils: API Utilities Routes

More on gitea: summary and FAQ, codebase overview, code health.

Related guide: Best dependency graph tools for monorepos