How shrashti-jain/event-management-app works
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: api.js API client · App.js App routing · server.js API server · authMiddleware.js Auth protection
Components 20
React client
- Client entry
frontend/src/index.js - App routing
frontend/src/App.js - Auth state · Maintains client authentication session state.
frontend/src/context/AuthContext.js - API client · Central client-server integration boundary.
frontend/src/services/api.js - Login UI
frontend/src/components/Auth/Login.js - Registration UI
frontend/src/components/Auth/Register.js - Event creation
frontend/src/components/Events/EventForm.js - Event listing
frontend/src/components/Events/EventList.js - My events · Owner-scoped event view.
frontend/src/components/Events/MyEvents.js
Express API
- API server
backend/server.js - Auth routes
backend/routes/auth.js - Event routes
backend/routes/events.js - User routes
backend/routes/users.js - Auth protection · Establishes authenticated caller context.
backend/middleware/authMiddleware.js - Auth controller
backend/controllers/authController.js - Event controller
backend/controllers/eventController.js - User controller
backend/controllers/userController.js
Persistence
- Database connection
backend/config/db.js - User model
backend/models/User.js - Event model · Events are associated with their creating user.
backend/models/Event.js
Connections 30
- 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