# shrashti-jain/event-management-app architecture

> Architecture diagram of the GitHub repository shrashti-jain/event-management-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shrashti-jain/event-management-app
- Repository: https://github.com/shrashti-jain/event-management-app

## Overview

#### Purpose and Topology
This is a full-stack event-management application with a React single-page frontend and a Node.js/Express REST backend. Users authenticate, create events, browse events, and view their own events. The frontend starts at `frontend/src/index.js` and renders application routing from `frontend/src/App.js`; the backend starts at `backend/server.js`.

#### Backend HTTP Boundary
Express exposes resource-oriented route modules for authentication, users, and events:
- `backend/routes/auth.js`
- `backend/routes/events.js`
- `backend/routes/users.js`

These routes delegate request handling to controller modules rather than directly accessing persistence, separating HTTP concerns from domain operations:
- `backend/controllers/authController.js`
- `backend/controllers/eventController.js`
- `backend/controllers/userController.js`

#### Identity and Authorization
Authentication is centered on registration/login controller logic and shared request protection middleware. Protected event/user operations pass through `backend/middleware/authMiddleware.js`, which establishes the authenticated caller context used by downstream controllers. The frontend maintains corresponding session/auth state in `frontend/src/context/AuthContext.js`, with login and registration interfaces at `frontend/src/components/Auth/Login.js` and `frontend/src/components/Auth/Register.js`.

#### Persistence Model
MongoDB-style model definitions form the durable domain boundary:
- `backend/models/User.js`
- `backend/models/Event.js`
- `backend/config/db.js`

Controllers read and write these models, with events expected to be associated with their creating/authenticated user. Database connection setup is isolated from HTTP startup in `backend/config/db.js` and consumed by `backend/server.js`.

#### Event Lifecycle
The primary business flow is event creation and retrieval. Event requests enter `backend/routes/events.js`, are handled by `backend/controllers/eventController.js`, and persist/query `backend/models/Event.js`. On the client, event creation is driven by `frontend/src/components/Events/EventForm.js`; listing and owner-scoped views are represented by `frontend/src/components/Events/EventList.js` and `frontend/src/components/Events/MyEvents.js`.

#### Frontend Composition and Navigation
`frontend/src/App.js` composes page-level navigation for home, auth, creation, and personal event views:
- `frontend/src/pages/Home.js`
- `frontend/src/pages/CreateEventPage.js`
- `frontend/src/pages/MyEventsPage.js`

Reusable layout is anchored by `frontend/src/components/Layout/Navbar.js`, which likely reflects authentication state and provides navigation across these flows.

#### Client–Server Integration and Runtime Configuration
Frontend API access is centralized in `frontend/src/services/api.js`, creating the principal boundary between React UI/state and backend REST endpoints. Environment-specific values are supplied separately through `frontend/.env` and `backend/.env`. The application therefore runs as two deployable Node-based processes: a React client build/development runtime and an Express API process connected to the configured database.

