# shijuvtm/meetup architecture

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

- Interactive diagram: https://gitdiagram.com/shijuvtm/meetup
- Repository: https://github.com/shijuvtm/meetup

## Overview

#### Purpose and Deployment Shape
This is a containerized meetup/event RSVP tracker. A Next.js frontend calls an Express API, which persists users, events, and RSVP state in PostgreSQL/Neon. Docker Compose orchestrates frontend and backend containers via `docker-compose.yml`; backend startup and database setup are defined in `backend/Dockerfile`, `backend/entrypoint.sh`, and `backend/init-db.js`.

#### Backend API Entry and Composition
The Node process starts at `backend/server.js`, which loads the Express application from `backend/src/app.js`. The app composes API routes and shared middleware, separating HTTP wiring from domain handling. Backend dependencies and runtime scripts are declared in `backend/package.json`.

#### Authentication Boundary
Authentication is exposed through `backend/src/routes/authRoutes.js` and implemented in `backend/src/controllers/authController.js`. It uses bcrypt password hashing and JWT issuance. Protected requests cross the authorization boundary in `backend/src/middleware/auth.js`, which validates tokens and supplies authenticated identity for ownership-guarded event actions.

#### Event and RSVP Domain
Event lifecycle and RSVP operations are routed through `backend/src/routes/eventRoutes.js` and handled in `backend/src/controllers/eventController.js`. This layer owns creation, editing, deletion, retrieval/filtering, and RSVP status changes. Event mutation authorization depends on the authenticated user established by the auth middleware.

#### Persistence and Database Lifecycle
PostgreSQL access is centralized in `backend/src/config/db.js`, using the `DATABASE_URL` connection to a Neon-hosted database. The relational schema is defined in `backend/schema.sql`; initialization and optional initial data paths are `backend/init-db.js` and `backend/seed.js`. The database is an external managed service rather than a local Compose service.

#### Frontend Application and Client State
The Next.js application is rooted at `frontend/app/layout.tsx` and `frontend/app/page.tsx`. Authentication state is shared through `frontend/context/AuthContext.tsx`, while API requests are centralized in `frontend/lib/api.ts`, using the public backend URL environment variable. `frontend/components/Navbar.tsx` is the cross-page navigation/auth-facing UI boundary.

#### User Flows and Pages
The frontend maps event operations to App Router pages: event detail at `frontend/app/events/[id]/page.tsx`, event editing at `frontend/app/events/[id]/edit/page.tsx`, and creation at `frontend/app/events/create/page.tsx`. Login begins at `frontend/app/login/page.tsx`. These pages read/write through the API client; the backend enforces JWT identity and event ownership rather than trusting client state.

