# grafamadeus/eventhub-be architecture

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

- Interactive diagram: https://gitdiagram.com/grafamadeus/eventhub-be
- Repository: https://github.com/grafamadeus/eventhub-be

## Overview

The source implements an event-management API: users authenticate, discover and manage events, and register for events; users can also view their own events and registrations. Controllers delegate requests to domain services, which access TypeORM entities. The README is generic Nest starter documentation and does not describe these product capabilities. Some module wiring and auth internals are represented only by the source index, so the graph omits unverified links such as guard-to-strategy dispatch.

Main entry points: [`src/events/entities/event.entity.ts`](https://github.com/grafamadeus/eventhub-be/blob/main/src/events/entities/event.entity.ts) (Event record), [`src/events/events.controller.ts`](https://github.com/grafamadeus/eventhub-be/blob/main/src/events/events.controller.ts) (Event routes), [`src/app.module.ts`](https://github.com/grafamadeus/eventhub-be/blob/main/src/app.module.ts) (App wiring), [`src/users/users.service.ts`](https://github.com/grafamadeus/eventhub-be/blob/main/src/users/users.service.ts) (User service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["Application API"]
  node_entry["Nest entry<br/>[main.ts]"]
  node_app["App wiring<br/>[app.module.ts]"]
end

subgraph group_identity["Identity"]
  node_auth_http["Auth routes<br/>[auth.controller.ts]"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_jwt["JWT provider"]
  node_users_http["User routes"]
  node_users["User service<br/>[users.service.ts]"]
  node_jwt_guard["JWT guard<br/>[jwt-auth.guard.ts]"]
  node_current_user["Current user"]
end

subgraph group_events["Events"]
  node_events_http["Event routes"]
  node_events_service["Event service<br/>[events.service.ts]"]
  node_ownership["Ownership guard"]
  node_categories_http["Category routes"]
  node_categories_service["Category service"]
end

subgraph group_attendance["Registrations"]
  node_registration_http["Registration routes"]
  node_registration_service["Registration service"]
end

subgraph group_data["Domain data"]
  node_user_entity[("User record<br/>[user.entity.ts]")]
  node_event_entity[("Event record<br/>[event.entity.ts]")]
  node_category_entity[("Category record")]
  node_registration_entity[("Registration record")]
end

node_client(("API client"))

node_client -->|"authenticates"| node_auth_http
node_client -->|"requests events"| node_events_http
node_client -->|"requests categories"| node_categories_http
node_client -->|"manages signup"| node_registration_http
node_client -->|"views own data"| node_users_http
node_entry -->|"starts"| node_app
node_app -->|"wires"| node_auth_http
node_app -->|"wires"| node_events_http
node_app -->|"wires"| node_registration_http
node_app -->|"wires"| node_categories_http
node_auth_http -->|"delegates"| node_auth
node_auth -->|"creates and looks up"| node_users
node_auth -->|"signs tokens"| node_jwt
node_users_http -->|"delegates"| node_users
node_events_http -->|"delegates"| node_events_service
node_events_http -->|"protects writes"| node_jwt_guard
node_events_http -->|"checks ownership"| node_ownership
node_events_http -->|"reads identity"| node_current_user
node_categories_http -->|"delegates"| node_categories_service
node_categories_http -->|"protects creation"| node_jwt_guard
node_registration_http -->|"delegates"| node_registration_service
node_registration_http -->|"protects signup"| node_jwt_guard
node_registration_http -->|"reads identity"| node_current_user
node_users_http -->|"protects profile views"| node_jwt_guard
node_users_http -->|"reads identity"| node_current_user
node_events_service -->|"queries and saves"| node_event_entity
node_categories_service -->|"uses records"| node_category_entity
node_registration_service -->|"queries and saves"| node_registration_entity
node_registration_service -->|"checks capacity"| node_event_entity
node_users -->|"queries and saves"| node_user_entity
node_users -->|"queries owned events"| node_event_entity
node_users -->|"queries signups"| node_registration_entity
node_ownership -->|"checks event owner"| node_event_entity
node_registration_entity -->|"references"| node_user_entity
node_registration_entity -->|"references"| node_event_entity
node_event_entity -->|"references"| node_category_entity
node_event_entity -->|"references"| node_user_entity

click node_entry "https://github.com/grafamadeus/eventhub-be/blob/main/src/main.ts"
click node_app "https://github.com/grafamadeus/eventhub-be/blob/main/src/app.module.ts"
click node_auth_http "https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/auth.controller.ts"
click node_auth "https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/auth.service.ts"
click node_users_http "https://github.com/grafamadeus/eventhub-be/blob/main/src/users/users.controller.ts"
click node_users "https://github.com/grafamadeus/eventhub-be/blob/main/src/users/users.service.ts"
click node_jwt_guard "https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/jwt-auth.guard.ts"
click node_current_user "https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/current-user.decorator.ts"
click node_events_http "https://github.com/grafamadeus/eventhub-be/blob/main/src/events/events.controller.ts"
click node_events_service "https://github.com/grafamadeus/eventhub-be/blob/main/src/events/events.service.ts"
click node_ownership "https://github.com/grafamadeus/eventhub-be/blob/main/src/common/guards/event-ownership.guard.ts"
click node_categories_http "https://github.com/grafamadeus/eventhub-be/blob/main/src/categories/category.controller.ts"
click node_categories_service "https://github.com/grafamadeus/eventhub-be/blob/main/src/categories/category.service.ts"
click node_registration_http "https://github.com/grafamadeus/eventhub-be/blob/main/src/registration/registration.controller.ts"
click node_registration_service "https://github.com/grafamadeus/eventhub-be/blob/main/src/registration/registration.service.ts"
click node_user_entity "https://github.com/grafamadeus/eventhub-be/blob/main/src/users/entities/user.entity.ts"
click node_event_entity "https://github.com/grafamadeus/eventhub-be/blob/main/src/events/entities/event.entity.ts"
click node_category_entity "https://github.com/grafamadeus/eventhub-be/blob/main/src/categories/entities/categories.entity.ts"
click node_registration_entity "https://github.com/grafamadeus/eventhub-be/blob/main/src/registration/entities/registration.entity.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_entry,node_app,node_client toneBlue
class node_auth_http,node_auth,node_jwt,node_users_http,node_users,node_jwt_guard,node_current_user toneAmber
class node_events_http,node_events_service,node_ownership,node_categories_http,node_categories_service toneMint
class node_registration_http,node_registration_service toneRose
class node_user_entity,node_event_entity,node_category_entity,node_registration_entity toneIndigo
```

## Components

### Application API

- [Nest entry](https://github.com/grafamadeus/eventhub-be/blob/main/src/main.ts): `src/main.ts`
- [App wiring](https://github.com/grafamadeus/eventhub-be/blob/main/src/app.module.ts): `src/app.module.ts`

### Identity

- [Auth routes](https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Authentication](https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- **JWT provider**
- [User routes](https://github.com/grafamadeus/eventhub-be/blob/main/src/users/users.controller.ts): `src/users/users.controller.ts`
- [User service](https://github.com/grafamadeus/eventhub-be/blob/main/src/users/users.service.ts): `src/users/users.service.ts`
- [JWT guard](https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/jwt-auth.guard.ts): `src/auth/jwt-auth.guard.ts`
- [Current user](https://github.com/grafamadeus/eventhub-be/blob/main/src/auth/current-user.decorator.ts): `src/auth/current-user.decorator.ts`

### Events

- [Event routes](https://github.com/grafamadeus/eventhub-be/blob/main/src/events/events.controller.ts): `src/events/events.controller.ts`
- [Event service](https://github.com/grafamadeus/eventhub-be/blob/main/src/events/events.service.ts): `src/events/events.service.ts`
- [Ownership guard](https://github.com/grafamadeus/eventhub-be/blob/main/src/common/guards/event-ownership.guard.ts): `src/common/guards/event-ownership.guard.ts`
- [Category routes](https://github.com/grafamadeus/eventhub-be/blob/main/src/categories/category.controller.ts): `src/categories/category.controller.ts`
- [Category service](https://github.com/grafamadeus/eventhub-be/blob/main/src/categories/category.service.ts): `src/categories/category.service.ts`

### Registrations

- [Registration routes](https://github.com/grafamadeus/eventhub-be/blob/main/src/registration/registration.controller.ts): `src/registration/registration.controller.ts`
- [Registration service](https://github.com/grafamadeus/eventhub-be/blob/main/src/registration/registration.service.ts): `src/registration/registration.service.ts`

### Domain data

- [User record](https://github.com/grafamadeus/eventhub-be/blob/main/src/users/entities/user.entity.ts): `src/users/entities/user.entity.ts`
- [Event record](https://github.com/grafamadeus/eventhub-be/blob/main/src/events/entities/event.entity.ts): `src/events/entities/event.entity.ts`
- [Category record](https://github.com/grafamadeus/eventhub-be/blob/main/src/categories/entities/categories.entity.ts): `src/categories/entities/categories.entity.ts`
- [Registration record](https://github.com/grafamadeus/eventhub-be/blob/main/src/registration/entities/registration.entity.ts): `src/registration/entities/registration.entity.ts`

### Other components

- **API client**

## Connections

- API client → Auth routes: authenticates (evidence: `src/auth/auth.controller.ts`)
- API client → Event routes: requests events (evidence: `src/events/events.controller.ts`)
- API client → Category routes: requests categories (evidence: `src/categories/category.controller.ts`)
- API client → Registration routes: manages signup (evidence: `src/registration/registration.controller.ts`)
- API client → User routes: views own data (evidence: `src/users/users.controller.ts`)
- Nest entry → App wiring: starts (evidence: `src/main.ts`)
- App wiring → Auth routes: wires (evidence: `src/app.module.ts`)
- App wiring → Event routes: wires (evidence: `src/app.module.ts`)
- App wiring → Registration routes: wires (evidence: `src/app.module.ts`)
- App wiring → Category routes: wires (evidence: `src/app.module.ts`)
- Auth routes → Authentication: delegates (evidence: `src/auth/auth.controller.ts`)
- Authentication → User service: creates and looks up (evidence: `src/auth/auth.service.ts`)
- Authentication → JWT provider: signs tokens (evidence: `src/auth/auth.service.ts`)
- User routes → User service: delegates (evidence: `src/users/users.controller.ts`)
- Event routes → Event service: delegates (evidence: `src/events/events.controller.ts`)
- Event routes → JWT guard: protects writes (evidence: `src/events/events.controller.ts`)
- Event routes → Ownership guard: checks ownership (evidence: `src/events/events.controller.ts`)
- Event routes → Current user: reads identity (evidence: `src/events/events.controller.ts`)
- Category routes → Category service: delegates (evidence: `src/categories/category.controller.ts`)
- Category routes → JWT guard: protects creation (evidence: `src/categories/category.controller.ts`)
- Registration routes → Registration service: delegates (evidence: `src/registration/registration.controller.ts`)
- Registration routes → JWT guard: protects signup (evidence: `src/registration/registration.controller.ts`)
- Registration routes → Current user: reads identity (evidence: `src/registration/registration.controller.ts`)
- User routes → JWT guard: protects profile views (evidence: `src/users/users.controller.ts`)
- User routes → Current user: reads identity (evidence: `src/users/users.controller.ts`)
- Event service → Event record: queries and saves (evidence: `src/events/events.service.ts`)
- Category service → Category record: uses records (evidence: `src/categories/category.service.ts`)
- Registration service → Registration record: queries and saves (evidence: `src/registration/registration.service.ts`)
- Registration service → Event record: checks capacity (evidence: `src/registration/registration.service.ts`)
- User service → User record: queries and saves (evidence: `src/users/users.service.ts`)
- User service → Event record: queries owned events (evidence: `src/users/users.service.ts`)
- User service → Registration record: queries signups (evidence: `src/users/users.service.ts`)
- Ownership guard → Event record: checks event owner (evidence: `src/common/guards/event-ownership.guard.ts`)
- Registration record → User record: references (evidence: `src/registration/entities/registration.entity.ts`)
- Registration record → Event record: references (evidence: `src/registration/entities/registration.entity.ts`)
- Event record → Category record: references (evidence: `src/events/entities/event.entity.ts`)
- Event record → User record: references (evidence: `src/events/entities/event.entity.ts`)
