--- import MainLayout from '../../layouts/main.astro'; ---
Architecture Overview

Gitea Mirror Architecture

This document provides a comprehensive overview of the Gitea Mirror application architecture, including component diagrams, project structure, and detailed explanations of each part of the system.

System Overview

Gitea Mirror is a web application that automates the mirroring of GitHub repositories to Gitea instances. It provides a user-friendly interface for configuring, monitoring, and managing mirroring operations without requiring users to edit configuration files or run Docker commands.

Technology Stack

{[ { name: 'Astro', desc: 'Web framework for the frontend' }, { name: 'React', desc: 'Component library for interactive UI elements' }, { name: 'Shadcn UI', desc: 'UI component library built on Tailwind CSS' }, { name: 'SQLite', desc: 'Database for storing configuration, state, and events' }, { name: 'Bun', desc: 'Runtime environment for the backend' }, { name: 'Drizzle ORM', desc: 'Type-safe ORM for database interactions' } ].map(tech => (
{tech.name}

{tech.desc}

))}

Architecture Diagram

Gitea Mirror System

{[ { icon: '🎨', name: 'Frontend', tech: 'Astro + React' }, { icon: '⚙️', name: 'Backend', tech: 'Bun Runtime' }, { icon: '🗄️', name: 'Database', tech: 'SQLite + Drizzle' } ].map((component, index) => ( <>
{component.icon}

{component.name}

{component.tech}

{index < 2 && (
)} ))}

External APIs

🐙

GitHub API

Repository Data Source

🍵

Gitea API

Mirror Destination

Data Flow
Backend APIs

Component Breakdown

Frontend (Astro + React)

The frontend is built with Astro, a modern web framework that allows for server-side rendering and partial hydration. React components are used for interactive elements, providing a responsive and dynamic user interface.

Key Frontend Components

{[ { name: 'Dashboard', desc: 'Overview of mirroring status and recent activity' }, { name: 'Repository Management', desc: 'Interface for managing repositories to mirror' }, { name: 'Organization Management', desc: 'Interface for managing GitHub organizations' }, { name: 'Configuration', desc: 'Settings for GitHub and Gitea connections' }, { name: 'Activity Log', desc: 'Detailed log of mirroring operations' } ].map(component => (
{component.name}

{component.desc}

))}

Backend (Bun)

The backend is built with Bun and provides API endpoints for the frontend to interact with. It handles:

{[ 'Authentication and user management', 'GitHub API integration', 'Gitea API integration', 'Mirroring operations', 'Database interactions' ].map(item => (
{item}
))}

Database (SQLite + Drizzle ORM)

SQLite with Bun's native SQLite driver is used for data persistence, with Drizzle ORM providing type-safe database interactions. The database stores:

{[ 'User accounts and authentication data', 'GitHub and Gitea configuration', 'Repository and organization information', 'Mirroring job history and status', 'Event notifications and their read status' ].map(item => (
{item}
))}

Data Flow

    {[ { title: 'User Authentication', desc: 'Users authenticate through the frontend, which communicates with the backend to validate credentials.' }, { title: 'Configuration', desc: 'Users configure GitHub and Gitea settings through the UI, which are stored in the SQLite database.' }, { title: 'Repository Discovery', desc: 'The backend queries the GitHub API to discover repositories based on user configuration.' }, { title: 'Mirroring Process', desc: 'When triggered, the backend fetches repository data from GitHub and pushes it to Gitea.' }, { title: 'Status Tracking', desc: 'All operations are logged in the database and displayed in the Activity Log.' } ].map((step, index) => (
  1. {index + 1}
    {step.title}

    {step.desc}

  2. ))}

Project Structure

{`gitea-mirror/
├── src/                  # Source code
│   ├── components/       # React components
│   ├── content/          # Documentation and content
│   ├── layouts/          # Astro layout components
│   ├── lib/              # Utility functions and database
│   ├── pages/            # Astro pages and API routes
│   └── styles/           # CSS and Tailwind styles
├── public/               # Static assets
├── data/                 # Database and persistent data
├── docker/               # Docker configuration
└── scripts/              # Utility scripts for deployment and maintenance
    ├── gitea-mirror-lxc-local.sh    # Local LXC deployment script
    └── manage-db.ts                 # Database management tool`}

Deployment Options

Gitea Mirror supports multiple deployment options:

{[ { icon: '🐳', name: 'Docker', desc: 'Run as a containerized application using Docker and docker-compose' }, { icon: '📦', name: 'LXC Containers', desc: 'Deploy in Linux Containers on Proxmox VE or local workstations' }, { icon: '🏃', name: 'Native', desc: 'Run directly on the host system using Bun runtime' } ].map(option => (
{option.icon}

{option.name}

{option.desc}

))}

Deployment Advantages

Docker: Isolation, easy updates, consistent environment
LXC: Lightweight virtualization, better performance than Docker, system-level isolation
Native: Best performance, direct access to system resources

Note: LXC deployment includes a community script by Tobias/CrazyWolf13