Main entry points: [`frontend/src/services/api.js`](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/services/api.js) (API client), [`frontend/src/App.js`](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/App.js) (App routing), [`backend/server.js`](https://github.com/shrashti-jain/event-management-app/blob/master/backend/server.js) (API server), [`backend/middleware/authMiddleware.js`](https://github.com/shrashti-jain/event-management-app/blob/master/backend/middleware/authMiddleware.js) (Auth protection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React client"]
  node_client_entry["Client entry<br/>React bootstrap<br/>[index.js]"]
  node_app["App routing<br/>React app shell<br/>[App.js]"]
  node_auth_context["Auth state<br/>React context<br/>[AuthContext.js]"]
  node_api_client["API client<br/>REST client<br/>[api.js]"]
  node_login["Login UI<br/>React component<br/>[Login.js]"]
  node_register["Registration UI<br/>React component<br/>[Register.js]"]
  node_event_form["Event creation<br/>React component<br/>[EventForm.js]"]
  node_event_list["Event listing<br/>React component<br/>[EventList.js]"]
  node_my_events["My events<br/>React component<br/>[MyEvents.js]"]
end

subgraph group_backend["Express API"]
  node_server["API server<br/>Express startup<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>Express routes<br/>[auth.js]"]
  node_event_routes["Event routes<br/>Express routes<br/>[events.js]"]
  node_user_routes["User routes<br/>Express routes<br/>[users.js]"]
  node_auth_middleware["Auth protection<br/>Express middleware<br/>[authMiddleware.js]"]
  node_auth_controller["Auth controller<br/>[authController.js]"]
  node_event_controller["Event controller<br/>[eventController.js]"]
  node_user_controller["User controller<br/>[userController.js]"]
end

subgraph group_persistence["Persistence"]
  node_db_config["Database connection<br/>Connection setup<br/>[db.js]"]
  node_user_model["User model<br/>MongoDB model<br/>[User.js]"]
  node_event_model["Event model<br/>MongoDB model<br/>[Event.js]"]
end

node_client_entry -->|"renders"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_event_form
node_app -->|"routes to"| node_event_list
node_app -->|"routes to"| node_my_events
node_app -->|"uses"| node_auth_context
node_login -->|"auth requests"| node_api_client
node_register -->|"auth requests"| node_api_client
node_event_form -->|"creates events"| node_api_client
node_event_list -->|"fetches events"| node_api_client
node_my_events -->|"fetches own events"| node_api_client
node_api_client -->|"REST auth"| node_auth_routes
node_api_client -->|"REST events"| node_event_routes
node_api_client -->|"REST users"| node_user_routes
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_event_routes
node_server -->|"mounts"| node_user_routes
node_server -->|"initializes"| node_db_config
node_auth_routes -->|"delegates"| node_auth_controller
node_event_routes -->|"protects requests"| node_auth_middleware
node_user_routes -->|"protects requests"| node_auth_middleware
node_auth_middleware -->|"authorizes then handles"| node_event_controller
node_auth_middleware -->|"authorizes then handles"| node_user_controller
node_auth_controller -->|"reads/writes"| node_user_model
node_user_controller -->|"reads/writes"| node_user_model
node_event_controller -->|"creates/queries"| node_event_model
node_event_controller -->|"uses caller ownership"| node_user_model
node_db_config -->|"connects"| node_user_model
node_db_config -->|"connects"| node_event_model

click node_client_entry "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/index.js"
click node_app "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/App.js"
click node_auth_context "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/context/AuthContext.js"
click node_api_client "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/services/api.js"
click node_login "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Auth/Login.js"
click node_register "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Auth/Register.js"
click node_event_form "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Events/EventForm.js"
click node_event_list "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Events/EventList.js"
click node_my_events "https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Events/MyEvents.js"
click node_server "https://github.com/shrashti-jain/event-management-app/blob/master/backend/server.js"
click node_auth_routes "https://github.com/shrashti-jain/event-management-app/blob/master/backend/routes/auth.js"
click node_event_routes "https://github.com/shrashti-jain/event-management-app/blob/master/backend/routes/events.js"
click node_user_routes "https://github.com/shrashti-jain/event-management-app/blob/master/backend/routes/users.js"
click node_auth_middleware "https://github.com/shrashti-jain/event-management-app/blob/master/backend/middleware/authMiddleware.js"
click node_auth_controller "https://github.com/shrashti-jain/event-management-app/blob/master/backend/controllers/authController.js"
click node_event_controller "https://github.com/shrashti-jain/event-management-app/blob/master/backend/controllers/eventController.js"
click node_user_controller "https://github.com/shrashti-jain/event-management-app/blob/master/backend/controllers/userController.js"
click node_db_config "https://github.com/shrashti-jain/event-management-app/blob/master/backend/config/db.js"
click node_user_model "https://github.com/shrashti-jain/event-management-app/blob/master/backend/models/User.js"
click node_event_model "https://github.com/shrashti-jain/event-management-app/blob/master/backend/models/Event.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_client_entry,node_app,node_auth_context,node_api_client,node_login,node_register,node_event_form,node_event_list,node_my_events toneBlue
class node_server,node_auth_routes,node_event_routes,node_user_routes,node_auth_middleware,node_auth_controller,node_event_controller,node_user_controller toneAmber
class node_db_config,node_user_model,node_event_model toneMint
```

## Components

### React client

- [Client entry](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/index.js): React bootstrap · `frontend/src/index.js`
- [App routing](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/App.js): React app shell · `frontend/src/App.js`
- [Auth state](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/context/AuthContext.js): React context · Maintains client authentication session state. · `frontend/src/context/AuthContext.js`
- [API client](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/services/api.js): REST client · Central client-server integration boundary. · `frontend/src/services/api.js`
- [Login UI](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Auth/Login.js): React component · `frontend/src/components/Auth/Login.js`
- [Registration UI](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Auth/Register.js): React component · `frontend/src/components/Auth/Register.js`
- [Event creation](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Events/EventForm.js): React component · `frontend/src/components/Events/EventForm.js`
- [Event listing](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Events/EventList.js): React component · `frontend/src/components/Events/EventList.js`
- [My events](https://github.com/shrashti-jain/event-management-app/blob/master/frontend/src/components/Events/MyEvents.js): React component · Owner-scoped event view. · `frontend/src/components/Events/MyEvents.js`

### Express API

- [API server](https://github.com/shrashti-jain/event-management-app/blob/master/backend/server.js): Express startup · `backend/server.js`
- [Auth routes](https://github.com/shrashti-jain/event-management-app/blob/master/backend/routes/auth.js): Express routes · `backend/routes/auth.js`
- [Event routes](https://github.com/shrashti-jain/event-management-app/blob/master/backend/routes/events.js): Express routes · `backend/routes/events.js`
- [User routes](https://github.com/shrashti-jain/event-management-app/blob/master/backend/routes/users.js): Express routes · `backend/routes/users.js`
- [Auth protection](https://github.com/shrashti-jain/event-management-app/blob/master/backend/middleware/authMiddleware.js): Express middleware · Establishes authenticated caller context. · `backend/middleware/authMiddleware.js`
- [Auth controller](https://github.com/shrashti-jain/event-management-app/blob/master/backend/controllers/authController.js): Controller · `backend/controllers/authController.js`
- [Event controller](https://github.com/shrashti-jain/event-management-app/blob/master/backend/controllers/eventController.js): Controller · `backend/controllers/eventController.js`
- [User controller](https://github.com/shrashti-jain/event-management-app/blob/master/backend/controllers/userController.js): Controller · `backend/controllers/userController.js`

### Persistence

- [Database connection](https://github.com/shrashti-jain/event-management-app/blob/master/backend/config/db.js): Connection setup · `backend/config/db.js`
- [User model](https://github.com/shrashti-jain/event-management-app/blob/master/backend/models/User.js): MongoDB model · `backend/models/User.js`
- [Event model](https://github.com/shrashti-jain/event-management-app/blob/master/backend/models/Event.js): MongoDB model · Events are associated with their creating user. · `backend/models/Event.js`

## Connections

- Client entry → App routing: renders
- App routing → Login UI: routes to
- App routing → Registration UI: routes to
- App routing → Event creation: routes to
- App routing → Event listing: routes to
- App routing → My events: routes to
- App routing → Auth state: uses
- Login UI → API client: auth requests
- Registration UI → API client: auth requests
- Event creation → API client: creates events
- Event listing → API client: fetches events
- My events → API client: fetches own events
- API client → Auth routes: REST auth
- API client → Event routes: REST events
- API client → User routes: REST users
- API server → Auth routes: mounts
- API server → Event routes: mounts
- API server → User routes: mounts
- API server → Database connection: initializes
- Auth routes → Auth controller: delegates
- Event routes → Auth protection: protects requests
- User routes → Auth protection: protects requests
- Auth protection → Event controller: authorizes then handles
- Auth protection → User controller: authorizes then handles
- Auth controller → User model: reads/writes
- User controller → User model: reads/writes
- Event controller → Event model: creates/queries
- Event controller → User model: uses caller ownership
- Database connection → User model: connects
- Database connection → Event model: connects
