# yaya1426/mawid-nodejs architecture

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

- Interactive diagram: https://gitdiagram.com/yaya1426/mawid-nodejs
- Repository: https://github.com/yaya1426/mawid-nodejs

## Overview

This is a server-rendered event-management application: organizers sign up or log in, create events, and view attendee lists; visitors browse events and register, with capacity and duplicate-registration checks before confirmation. Express routes dispatch to controllers, which coordinate authentication and event/registration models backed by Prisma and MariaDB. Sessions are persisted through a Prisma session store. The views directory supplies the rendered pages. Relationships reflect the sampled source; unsampled startup and schema details are not expanded.

Main entry points: [`src/prisma.js`](https://github.com/yaya1426/mawid-nodejs/blob/main/src/prisma.js) (Prisma client), [`src/app.js`](https://github.com/yaya1426/mawid-nodejs/blob/main/src/app.js) (Express app), [`src/controllers/auth.controller.js`](https://github.com/yaya1426/mawid-nodejs/blob/main/src/controllers/auth.controller.js) (Auth workflows), [`src/controllers/event.controller.js`](https://github.com/yaya1426/mawid-nodejs/blob/main/src/controllers/event.controller.js) (Event workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Express app<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_event_routes["Event routes<br/>[event.routes.js]"]
  node_views["Rendered pages"]
end

subgraph group_identity["Authentication"]
  node_auth_controller["Auth workflows<br/>[auth.controller.js]"]
  node_auth_guard["Auth guard<br/>[requireAuth.js]"]
  node_session["Session handling<br/>[session.js]"]
  node_user_model["User records<br/>[user.model.js]"]
end

subgraph group_events["Event management"]
  node_event_controller["Event workflows"]
  node_event_model["Event records<br/>[event.model.js]"]
  node_registration_model["Registrations"]
end

subgraph group_persistence["Persistence"]
  node_prisma["Prisma client<br/>[prisma.js]"]
  node_database[("MariaDB database")]
end

node_visitor(("Visitor or organizer"))

node_visitor -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_auth_routes
node_app -->|"mounts routes"| node_event_routes
node_app -->|"installs middleware"| node_session
node_auth_routes -->|"dispatches to"| node_auth_controller
node_event_routes -->|"guards routes"| node_auth_guard
node_event_routes -->|"dispatches to"| node_event_controller
node_auth_controller -->|"reads or creates"| node_user_model
node_auth_controller -.->|"sets or destroys"| node_session
node_auth_controller -->|"renders pages"| node_views
node_event_controller -->|"reads or creates"| node_event_model
node_event_controller -->|"creates or lists"| node_registration_model
node_event_controller -->|"renders pages"| node_views
node_user_model -->|"queries"| node_prisma
node_event_model -->|"queries"| node_prisma
node_registration_model -->|"queries"| node_prisma
node_session -->|"stores sessions"| node_prisma
node_prisma -->|"uses adapter"| node_database

click node_app "https://github.com/yaya1426/mawid-nodejs/blob/main/src/app.js"
click node_auth_routes "https://github.com/yaya1426/mawid-nodejs/blob/main/src/routes/auth.routes.js"
click node_event_routes "https://github.com/yaya1426/mawid-nodejs/blob/main/src/routes/event.routes.js"
click node_views "https://github.com/yaya1426/mawid-nodejs/tree/main/src/views"
click node_auth_controller "https://github.com/yaya1426/mawid-nodejs/blob/main/src/controllers/auth.controller.js"
click node_auth_guard "https://github.com/yaya1426/mawid-nodejs/blob/main/src/middleware/requireAuth.js"
click node_session "https://github.com/yaya1426/mawid-nodejs/blob/main/src/session.js"
click node_user_model "https://github.com/yaya1426/mawid-nodejs/blob/main/src/models/user.model.js"
click node_event_controller "https://github.com/yaya1426/mawid-nodejs/blob/main/src/controllers/event.controller.js"
click node_event_model "https://github.com/yaya1426/mawid-nodejs/blob/main/src/models/event.model.js"
click node_registration_model "https://github.com/yaya1426/mawid-nodejs/blob/main/src/models/registration.model.js"
click node_prisma "https://github.com/yaya1426/mawid-nodejs/blob/main/src/prisma.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_app,node_auth_routes,node_event_routes,node_views toneBlue
class node_auth_controller,node_auth_guard,node_session,node_user_model toneAmber
class node_event_controller,node_event_model,node_registration_model toneMint
class node_prisma,node_database toneRose
class node_visitor toneIndigo
```

## Components

### Web application

- [Express app](https://github.com/yaya1426/mawid-nodejs/blob/main/src/app.js): `src/app.js`
- [Auth routes](https://github.com/yaya1426/mawid-nodejs/blob/main/src/routes/auth.routes.js): `src/routes/auth.routes.js`
- [Event routes](https://github.com/yaya1426/mawid-nodejs/blob/main/src/routes/event.routes.js): `src/routes/event.routes.js`
- [Rendered pages](https://github.com/yaya1426/mawid-nodejs/tree/main/src/views): `src/views`

### Authentication

- [Auth workflows](https://github.com/yaya1426/mawid-nodejs/blob/main/src/controllers/auth.controller.js): `src/controllers/auth.controller.js`
- [Auth guard](https://github.com/yaya1426/mawid-nodejs/blob/main/src/middleware/requireAuth.js): `src/middleware/requireAuth.js`
- [Session handling](https://github.com/yaya1426/mawid-nodejs/blob/main/src/session.js): `src/session.js`
- [User records](https://github.com/yaya1426/mawid-nodejs/blob/main/src/models/user.model.js): `src/models/user.model.js`

### Event management

- [Event workflows](https://github.com/yaya1426/mawid-nodejs/blob/main/src/controllers/event.controller.js): `src/controllers/event.controller.js`
- [Event records](https://github.com/yaya1426/mawid-nodejs/blob/main/src/models/event.model.js): `src/models/event.model.js`
- [Registrations](https://github.com/yaya1426/mawid-nodejs/blob/main/src/models/registration.model.js): `src/models/registration.model.js`

### Persistence

- [Prisma client](https://github.com/yaya1426/mawid-nodejs/blob/main/src/prisma.js): `src/prisma.js`
- **MariaDB database**

### Other components

- **Visitor or organizer**

## Connections

- Visitor or organizer → Express app: sends requests (evidence: `src/app.js`)
- Express app → Auth routes: mounts routes (evidence: `src/app.js`)
- Express app → Event routes: mounts routes (evidence: `src/app.js`)
- Express app → Session handling: installs middleware (evidence: `src/app.js`)
- Auth routes → Auth workflows: dispatches to (evidence: `src/routes/auth.routes.js`)
- Event routes → Auth guard: guards routes (evidence: `src/routes/event.routes.js`)
- Event routes → Event workflows: dispatches to (evidence: `src/routes/event.routes.js`)
- Auth workflows → User records: reads or creates (evidence: `src/controllers/auth.controller.js`)
- Auth workflows → Session handling: sets or destroys
- Auth workflows → Rendered pages: renders pages (evidence: `src/controllers/auth.controller.js`)
- Event workflows → Event records: reads or creates (evidence: `src/controllers/event.controller.js`)
- Event workflows → Registrations: creates or lists (evidence: `src/controllers/event.controller.js`)
- Event workflows → Rendered pages: renders pages (evidence: `src/controllers/event.controller.js`)
- User records → Prisma client: queries (evidence: `src/models/user.model.js`)
- Event records → Prisma client: queries (evidence: `src/models/event.model.js`)
- Registrations → Prisma client: queries (evidence: `src/models/registration.model.js`)
- Session handling → Prisma client: stores sessions (evidence: `src/session.js`)
- Prisma client → MariaDB database: uses adapter (evidence: `src/prisma.js`)
