# brunomocidade-afk/ingressoamigo architecture

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

- Interactive diagram: https://gitdiagram.com/brunomocidade-afk/ingressoamigo
- Repository: https://github.com/brunomocidade-afk/ingressoamigo

## Overview

Ingresso Amigo is an event ticketing and entry-management application. Buyers can discover events and submit ticket orders; organizers authenticate by emailed code, manage events and orders, and review sales; gate staff validate tickets. The sampled server code confirms these workflows use PostgreSQL and sends login codes through Resend. The public HTML files indicate separate user interfaces, but their client-side behavior was not sampled, so UI-to-API links are left unverified.

Main entry points: [`src/server.js`](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js) (HTTP server), [`src/mailer.js`](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/mailer.js) (Login email sender), [`public/index.html`](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/index.html) (Event browser), [`public/eventos-novo.html`](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/eventos-novo.html) (Event creation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Web interfaces"]
  node_home_ui["Event browser<br/>[index.html]"]
  node_event_ui["Event creation<br/>[eventos-novo.html]"]
  node_login_ui["Organizer login<br/>[login.html]"]
  node_admin_ui["Admin panel<br/>[admin.html]"]
  node_report_ui["Sales report<br/>[relatorio.html]"]
  node_gate_ui["Gate validation<br/>[portaria.html]"]
end

subgraph group_workflows["Application workflows"]
  node_api["HTTP server<br/>[server.js]"]
  node_auth["Code authentication<br/>[server.js]"]
  node_event_catalog["Event catalog<br/>[server.js]"]
  node_orders["Ticket orders<br/>[server.js]"]
  node_event_admin["Event management<br/>[server.js]"]
  node_sales["Sales reporting<br/>[server.js]"]
  node_approval["Manual approval<br/>[server.js]"]
  node_validation["Ticket validation<br/>[server.js]"]
end

subgraph group_storage["Persistence"]
  node_database[("PostgreSQL<br/>[db.js]")]
end

subgraph group_integrations["External services"]
  node_mailer["Login email sender<br/>[mailer.js]"]
  node_resend["Resend"]
end

node_buyer(("Ticket buyer"))
node_organizer(("Event organizer"))
node_gate_staff(("Gate staff"))

node_buyer -.->|"browses"| node_home_ui
node_buyer -.->|"requests tickets"| node_orders
node_organizer -.->|"opens"| node_login_ui
node_organizer -.->|"creates events"| node_event_ui
node_organizer -.->|"manages orders"| node_admin_ui
node_organizer -.->|"reviews sales"| node_report_ui
node_gate_staff -.->|"opens"| node_gate_ui
node_api -->|"queries"| node_database
node_api -->|"sends login code"| node_mailer
node_mailer -->|"sends email"| node_resend
node_api -->|"routes authentication"| node_auth
node_api -->|"routes event listing"| node_event_catalog
node_api -->|"routes order creation"| node_orders
node_api -->|"routes event creation"| node_event_admin
node_api -->|"routes sales report"| node_sales
node_api -->|"routes approval"| node_approval
node_api -->|"routes ticket validation"| node_validation

click node_home_ui "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/index.html"
click node_event_ui "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/eventos-novo.html"
click node_login_ui "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/login.html"
click node_admin_ui "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/admin.html"
click node_report_ui "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/relatorio.html"
click node_gate_ui "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/portaria.html"
click node_api "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_auth "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_event_catalog "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_orders "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_event_admin "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_sales "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_approval "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_validation "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js"
click node_database "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/db.js"
click node_mailer "https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/mailer.js"

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_home_ui,node_event_ui,node_login_ui,node_admin_ui,node_report_ui,node_gate_ui toneBlue
class node_api,node_auth,node_event_catalog,node_orders,node_event_admin,node_sales,node_approval,node_validation toneAmber
class node_database toneMint
class node_mailer,node_resend toneRose
class node_buyer,node_organizer,node_gate_staff toneIndigo
```

## Components

### Web interfaces

- [Event browser](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/index.html): `public/index.html`
- [Event creation](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/eventos-novo.html): `public/eventos-novo.html`
- [Organizer login](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/login.html): `public/login.html`
- [Admin panel](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/admin.html): `public/admin.html`
- [Sales report](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/relatorio.html): `public/relatorio.html`
- [Gate validation](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/public/portaria.html): `public/portaria.html`

### Application workflows

- [HTTP server](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`
- [Code authentication](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`
- [Event catalog](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`
- [Ticket orders](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`
- [Event management](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`
- [Sales reporting](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`
- [Manual approval](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`
- [Ticket validation](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/server.js): `src/server.js`

### Persistence

- [PostgreSQL](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/db.js): `src/db.js`

### External services

- [Login email sender](https://github.com/brunomocidade-afk/ingressoamigo/blob/main/src/mailer.js): `src/mailer.js`
- **Resend**

### Other components

- **Ticket buyer**
- **Event organizer**
- **Gate staff**

## Connections

- Ticket buyer → Event browser: browses
- Ticket buyer → Ticket orders: requests tickets
- Event organizer → Organizer login: opens
- Event organizer → Event creation: creates events
- Event organizer → Admin panel: manages orders
- Event organizer → Sales report: reviews sales
- Gate staff → Gate validation: opens
- HTTP server → PostgreSQL: queries (evidence: `src/server.js`)
- HTTP server → Login email sender: sends login code (evidence: `src/server.js`)
- Login email sender → Resend: sends email (evidence: `src/mailer.js`)
- HTTP server → Code authentication: routes authentication (evidence: `src/server.js`)
- HTTP server → Event catalog: routes event listing (evidence: `src/server.js`)
- HTTP server → Ticket orders: routes order creation (evidence: `src/server.js`)
- HTTP server → Event management: routes event creation (evidence: `src/server.js`)
- HTTP server → Sales reporting: routes sales report (evidence: `src/server.js`)
- HTTP server → Manual approval: routes approval (evidence: `src/server.js`)
- HTTP server → Ticket validation: routes ticket validation (evidence: `src/server.js`)
