# abhinavb20/meetup-sync architecture

> Architecture diagram of the GitHub repository abhinavb20/meetup-sync, 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/abhinavb20/meetup-sync
- Repository: https://github.com/abhinavb20/meetup-sync

## Overview

#### Purpose and deployment
MeetupSync is a Docker-compose full-stack meetup manager: users authenticate, manage events they own, and submit/view RSVPs. Compose starts the Next.js frontend, Express API, and MySQL 8.4 database: `docker-compose.yml`, `backend/server.js`, `mysql/init/01-schema.sql`.

#### Client application and entry points
The Next.js App Router frontend is the user-facing entry point at port 3000. The root layout and guest landing page establish the application shell; navigation conditionally reflects authentication state. Core user flows are dashboard, event creation/editing, and event detail/RSVP views.
- `frontend/app/layout.js`
- `frontend/app/page.js`
- `frontend/app/dashboard/page.js`
- `frontend/components/NavbarWrapper.js`

#### Frontend API boundary
Next route handlers form a backend-for-frontend boundary between browser UI and Express. They cover auth, event CRUD, RSVP mutation, and attendee retrieval, likely forwarding cookies/auth context rather than exposing backend concerns directly to pages.
- `frontend/app/api/auth/login/route.js`
- `frontend/app/api/events/route.js`
- `frontend/app/api/events/[id]/rsvp/route.js`
- `frontend/app/api/events/[id]/rsvps/route.js`

#### Express API and request routing
The Node/Express server at port 5000 is the authoritative application API. It composes separate authentication and event route modules; event routes own event lifecycle, ownership enforcement, RSVP operations, capacity checks, and attendee queries.
- `backend/server.js`
- `backend/routes/authRoutes.js`
- `backend/routes/eventRoutes.js`

#### Identity and authorization
Login verifies bcrypt-hashed credentials, produces a JWT, and uses an HTTP-only authentication cookie. Protected Express operations pass through JWT verification middleware; ownership checks in event handling restrict edits/deletes to the event creator. Logout and current-user endpoints complete session lifecycle.
- `backend/middleware/auth.js`
- `backend/utils/jwt.js`
- `frontend/app/api/auth/me/route.js`
- `frontend/app/api/auth/logout/route.js`

#### Persistence and domain constraints
MySQL is the system of record for users, events, and RSVPs. The initialization schema establishes relationships, seeded accounts/event, and database constraints; Express accesses it through a shared MySQL2 pool. Application/database rules prevent duplicate RSVPs, and RSVP processing accounts for event capacity.
- `mysql/init/01-schema.sql`
- `backend/db/pool.js`
- `backend/routes/eventRoutes.js`

#### Primary flow
Browser pages call same-origin Next API handlers; handlers communicate with Express; Express authenticates requests and reads/writes MySQL. Login establishes the cookie consumed by subsequent protected calls. Event creation associates an authenticated creator; detail views fetch event and attendees; RSVP creates, updates, or removes the caller’s response while enforcing duplicate/capacity rules. The primary runtime boundary is Next.js ↔ Express, and the trust boundary is JWT middleware before protected database mutations.

