# nepovtor/pro-mama-advent architecture

> Architecture diagram of the GitHub repository nepovtor/pro-mama-advent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nepovtor/pro-mama-advent
- Repository: https://github.com/nepovtor/pro-mama-advent

## Overview

PRO MAMA Advent is a seasonal interactive calendar with published gifts and a guide, plus an administrator editor and visit analytics. Visitors open a calendar day, see its available gift, and follow its linked content; the public page also loads published days and reports visits. Administrators authenticate by Telegram code, manage day content and assets, and view statistics. The sampled source supports the frontend and endpoint calls; README documentation supports the analytics design. Other unsampled connections are omitted.

Main entry points: [`supabase/functions/advent-admin/index.ts`](https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/functions/advent-admin/index.ts) (Advent admin API), [`app.js`](https://github.com/nepovtor/pro-mama-advent/blob/main/app.js) (Calendar interactions), [`admin.js`](https://github.com/nepovtor/pro-mama-advent/blob/main/admin.js) (Editor and stats), [`supabase/schema.sql`](https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/schema.sql) (Advent content data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Visitor experience"]
  node_calendar_page["Advent calendar<br/>[index.html]"]
  node_calendar_logic["Calendar interactions<br/>[app.js]"]
  node_guide_page["Guide page<br/>[guide.html]"]
  node_guide_pdf["PDR guide PDF"]
end

subgraph group_admin["Content administration"]
  node_admin_page["Admin interface<br/>[index.html]"]
  node_admin_logic["Editor and stats<br/>[admin.js]"]
end

subgraph group_backend["Backend and data"]
  node_endpoint["Advent admin API<br/>[index.ts]"]
  node_content_db[("Advent content data<br/>[schema.sql]")]
  node_analytics_db[("Visit analytics<br/>[analytics-v2.sql]")]
  node_asset_store[("Gift assets<br/>[schema.sql]")]
end

node_visitor(("Calendar visitor"))
node_admin_user(("Administrator"))
node_telegram["Telegram bot"]

node_visitor -->|"opens"| node_calendar_page
node_calendar_logic -->|"loads published days"| node_content_db
node_calendar_logic -->|"opens gift link"| node_guide_page
node_admin_user -->|"manages content"| node_admin_page
node_admin_logic -->|"sends actions"| node_endpoint
node_endpoint -->|"reads and saves days"| node_content_db
node_endpoint -->|"creates upload link"| node_asset_store
node_admin_logic -->|"uploads assets"| node_asset_store
node_admin_logic -.->|"requests login code"| node_telegram
node_endpoint -->|"records visits"| node_analytics_db
node_endpoint -->|"reads summary"| node_analytics_db
node_calendar_logic -->|"reports visit"| node_endpoint
node_visitor -.->|"reads guide"| node_guide_pdf

click node_calendar_page "https://github.com/nepovtor/pro-mama-advent/blob/main/index.html"
click node_calendar_logic "https://github.com/nepovtor/pro-mama-advent/blob/main/app.js"
click node_guide_page "https://github.com/nepovtor/pro-mama-advent/blob/main/guide.html"
click node_guide_pdf "https://github.com/nepovtor/pro-mama-advent/blob/main/pro-mama-pdr-05.pdf"
click node_admin_page "https://github.com/nepovtor/pro-mama-advent/blob/main/Jessica/index.html"
click node_admin_logic "https://github.com/nepovtor/pro-mama-advent/blob/main/admin.js"
click node_endpoint "https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/functions/advent-admin/index.ts"
click node_content_db "https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/schema.sql"
click node_analytics_db "https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/analytics-v2.sql"
click node_asset_store "https://github.com/nepovtor/pro-mama-advent/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_calendar_page,node_calendar_logic,node_guide_page,node_guide_pdf toneBlue
class node_admin_page,node_admin_logic toneAmber
class node_endpoint,node_content_db,node_analytics_db,node_asset_store toneMint
class node_visitor,node_admin_user,node_telegram toneIndigo
```

## Components

### Visitor experience

- [Advent calendar](https://github.com/nepovtor/pro-mama-advent/blob/main/index.html): `index.html`
- [Calendar interactions](https://github.com/nepovtor/pro-mama-advent/blob/main/app.js): `app.js`
- [Guide page](https://github.com/nepovtor/pro-mama-advent/blob/main/guide.html): `guide.html`
- [PDR guide PDF](https://github.com/nepovtor/pro-mama-advent/blob/main/pro-mama-pdr-05.pdf): `pro-mama-pdr-05.pdf`

### Content administration

- [Admin interface](https://github.com/nepovtor/pro-mama-advent/blob/main/Jessica/index.html): `Jessica/index.html`
- [Editor and stats](https://github.com/nepovtor/pro-mama-advent/blob/main/admin.js): `admin.js`

### Backend and data

- [Advent admin API](https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/functions/advent-admin/index.ts): `supabase/functions/advent-admin/index.ts`
- [Advent content data](https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/schema.sql): `supabase/schema.sql`
- [Visit analytics](https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/analytics-v2.sql): `supabase/analytics-v2.sql`
- [Gift assets](https://github.com/nepovtor/pro-mama-advent/blob/main/supabase/schema.sql): `supabase/schema.sql`

### Other components

- **Calendar visitor**
- **Administrator**
- **Telegram bot**

## Connections

- Calendar visitor → Advent calendar: opens (evidence: `README.md`)
- Calendar interactions → Advent content data: loads published days (evidence: `app.js`)
- Calendar interactions → Guide page: opens gift link (evidence: `app.js`)
- Administrator → Admin interface: manages content
- Editor and stats → Advent admin API: sends actions (evidence: `admin.js`)
- Advent admin API → Advent content data: reads and saves days (evidence: `supabase/functions/advent-admin/index.ts`)
- Advent admin API → Gift assets: creates upload link (evidence: `supabase/functions/advent-admin/index.ts`)
- Editor and stats → Gift assets: uploads assets (evidence: `admin.js`)
- Editor and stats → Telegram bot: requests login code
- Advent admin API → Visit analytics: records visits (evidence: `supabase/functions/advent-admin/index.ts`)
- Advent admin API → Visit analytics: reads summary (evidence: `supabase/functions/advent-admin/index.ts`)
- Calendar interactions → Advent admin API: reports visit (evidence: `app.js`)
- Calendar visitor → PDR guide PDF: reads guide (evidence: `README.md`)