Main entry points: [`frontend/app/layout.tsx`](https://github.com/shijuvtm/meetup/blob/main/frontend/app/layout.tsx) (App shell), [`backend/src/app.js`](https://github.com/shijuvtm/meetup/blob/main/backend/src/app.js) (Express app), [`backend/src/routes/eventRoutes.js`](https://github.com/shijuvtm/meetup/blob/main/backend/src/routes/eventRoutes.js) (Event & RSVP API), [`frontend/lib/api.ts`](https://github.com/shijuvtm/meetup/blob/main/frontend/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Next.js frontend"]
  node_frontend_root["App shell<br/>Next.js App Router<br/>[layout.tsx]"]
  node_home["Home page<br/>[page.tsx]"]
  node_event_pages["Event pages<br/>[page.tsx]"]
  node_login["Login page<br/>[page.tsx]"]
  node_auth_state["Auth state<br/>React context<br/>[AuthContext.tsx]"]
  node_navbar["Navbar<br/>UI boundary<br/>[Navbar.tsx]"]
  node_api_client["API client<br/>HTTP client<br/>[api.ts]"]
end

subgraph group_backend["Express backend"]
  node_server["Server entry<br/>Node process<br/>[server.js]"]
  node_express_app["Express app<br/>HTTP composition<br/>[app.js]"]
  node_auth_api["Auth API<br/>routes + controller<br/>[authRoutes.js]"]
  node_event_api["Event &amp; RSVP API<br/>routes + controller<br/>[eventRoutes.js]"]
  node_auth_guard["JWT authorization<br/>Express middleware<br/>[auth.js]"]
  node_db_access["Database access<br/>PostgreSQL client<br/>[db.js]"]
end

subgraph group_data["Data &amp; deployment"]
  node_compose{{"Docker Compose<br/>orchestrator<br/>[docker-compose.yml]"}}
  node_startup["Database startup<br/>container initialization<br/>[entrypoint.sh]"]
  node_schema["Relational schema<br/>SQL schema<br/>[schema.sql]"]
  node_neon[("Neon PostgreSQL<br/>managed database")]
end

node_compose -->|"runs"| node_frontend_root
node_compose -->|"runs"| node_server
node_frontend_root -->|"renders"| node_home
node_frontend_root -->|"routes to"| node_event_pages
node_frontend_root -->|"routes to"| node_login
node_frontend_root -->|"provides"| node_auth_state
node_navbar -->|"reads"| node_auth_state
node_login -->|"auth requests"| node_api_client
node_event_pages -->|"event and RSVP requests"| node_api_client
node_api_client -->|"HTTP API"| node_express_app
node_server -->|"loads"| node_express_app
node_express_app -->|"mounts"| node_auth_api
node_express_app -->|"mounts"| node_event_api
node_event_api -->|"protects mutations"| node_auth_guard
node_auth_guard -->|"authenticated identity"| node_event_api
node_auth_api -->|"users"| node_db_access
node_event_api -->|"events and RSVPs"| node_db_access
node_db_access -->|"DATABASE_URL"| node_neon
node_startup -->|"applies"| node_schema
node_schema -.->|"defines"| node_neon

click node_compose "https://github.com/shijuvtm/meetup/blob/main/docker-compose.yml"
click node_frontend_root "https://github.com/shijuvtm/meetup/blob/main/frontend/app/layout.tsx"
click node_home "https://github.com/shijuvtm/meetup/blob/main/frontend/app/page.tsx"
click node_event_pages "https://github.com/shijuvtm/meetup/blob/main/frontend/app/events/%5Bid%5D/page.tsx"
click node_login "https://github.com/shijuvtm/meetup/blob/main/frontend/app/login/page.tsx"
click node_auth_state "https://github.com/shijuvtm/meetup/blob/main/frontend/context/AuthContext.tsx"
click node_navbar "https://github.com/shijuvtm/meetup/blob/main/frontend/components/Navbar.tsx"
click node_api_client "https://github.com/shijuvtm/meetup/blob/main/frontend/lib/api.ts"
click node_server "https://github.com/shijuvtm/meetup/blob/main/backend/server.js"
click node_express_app "https://github.com/shijuvtm/meetup/blob/main/backend/src/app.js"
click node_auth_api "https://github.com/shijuvtm/meetup/blob/main/backend/src/routes/authRoutes.js"
click node_event_api "https://github.com/shijuvtm/meetup/blob/main/backend/src/routes/eventRoutes.js"
click node_auth_guard "https://github.com/shijuvtm/meetup/blob/main/backend/src/middleware/auth.js"
click node_db_access "https://github.com/shijuvtm/meetup/blob/main/backend/src/config/db.js"
click node_startup "https://github.com/shijuvtm/meetup/blob/main/backend/entrypoint.sh"
click node_schema "https://github.com/shijuvtm/meetup/blob/main/backend/schema.sql"

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_frontend_root,node_home,node_event_pages,node_login,node_auth_state,node_navbar,node_api_client toneBlue
class node_server,node_express_app,node_auth_api,node_event_api,node_auth_guard,node_db_access toneAmber
class node_compose,node_startup,node_schema,node_neon toneMint
```

## Components

### Next.js frontend

- [App shell](https://github.com/shijuvtm/meetup/blob/main/frontend/app/layout.tsx): Next.js App Router · `frontend/app/layout.tsx`
- [Home page](https://github.com/shijuvtm/meetup/blob/main/frontend/app/page.tsx): page · `frontend/app/page.tsx`
- [Event pages](https://github.com/shijuvtm/meetup/blob/main/frontend/app/events/%5Bid%5D/page.tsx): pages · Detail, creation, and editing flows. · `frontend/app/events/[id]/page.tsx`
- [Login page](https://github.com/shijuvtm/meetup/blob/main/frontend/app/login/page.tsx): page · `frontend/app/login/page.tsx`
- [Auth state](https://github.com/shijuvtm/meetup/blob/main/frontend/context/AuthContext.tsx): React context · `frontend/context/AuthContext.tsx`
- [Navbar](https://github.com/shijuvtm/meetup/blob/main/frontend/components/Navbar.tsx): UI boundary · `frontend/components/Navbar.tsx`
- [API client](https://github.com/shijuvtm/meetup/blob/main/frontend/lib/api.ts): HTTP client · Uses the public backend URL. · `frontend/lib/api.ts`

### Express backend

- [Server entry](https://github.com/shijuvtm/meetup/blob/main/backend/server.js): Node process · `backend/server.js`
- [Express app](https://github.com/shijuvtm/meetup/blob/main/backend/src/app.js): HTTP composition · Composes routes and shared middleware. · `backend/src/app.js`
- [Auth API](https://github.com/shijuvtm/meetup/blob/main/backend/src/routes/authRoutes.js): routes + controller · Password authentication and JWT issuance. · `backend/src/routes/authRoutes.js`
- [Event & RSVP API](https://github.com/shijuvtm/meetup/blob/main/backend/src/routes/eventRoutes.js): routes + controller · Event lifecycle and RSVP status operations. · `backend/src/routes/eventRoutes.js`
- [JWT authorization](https://github.com/shijuvtm/meetup/blob/main/backend/src/middleware/auth.js): Express middleware · Supplies identity for protected ownership checks. · `backend/src/middleware/auth.js`
- [Database access](https://github.com/shijuvtm/meetup/blob/main/backend/src/config/db.js): PostgreSQL client · Connects using DATABASE_URL. · `backend/src/config/db.js`

### Data & deployment

- [Docker Compose](https://github.com/shijuvtm/meetup/blob/main/docker-compose.yml): orchestrator · Runs frontend and backend containers. · `docker-compose.yml`
- [Database startup](https://github.com/shijuvtm/meetup/blob/main/backend/entrypoint.sh): container initialization · Initializes database during backend startup. · `backend/entrypoint.sh`
- [Relational schema](https://github.com/shijuvtm/meetup/blob/main/backend/schema.sql): SQL schema · `backend/schema.sql`
- **Neon PostgreSQL**: managed database · External persistent store for users, events, and RSVPs.

## Connections

- Docker Compose → App shell: runs
- Docker Compose → Server entry: runs
- App shell → Home page: renders
- App shell → Event pages: routes to
- App shell → Login page: routes to
- App shell → Auth state: provides
- Navbar → Auth state: reads
- Login page → API client: auth requests
- Event pages → API client: event and RSVP requests
- API client → Express app: HTTP API
- Server entry → Express app: loads
- Express app → Auth API: mounts
- Express app → Event & RSVP API: mounts
- Event & RSVP API → JWT authorization: protects mutations
- JWT authorization → Event & RSVP API: authenticated identity
- Auth API → Database access: users
- Event & RSVP API → Database access: events and RSVPs
- Database access → Neon PostgreSQL: DATABASE_URL
- Database startup → Relational schema: applies
- Relational schema → Neon PostgreSQL: defines
