# miguel-fnc/eventhub architecture

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

- Interactive diagram: https://gitdiagram.com/miguel-fnc/eventhub
- Repository: https://github.com/miguel-fnc/eventhub

## Overview

EventHub is an event discovery and reservation application. Customers browse future events, register or sign in, reserve seats, review their reservation history, and cancel eligible reservations; administrators publish, edit, inspect, and delete events. The React client calls a Hono API running in a Cloudflare Worker, which reads and updates D1. The Worker also serves the frontend and registers error monitoring. The graph follows the sampled modules and README; Terraform provisioning and CI/deployment automation are outside the runtime workflow shown.

Main entry points: [`backend/src/index.ts`](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/index.ts) (API router and assets), [`backend/src/customer.ts`](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/customer.ts) (Auth and reservations), [`frontend/src/main.tsx`](https://github.com/miguel-fnc/eventhub/blob/develop/frontend/src/main.tsx) (EventHub interface), [`backend/src/admin.ts`](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/admin.ts) (Event administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["EventHub interface<br/>[main.tsx]"]
  node_customerui["Account and reservations<br/>[customer.tsx]"]
  node_adminui["Admin console<br/>[admin.tsx]"]
end

subgraph group_api["Worker API"]
  node_worker["API router and assets<br/>[index.ts]"]
  node_shared["Request helpers<br/>[app.ts]"]
  node_customerapi["Auth and reservations<br/>[customer.ts]"]
  node_adminapi["Event administration<br/>[admin.ts]"]
  node_validation["Input validation<br/>[validation.ts]"]
  node_crypto["Credential and token crypto<br/>[crypto.ts]"]
end

subgraph group_data["Application data"]
  node_d1[("Cloudflare D1")]
  node_assets["Workers Static Assets"]
end

subgraph group_ops["Observability"]
  node_monitoring["Error and trace capture<br/>[monitoring.ts]"]
  node_sentry["Sentry"]
end

node_visitor(("Customer or admin"))

node_visitor -->|"uses"| node_web
node_web -->|"renders"| node_customerui
node_web -->|"renders"| node_adminui
node_web -->|"fetches catalog"| node_worker
node_customerui -->|"calls API"| node_worker
node_adminui -->|"uses API helper"| node_customerui
node_adminui -->|"calls API"| node_worker
node_worker -->|"registers routes"| node_customerapi
node_worker -->|"registers routes"| node_adminapi
node_worker -->|"registers monitoring"| node_monitoring
node_worker -->|"queries health and catalog"| node_d1
node_worker -->|"serves non-API requests"| node_assets
node_customerapi -->|"reads and updates"| node_d1
node_adminapi -->|"reads and updates"| node_d1
node_customerapi -->|"uses request helpers"| node_shared
node_adminapi -->|"uses request helpers"| node_shared
node_customerapi -->|"validates inputs"| node_validation
node_adminapi -->|"validates inputs"| node_validation
node_customerapi -->|"hashes credentials"| node_crypto
node_monitoring -->|"sends errors and traces"| node_sentry

click node_web "https://github.com/miguel-fnc/eventhub/blob/develop/frontend/src/main.tsx"
click node_customerui "https://github.com/miguel-fnc/eventhub/blob/develop/frontend/src/customer.tsx"
click node_adminui "https://github.com/miguel-fnc/eventhub/blob/develop/frontend/src/admin.tsx"
click node_worker "https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/index.ts"
click node_shared "https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/app.ts"
click node_customerapi "https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/customer.ts"
click node_adminapi "https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/admin.ts"
click node_validation "https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/validation.ts"
click node_crypto "https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/crypto.ts"
click node_monitoring "https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/monitoring.ts"

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_web,node_customerui,node_adminui toneBlue
class node_worker,node_shared,node_customerapi,node_adminapi,node_validation,node_crypto toneAmber
class node_d1,node_assets toneMint
class node_monitoring,node_sentry toneRose
class node_visitor toneIndigo
```

## Components

### Web client

- [EventHub interface](https://github.com/miguel-fnc/eventhub/blob/develop/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Account and reservations](https://github.com/miguel-fnc/eventhub/blob/develop/frontend/src/customer.tsx): `frontend/src/customer.tsx`
- [Admin console](https://github.com/miguel-fnc/eventhub/blob/develop/frontend/src/admin.tsx): `frontend/src/admin.tsx`

### Worker API

- [API router and assets](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/index.ts): `backend/src/index.ts`
- [Request helpers](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/app.ts): `backend/src/app.ts`
- [Auth and reservations](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/customer.ts): `backend/src/customer.ts`
- [Event administration](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/admin.ts): `backend/src/admin.ts`
- [Input validation](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/validation.ts): `backend/src/validation.ts`
- [Credential and token crypto](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/crypto.ts): `backend/src/crypto.ts`

### Application data

- **Cloudflare D1**
- **Workers Static Assets**

### Observability

- [Error and trace capture](https://github.com/miguel-fnc/eventhub/blob/develop/backend/src/monitoring.ts): `backend/src/monitoring.ts`
- **Sentry**

### Other components

- **Customer or admin**

## Connections

- Customer or admin → EventHub interface: uses (evidence: `frontend/src/main.tsx`)
- EventHub interface → Account and reservations: renders (evidence: `frontend/src/main.tsx`)
- EventHub interface → Admin console: renders (evidence: `frontend/src/main.tsx`)
- EventHub interface → API router and assets: fetches catalog (evidence: `frontend/src/main.tsx`)
- Account and reservations → API router and assets: calls API (evidence: `frontend/src/customer.tsx`)
- Admin console → Account and reservations: uses API helper (evidence: `frontend/src/admin.tsx`)
- Admin console → API router and assets: calls API (evidence: `frontend/src/admin.tsx`)
- API router and assets → Auth and reservations: registers routes (evidence: `backend/src/index.ts`)
- API router and assets → Event administration: registers routes (evidence: `backend/src/index.ts`)
- API router and assets → Error and trace capture: registers monitoring (evidence: `backend/src/index.ts`)
- API router and assets → Cloudflare D1: queries health and catalog (evidence: `backend/src/index.ts`)
- API router and assets → Workers Static Assets: serves non-API requests (evidence: `backend/src/index.ts`)
- Auth and reservations → Cloudflare D1: reads and updates (evidence: `backend/src/customer.ts`)
- Event administration → Cloudflare D1: reads and updates (evidence: `backend/src/admin.ts`)
- Auth and reservations → Request helpers: uses request helpers (evidence: `backend/src/customer.ts`)
- Event administration → Request helpers: uses request helpers (evidence: `backend/src/admin.ts`)
- Auth and reservations → Input validation: validates inputs (evidence: `backend/src/customer.ts`)
- Event administration → Input validation: validates inputs (evidence: `backend/src/admin.ts`)
- Auth and reservations → Credential and token crypto: hashes credentials (evidence: `backend/src/customer.ts`)
- Error and trace capture → Sentry: sends errors and traces (evidence: `backend/src/monitoring.ts`)
