Overview
Gitea is a full-stack web application built with Go on the backend and Vue.js on the frontend. It follows a modular, layered architecture that separates concerns and enables maintainability.Technology Stack
Backend
- Language: Go 1.26+
- Web Framework: Chi router
- ORM: XORM
- Template Engine: Go templates
Frontend
- Framework: Vue.js 3.5+
- Build Tool: Webpack 5
- Language: TypeScript
- Styling: CSS with Tailwind
Database
- PostgreSQL (recommended)
- MySQL / MariaDB
- SQLite3
- MSSQL
Storage
- Local filesystem
- S3-compatible (MinIO, AWS S3)
- Azure Blob Storage
Directory Structure
Layered Architecture
Gitea follows a clean architecture with clear separation of concerns:Layer Responsibilities
Routers Layer
Location:
routers/web/, routers/api/- Handle HTTP requests/responses
- Parse request parameters
- Validate input
- Call service layer
- Render responses (HTML or JSON)
Services Layer
Location:
services/- Implement business logic
- Orchestrate multiple operations
- Handle transactions
- Emit notifications/webhooks
Models Layer
Location:
models/- Define data structures
- Database operations (CRUD)
- Query builders
- Migrations
Key Components
Git Integration
Gitea interacts with Git repositories through:- Native Git: Executes git commands via
modules/git/ - Git LFS: Large file storage support
- Git Hooks: Server-side and client-side hooks
Authentication System
Multiple authentication backends:Database Abstraction
XORM provides database-agnostic queries:Queue System
Asynchronous task processing:Request Flow
Web Request Example
API Request Example
Database Schema
Core database tables:Middleware
Request middleware pipeline:See Also
Database Layer
Deep dive into database architecture
Frontend
Frontend architecture and build system
Contributing
Learn how to contribute
Building
Build Gitea from source