# alexcovolan/vigia-farm architecture

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

- Interactive diagram: https://gitdiagram.com/alexcovolan/vigia-farm
- Repository: https://github.com/alexcovolan/vigia-farm

## Overview

Vigia Farm is a Mu Online farm-management web app. Players use a browser dashboard to manage characters and their resources, inspect resource totals, maintain hunting spots, and configure classes and maps; the frontend calls a FastAPI backend that persists records in MySQL. Character CRUD and the frontend’s character API calls are visible in the excerpts. Spots and configuration are documented capabilities, but their frontend implementation was not sampled; those links are therefore left unasserted.

Main entry points: [`frontend/js/personagens.js`](https://github.com/alexcovolan/vigia-farm/blob/main/frontend/js/personagens.js) (Characters and resources), [`backend/models.py`](https://github.com/alexcovolan/vigia-farm/blob/main/backend/models.py) (Domain ORM models), [`backend/main.py`](https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py) (Class and map endpoints), [`backend/database.py`](https://github.com/alexcovolan/vigia-farm/blob/main/backend/database.py) (Database engine and sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser interface"]
  node_dashboard["Web dashboard<br/>[index.html]"]
end

subgraph group_domain["Farm management"]
  node_character_ui["Characters and resources<br/>[personagens.js]"]
  node_resource_audit["Resource X-ray<br/>[personagens.js]"]
  node_backup["Character backup<br/>[personagens.js]"]
  node_spot_management["Spot management"]
  node_class_map_config["Class and map config"]
end

subgraph group_backend["API and persistence"]
  node_character_api["Character endpoints<br/>[main.py]"]
  node_spot_api["Spot endpoints<br/>[main.py]"]
  node_class_map_api["Class and map endpoints<br/>[main.py]"]
  node_startup_seed["Default class/map seeding<br/>[main.py]"]
  node_request_schemas["Request and response schemas<br/>[schemas.py]"]
  node_orm_models["Domain ORM models<br/>[models.py]"]
  node_db_sessions["Database engine and sessions<br/>[database.py]"]
end

subgraph group_external["External services"]
  node_mysql[("MySQL database")]
end

node_user(("Farm manager"))

node_user -->|"uses"| node_dashboard
node_dashboard -.->|"loads"| node_character_ui
node_character_ui -->|"requests characters"| node_character_api
node_character_ui -->|"fetches options"| node_class_map_api
node_resource_audit -->|"inspects character data"| node_character_ui
node_backup -->|"exports character data"| node_character_ui
node_spot_management -.->|"manages spots"| node_spot_api
node_class_map_config -.->|"manages options"| node_class_map_api
node_character_api -->|"validates and responds"| node_request_schemas
node_character_api -->|"queries and persists"| node_orm_models
node_spot_api -->|"validates requests"| node_request_schemas
node_spot_api -->|"queries and persists"| node_orm_models
node_class_map_api -->|"validates and responds"| node_request_schemas
node_class_map_api -->|"queries and persists"| node_orm_models
node_startup_seed -->|"seeds defaults"| node_orm_models
node_startup_seed -->|"opens session"| node_db_sessions
node_orm_models -->|"uses base"| node_db_sessions
node_db_sessions -->|"connects to"| node_mysql

click node_dashboard "https://github.com/alexcovolan/vigia-farm/blob/main/frontend/index.html"
click node_character_ui "https://github.com/alexcovolan/vigia-farm/blob/main/frontend/js/personagens.js"
click node_resource_audit "https://github.com/alexcovolan/vigia-farm/blob/main/frontend/js/personagens.js"
click node_backup "https://github.com/alexcovolan/vigia-farm/blob/main/frontend/js/personagens.js"
click node_spot_management "https://github.com/alexcovolan/vigia-farm/tree/main/frontend"
click node_class_map_config "https://github.com/alexcovolan/vigia-farm/tree/main/frontend"
click node_character_api "https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py"
click node_spot_api "https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py"
click node_class_map_api "https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py"
click node_startup_seed "https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py"
click node_request_schemas "https://github.com/alexcovolan/vigia-farm/blob/main/backend/schemas.py"
click node_orm_models "https://github.com/alexcovolan/vigia-farm/blob/main/backend/models.py"
click node_db_sessions "https://github.com/alexcovolan/vigia-farm/blob/main/backend/database.py"

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_dashboard toneBlue
class node_character_ui,node_resource_audit,node_backup,node_spot_management,node_class_map_config toneAmber
class node_character_api,node_spot_api,node_class_map_api,node_startup_seed,node_request_schemas,node_orm_models,node_db_sessions toneMint
class node_mysql toneRose
class node_user toneIndigo
```

## Components

### Browser interface

- [Web dashboard](https://github.com/alexcovolan/vigia-farm/blob/main/frontend/index.html): `frontend/index.html`

### Farm management

- [Characters and resources](https://github.com/alexcovolan/vigia-farm/blob/main/frontend/js/personagens.js): `frontend/js/personagens.js`
- [Resource X-ray](https://github.com/alexcovolan/vigia-farm/blob/main/frontend/js/personagens.js): `frontend/js/personagens.js`
- [Character backup](https://github.com/alexcovolan/vigia-farm/blob/main/frontend/js/personagens.js): `frontend/js/personagens.js`
- [Spot management](https://github.com/alexcovolan/vigia-farm/tree/main/frontend): `frontend`
- [Class and map config](https://github.com/alexcovolan/vigia-farm/tree/main/frontend): `frontend`

### API and persistence

- [Character endpoints](https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py): `backend/main.py`
- [Spot endpoints](https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py): `backend/main.py`
- [Class and map endpoints](https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py): `backend/main.py`
- [Default class/map seeding](https://github.com/alexcovolan/vigia-farm/blob/main/backend/main.py): `backend/main.py`
- [Request and response schemas](https://github.com/alexcovolan/vigia-farm/blob/main/backend/schemas.py): `backend/schemas.py`
- [Domain ORM models](https://github.com/alexcovolan/vigia-farm/blob/main/backend/models.py): `backend/models.py`
- [Database engine and sessions](https://github.com/alexcovolan/vigia-farm/blob/main/backend/database.py): `backend/database.py`

### External services

- **MySQL database**

### Other components

- **Farm manager**

## Connections

- Farm manager → Web dashboard: uses (evidence: `readme.md`)
- Web dashboard → Characters and resources: loads
- Characters and resources → Character endpoints: requests characters (evidence: `frontend/js/personagens.js`)
- Characters and resources → Class and map endpoints: fetches options (evidence: `frontend/js/personagens.js`)
- Resource X-ray → Characters and resources: inspects character data (evidence: `frontend/js/personagens.js`)
- Character backup → Characters and resources: exports character data (evidence: `frontend/js/personagens.js`)
- Spot management → Spot endpoints: manages spots
- Class and map config → Class and map endpoints: manages options
- Character endpoints → Request and response schemas: validates and responds (evidence: `backend/main.py`)
- Character endpoints → Domain ORM models: queries and persists (evidence: `backend/main.py`)
- Spot endpoints → Request and response schemas: validates requests (evidence: `backend/main.py`)
- Spot endpoints → Domain ORM models: queries and persists (evidence: `backend/main.py`)
- Class and map endpoints → Request and response schemas: validates and responds (evidence: `backend/main.py`)
- Class and map endpoints → Domain ORM models: queries and persists (evidence: `backend/main.py`)
- Default class/map seeding → Domain ORM models: seeds defaults (evidence: `backend/main.py`)
- Default class/map seeding → Database engine and sessions: opens session (evidence: `backend/main.py`)
- Domain ORM models → Database engine and sessions: uses base (evidence: `backend/models.py`)
- Database engine and sessions → MySQL database: connects to (evidence: `backend/database.py`)
