# tiagojafonso/guardioesgardunha2027 architecture

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

- Interactive diagram: https://gitdiagram.com/tiagojafonso/guardioesgardunha2027
- Repository: https://github.com/tiagojafonso/guardioesgardunha2027

## Overview

Guardiões da Gardunha 2027 is a static trail-challenge site. Participants register without an account, receive a personal code, submit GPX-based times, and view rankings; organizers approve entries and manage the challenge. The README documents trails with maps and GPX, private participant data, and periodic synchronization with an on-device cache. The excerpts show the adapter’s Supabase authentication, document API, and polling, and the core’s GPX and scoring functions. The app HTML and SQL schema were not sampled, so links to those capabilities are documented or left unverified.

Main entry points: [`src/app.html`](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html) (Challenge app), [`src/core.js`](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/core.js) (GPX parsing), [`src/adapter.js`](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js) (Identity and codes), [`supabase/schema.sql`](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/supabase/schema.sql) (Challenge database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Challenge site"]
  node_site["Challenge app<br/>[app.html]"]
  node_registration["Registration and codes<br/>[app.html]"]
  node_approval["Entry approval<br/>[app.html]"]
  node_trails["Trails and maps<br/>[app.html]"]
  node_submission["GPX submissions<br/>[app.html]"]
  node_rankings["Rankings<br/>[app.html]"]
  node_organizer_area["Organizer area<br/>[app.html]"]
end

subgraph group_domain["Trail challenge"]
  node_gpx["GPX parsing<br/>[core.js]"]
  node_segment_times["Segment times<br/>[core.js]"]
  node_points["Points and rankings<br/>[core.js]"]
end

subgraph group_client["Browser services"]
  node_identity["Identity and codes<br/>[adapter.js]"]
  node_documents["Document API<br/>[adapter.js]"]
  node_sync["Polling and cache<br/>[adapter.js]"]
  node_configuration["Supabase config<br/>[adapter.js]"]
end

subgraph group_backend["Supabase backend"]
  node_supabase["Supabase services"]
  node_database[("Challenge database<br/>[schema.sql]")]
end

node_participant(("Participant"))
node_organizer(("Organizer"))

node_participant -.->|"uses"| node_site
node_organizer -.->|"uses"| node_site
node_site -.->|"offers"| node_registration
node_site -.->|"supports"| node_approval
node_site -.->|"shows"| node_trails
node_site -.->|"accepts"| node_submission
node_site -.->|"shows"| node_rankings
node_site -.->|"provides"| node_organizer_area
node_submission -.->|"processes"| node_gpx
node_gpx -.->|"detects"| node_segment_times
node_segment_times -.->|"scores"| node_points
node_site -.->|"uses"| node_identity
node_site -.->|"uses"| node_documents
node_configuration -.->|"configures"| node_supabase
node_identity -->|"authenticates"| node_supabase
node_documents -->|"reads and writes"| node_supabase
node_sync -->|"polls"| node_supabase
node_supabase -.->|"stores data"| node_database
node_site -.->|"receives updates"| node_sync

click node_site "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html"
click node_registration "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html"
click node_approval "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html"
click node_trails "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html"
click node_submission "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html"
click node_rankings "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html"
click node_organizer_area "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html"
click node_gpx "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/core.js"
click node_segment_times "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/core.js"
click node_points "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/core.js"
click node_identity "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js"
click node_documents "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js"
click node_sync "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js"
click node_configuration "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js"
click node_database "https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/supabase/schema.sql"

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_site,node_registration,node_approval,node_trails,node_submission,node_rankings,node_organizer_area toneBlue
class node_gpx,node_segment_times,node_points toneAmber
class node_identity,node_documents,node_sync,node_configuration toneMint
class node_supabase,node_database toneRose
class node_participant,node_organizer toneIndigo
```

## Components

### Challenge site

- [Challenge app](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html): `src/app.html`
- [Registration and codes](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html): `src/app.html`
- [Entry approval](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html): `src/app.html`
- [Trails and maps](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html): `src/app.html`
- [GPX submissions](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html): `src/app.html`
- [Rankings](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html): `src/app.html`
- [Organizer area](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/app.html): `src/app.html`

### Trail challenge

- [GPX parsing](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/core.js): `src/core.js`
- [Segment times](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/core.js): `src/core.js`
- [Points and rankings](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/core.js): `src/core.js`

### Browser services

- [Identity and codes](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js): `src/adapter.js`
- [Document API](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js): `src/adapter.js`
- [Polling and cache](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js): `src/adapter.js`
- [Supabase config](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/src/adapter.js): `src/adapter.js`

### Supabase backend

- **Supabase services**
- [Challenge database](https://github.com/tiagojafonso/guardioesgardunha2027/blob/main/supabase/schema.sql): `supabase/schema.sql`

### Other components

- **Participant**
- **Organizer**

## Connections

- Participant → Challenge app: uses (evidence: `README.md`)
- Organizer → Challenge app: uses (evidence: `README.md`)
- Challenge app → Registration and codes: offers (evidence: `README.md`)
- Challenge app → Entry approval: supports (evidence: `README.md`)
- Challenge app → Trails and maps: shows (evidence: `README.md`)
- Challenge app → GPX submissions: accepts (evidence: `README.md`)
- Challenge app → Rankings: shows (evidence: `README.md`)
- Challenge app → Organizer area: provides (evidence: `README.md`)
- GPX submissions → GPX parsing: processes
- GPX parsing → Segment times: detects (evidence: `src/core.js`)
- Segment times → Points and rankings: scores (evidence: `src/core.js`)
- Challenge app → Identity and codes: uses
- Challenge app → Document API: uses
- Supabase config → Supabase services: configures (evidence: `src/adapter.js`)
- Identity and codes → Supabase services: authenticates (evidence: `src/adapter.js`)
- Document API → Supabase services: reads and writes (evidence: `src/adapter.js`)
- Polling and cache → Supabase services: polls (evidence: `src/adapter.js`)
- Supabase services → Challenge database: stores data (evidence: `README.md`)
- Challenge app → Polling and cache: receives updates (evidence: `README.md`)
