# yuriigu/arthemis architecture

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

- Interactive diagram: https://gitdiagram.com/yuriigu/arthemis
- Repository: https://github.com/yuriigu/arthemis

## Overview

The tree and sampled code indicate Arthemis is an environmental-project monitoring application: users manage organizations, projects and their related locations, activities and indicators, then record observations. A SvelteKit frontend calls legacy Brain and authentication APIs; a separate Watcher service exposes audit and report-job functionality. The README contains placeholders rather than reliable product documentation, and several integration implementations were not sampled, so those connections are omitted where caller details are uncertain.

Main entry points: [`legacy/front/src/routes/+layout.svelte`](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/%2Blayout.svelte) (Web routes), [`legacy/front/src/lib/server/arthemis-api.ts`](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/lib/server/arthemis-api.ts) (API client), [`legacy/watcher/internal/reports/worker.go`](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/reports/worker.go) (Report workers), [`legacy/watcher/api/main.go`](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/api/main.go) (Watcher API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_routes["Web routes<br/>[+layout.svelte]"]
  node_login["Login actions<br/>[+page.server.ts]"]
  node_orgs["Organization management<br/>[+page.server.ts]"]
  node_projects["Project setup<br/>[+page.server.ts]"]
  node_projectdetail["Project detail<br/>[+page.server.ts]"]
  node_observations["Observation capture<br/>[+page.server.ts]"]
  node_users["User management<br/>[+page.server.ts]"]
  node_search["Search and overview<br/>[+page.server.ts]"]
  node_api_client["API client<br/>[arthemis-api.ts]"]
end

subgraph group_core["Project data API"]
  node_brain["Brain API<br/>[main.go]"]
  node_handlers["Domain handlers"]
  node_models["Domain models"]
  node_brain_db[("Brain database<br/>[connect.go]")]
end

subgraph group_identity["Authentication"]
  node_auth_api["Auth API<br/>[main.go]"]
  node_auth_handlers["Auth handlers"]
  node_auth_db[("Auth database<br/>[connect.go]")]
end

subgraph group_reports["Audit and reports"]
  node_watcher["Watcher API<br/>[main.go]"]
  node_audit["Audit handler<br/>[audit.go]"]
  node_report_handler["Report handlers<br/>[reports.go]"]
  node_worker["Report workers<br/>[worker.go]"]
  node_generator["Report generation<br/>[generator.go]"]
  node_object_store[("MinIO storage<br/>[minio.go]")]
  node_watch_db[("Watcher database<br/>[connect.go]")]
end

node_user(("User"))
node_browser(("Browser user"))

node_user -->|"uses"| node_routes
node_routes -->|"submits login"| node_login
node_login -->|"calls auth"| node_api_client
node_routes -->|"opens"| node_orgs
node_routes -->|"opens"| node_projects
node_routes -->|"opens"| node_observations
node_routes -->|"opens"| node_users
node_routes -->|"opens"| node_search
node_routes -->|"opens"| node_projectdetail
node_orgs -->|"calls"| node_api_client
node_projects -->|"creates records"| node_api_client
node_projectdetail -->|"fetches project"| node_api_client
node_observations -->|"manages observations"| node_api_client
node_users -->|"manages users"| node_api_client
node_search -->|"fetches records"| node_api_client
node_brain -->|"dispatches requests"| node_handlers
node_handlers -->|"reads and writes"| node_brain_db
node_handlers -->|"uses domain types"| node_models
node_auth_api -->|"dispatches requests"| node_auth_handlers
node_auth_handlers -->|"accesses"| node_auth_db
node_watcher -->|"dispatches audit"| node_audit
node_watcher -->|"dispatches reports"| node_report_handler
node_watcher -->|"starts and recovers"| node_worker
node_worker -->|"generates"| node_generator
node_worker -->|"reads and writes jobs"| node_watch_db
node_worker -->|"stores PDFs"| node_object_store
node_report_handler -->|"submits jobs"| node_worker
node_browser -->|"views pages"| node_routes

click node_routes "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/%2Blayout.svelte"
click node_login "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/login/%2Bpage.server.ts"
click node_orgs "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/organizations/%2Bpage.server.ts"
click node_projects "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/projects/%2Bpage.server.ts"
click node_projectdetail "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/projects/%5BprojectId%5D/%2Bpage.server.ts"
click node_observations "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/observations/%2Bpage.server.ts"
click node_users "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/users/%2Bpage.server.ts"
click node_search "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/search/%2Bpage.server.ts"
click node_api_client "https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/lib/server/arthemis-api.ts"
click node_brain "https://github.com/yuriigu/arthemis/blob/main/legacy/brain/api/main.go"
click node_handlers "https://github.com/yuriigu/arthemis/tree/main/legacy/brain/internal/handlers"
click node_models "https://github.com/yuriigu/arthemis/tree/main/legacy/brain/internal/models"
click node_brain_db "https://github.com/yuriigu/arthemis/blob/main/legacy/brain/internal/database/connect.go"
click node_auth_api "https://github.com/yuriigu/arthemis/blob/main/legacy/edge/services/auth/main.go"
click node_auth_handlers "https://github.com/yuriigu/arthemis/tree/main/legacy/edge/services/auth/handlers"
click node_auth_db "https://github.com/yuriigu/arthemis/blob/main/legacy/edge/services/auth/database/connect.go"
click node_watcher "https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/api/main.go"
click node_audit "https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/handlers/audit.go"
click node_report_handler "https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/handlers/reports.go"
click node_worker "https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/reports/worker.go"
click node_generator "https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/reports/generator.go"
click node_object_store "https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/reports/minio.go"
click node_watch_db "https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/database/connect.go"

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_routes,node_login,node_orgs,node_projects,node_projectdetail,node_observations,node_users,node_search,node_api_client,node_user,node_browser toneBlue
class node_brain,node_handlers,node_models,node_brain_db toneAmber
class node_auth_api,node_auth_handlers,node_auth_db toneMint
class node_watcher,node_audit,node_report_handler,node_worker,node_generator,node_object_store,node_watch_db toneRose
```

## Components

### Web application

- [Web routes](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/%2Blayout.svelte): `legacy/front/src/routes/+layout.svelte`
- [Login actions](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/login/%2Bpage.server.ts): `legacy/front/src/routes/login/+page.server.ts`
- [Organization management](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/organizations/%2Bpage.server.ts): `legacy/front/src/routes/organizations/+page.server.ts`
- [Project setup](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/projects/%2Bpage.server.ts): `legacy/front/src/routes/projects/+page.server.ts`
- [Project detail](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/projects/%5BprojectId%5D/%2Bpage.server.ts): `legacy/front/src/routes/projects/[projectId]/+page.server.ts`
- [Observation capture](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/observations/%2Bpage.server.ts): `legacy/front/src/routes/observations/+page.server.ts`
- [User management](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/users/%2Bpage.server.ts): `legacy/front/src/routes/users/+page.server.ts`
- [Search and overview](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/routes/search/%2Bpage.server.ts): `legacy/front/src/routes/search/+page.server.ts`
- [API client](https://github.com/yuriigu/arthemis/blob/main/legacy/front/src/lib/server/arthemis-api.ts): `legacy/front/src/lib/server/arthemis-api.ts`

### Project data API

- [Brain API](https://github.com/yuriigu/arthemis/blob/main/legacy/brain/api/main.go): `legacy/brain/api/main.go`
- [Domain handlers](https://github.com/yuriigu/arthemis/tree/main/legacy/brain/internal/handlers): `legacy/brain/internal/handlers`
- [Domain models](https://github.com/yuriigu/arthemis/tree/main/legacy/brain/internal/models): `legacy/brain/internal/models`
- [Brain database](https://github.com/yuriigu/arthemis/blob/main/legacy/brain/internal/database/connect.go): `legacy/brain/internal/database/connect.go`

### Authentication

- [Auth API](https://github.com/yuriigu/arthemis/blob/main/legacy/edge/services/auth/main.go): `legacy/edge/services/auth/main.go`
- [Auth handlers](https://github.com/yuriigu/arthemis/tree/main/legacy/edge/services/auth/handlers): `legacy/edge/services/auth/handlers`
- [Auth database](https://github.com/yuriigu/arthemis/blob/main/legacy/edge/services/auth/database/connect.go): `legacy/edge/services/auth/database/connect.go`

### Audit and reports

- [Watcher API](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/api/main.go): `legacy/watcher/api/main.go`
- [Audit handler](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/handlers/audit.go): `legacy/watcher/internal/handlers/audit.go`
- [Report handlers](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/handlers/reports.go): `legacy/watcher/internal/handlers/reports.go`
- [Report workers](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/reports/worker.go): `legacy/watcher/internal/reports/worker.go`
- [Report generation](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/reports/generator.go): `legacy/watcher/internal/reports/generator.go`
- [MinIO storage](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/reports/minio.go): `legacy/watcher/internal/reports/minio.go`
- [Watcher database](https://github.com/yuriigu/arthemis/blob/main/legacy/watcher/internal/database/connect.go): `legacy/watcher/internal/database/connect.go`

### Other components

- **User**
- **Browser user**

## Connections

- User → Web routes: uses
- Web routes → Login actions: submits login
- Login actions → API client: calls auth
- Web routes → Organization management: opens
- Web routes → Project setup: opens
- Web routes → Observation capture: opens
- Web routes → User management: opens
- Web routes → Search and overview: opens
- Web routes → Project detail: opens
- Organization management → API client: calls
- Project setup → API client: creates records
- Project detail → API client: fetches project
- Observation capture → API client: manages observations
- User management → API client: manages users
- Search and overview → API client: fetches records
- Brain API → Domain handlers: dispatches requests
- Domain handlers → Brain database: reads and writes
- Domain handlers → Domain models: uses domain types
- Auth API → Auth handlers: dispatches requests
- Auth handlers → Auth database: accesses
- Watcher API → Audit handler: dispatches audit
- Watcher API → Report handlers: dispatches reports
- Watcher API → Report workers: starts and recovers
- Report workers → Report generation: generates
- Report workers → Watcher database: reads and writes jobs
- Report workers → MinIO storage: stores PDFs
- Report handlers → Report workers: submits jobs
- Browser user → Web routes: views pages