Main entry points: [`backend/server.js`](https://github.com/abhinavb20/meetup-sync/blob/main/backend/server.js) (Express server), [`docker-compose.yml`](https://github.com/abhinavb20/meetup-sync/blob/main/docker-compose.yml) (Docker Compose), [`frontend/app/layout.js`](https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/layout.js) (App shell & landing), [`backend/routes/authRoutes.js`](https://github.com/abhinavb20/meetup-sync/blob/main/backend/routes/authRoutes.js) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Next.js frontend"]
  node_ui_shell["App shell &amp; landing<br/>Next pages<br/>[layout.js]"]
  node_dashboard["Dashboard<br/>Next page<br/>[page.js]"]
  node_navbar["Auth-aware navbar<br/>Next component<br/>[NavbarWrapper.js]"]
  node_auth_bff["Auth BFF handlers<br/>Next route handlers<br/>[route.js]"]
  node_event_bff["Event BFF handlers<br/>Next route handlers<br/>[route.js]"]
end

subgraph group_api["Express API"]
  node_express["Express server<br/>Node API :5000<br/>[server.js]"]
  node_auth_routes["Authentication routes<br/>Express routes<br/>[authRoutes.js]"]
  node_event_routes["Event routes<br/>Express routes<br/>[eventRoutes.js]"]
  node_jwt_guard["JWT middleware<br/>authorization middleware<br/>[auth.js]"]
  node_jwt["JWT utility<br/>token utility<br/>[jwt.js]"]
  node_pool[("MySQL2 pool<br/>database access<br/>[pool.js]")]
end

subgraph group_data["MySQL"]
  node_mysql[("MySQL 8.4<br/>database<br/>[01-schema.sql]")]
  node_schema["Schema &amp; seed data<br/>SQL initialization<br/>[01-schema.sql]"]
end

node_compose{{"Docker Compose<br/>deployment<br/>[docker-compose.yml]"}}

node_compose -->|"starts"| node_ui_shell
node_compose -->|"starts"| node_express
node_compose -->|"starts"| node_mysql
node_ui_shell -->|"renders"| node_navbar
node_dashboard -->|"same-origin API calls"| node_event_bff
node_ui_shell -->|"login/session calls"| node_auth_bff
node_auth_bff -->|"forwards auth context"| node_express
node_event_bff -->|"forwards protected requests"| node_express
node_express -->|"routes auth requests"| node_auth_routes
node_express -->|"routes event requests"| node_event_routes
node_auth_routes -->|"issues JWT"| node_jwt
node_event_routes -->|"protected operations"| node_jwt_guard
node_jwt_guard -->|"verifies JWT"| node_jwt
node_auth_routes -->|"reads users"| node_pool
node_event_routes -->|"reads/writes events and RSVPs"| node_pool
node_pool -->|"queries"| node_mysql
node_schema -->|"initializes"| node_mysql

click node_compose "https://github.com/abhinavb20/meetup-sync/blob/main/docker-compose.yml"
click node_ui_shell "https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/layout.js"
click node_dashboard "https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/dashboard/page.js"
click node_navbar "https://github.com/abhinavb20/meetup-sync/blob/main/frontend/components/NavbarWrapper.js"
click node_auth_bff "https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/api/auth/login/route.js"
click node_event_bff "https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/api/events/route.js"
click node_express "https://github.com/abhinavb20/meetup-sync/blob/main/backend/server.js"
click node_auth_routes "https://github.com/abhinavb20/meetup-sync/blob/main/backend/routes/authRoutes.js"
click node_event_routes "https://github.com/abhinavb20/meetup-sync/blob/main/backend/routes/eventRoutes.js"
click node_jwt_guard "https://github.com/abhinavb20/meetup-sync/blob/main/backend/middleware/auth.js"
click node_jwt "https://github.com/abhinavb20/meetup-sync/blob/main/backend/utils/jwt.js"
click node_pool "https://github.com/abhinavb20/meetup-sync/blob/main/backend/db/pool.js"
click node_mysql "https://github.com/abhinavb20/meetup-sync/blob/main/mysql/init/01-schema.sql"
click node_schema "https://github.com/abhinavb20/meetup-sync/blob/main/mysql/init/01-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_ui_shell,node_dashboard,node_navbar,node_auth_bff,node_event_bff toneBlue
class node_express,node_auth_routes,node_event_routes,node_jwt_guard,node_jwt,node_pool toneAmber
class node_mysql,node_schema toneMint
class node_compose toneNeutral
```

## Components

### Next.js frontend

Browser UI and same-origin backend-for-frontend.

- [App shell & landing](https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/layout.js): Next pages · Root layout, guest landing page, and auth-aware navigation. · `frontend/app/layout.js`
- [Dashboard](https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/dashboard/page.js): Next page · Authenticated event management view. · `frontend/app/dashboard/page.js`
- [Auth-aware navbar](https://github.com/abhinavb20/meetup-sync/blob/main/frontend/components/NavbarWrapper.js): Next component · `frontend/components/NavbarWrapper.js`
- [Auth BFF handlers](https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/api/auth/login/route.js): Next route handlers · Login, current-user, and logout boundary. · `frontend/app/api/auth/login/route.js`
- [Event BFF handlers](https://github.com/abhinavb20/meetup-sync/blob/main/frontend/app/api/events/route.js): Next route handlers · Event CRUD, RSVP, and attendee requests. · `frontend/app/api/events/route.js`

### Express API

Authoritative application API.

- [Express server](https://github.com/abhinavb20/meetup-sync/blob/main/backend/server.js): Node API :5000 · Composes authentication and event routing. · `backend/server.js`
- [Authentication routes](https://github.com/abhinavb20/meetup-sync/blob/main/backend/routes/authRoutes.js): Express routes · Verifies credentials and manages session lifecycle. · `backend/routes/authRoutes.js`
- [Event routes](https://github.com/abhinavb20/meetup-sync/blob/main/backend/routes/eventRoutes.js): Express routes · Owns event lifecycle, RSVPs, attendee queries, and capacity rules. · `backend/routes/eventRoutes.js`
- [JWT middleware](https://github.com/abhinavb20/meetup-sync/blob/main/backend/middleware/auth.js): authorization middleware · Protects authenticated operations before mutation. · `backend/middleware/auth.js`
- [JWT utility](https://github.com/abhinavb20/meetup-sync/blob/main/backend/utils/jwt.js): token utility · Creates and verifies authentication tokens. · `backend/utils/jwt.js`
- [MySQL2 pool](https://github.com/abhinavb20/meetup-sync/blob/main/backend/db/pool.js): database access · Shared connection pool for Express routes. · `backend/db/pool.js`

### MySQL

Persistent system of record.

- [MySQL 8.4](https://github.com/abhinavb20/meetup-sync/blob/main/mysql/init/01-schema.sql): database · Stores users, events, and RSVPs. · `mysql/init/01-schema.sql`
- [Schema & seed data](https://github.com/abhinavb20/meetup-sync/blob/main/mysql/init/01-schema.sql): SQL initialization · Defines relationships, constraints, and seeded records. · `mysql/init/01-schema.sql`

### Other components

- [Docker Compose](https://github.com/abhinavb20/meetup-sync/blob/main/docker-compose.yml): deployment · Starts frontend, API, and MySQL services. · `docker-compose.yml`

## Connections

- Docker Compose → App shell & landing: starts
- Docker Compose → Express server: starts
- Docker Compose → MySQL 8.4: starts
- App shell & landing → Auth-aware navbar: renders
- Dashboard → Event BFF handlers: same-origin API calls
- App shell & landing → Auth BFF handlers: login/session calls
- Auth BFF handlers → Express server: forwards auth context
- Event BFF handlers → Express server: forwards protected requests
- Express server → Authentication routes: routes auth requests
- Express server → Event routes: routes event requests
- Authentication routes → JWT utility: issues JWT
- Event routes → JWT middleware: protected operations
- JWT middleware → JWT utility: verifies JWT
- Authentication routes → MySQL2 pool: reads users
- Event routes → MySQL2 pool: reads/writes events and RSVPs
- MySQL2 pool → MySQL 8.4: queries
- Schema & seed data → MySQL 8.4: initializes
