# emzcodez/online-hangout-space architecture

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

- Interactive diagram: https://gitdiagram.com/emzcodez/online-hangout-space
- Repository: https://github.com/emzcodez/online-hangout-space

## Overview

Online Hangout Space is a web application for accounts, rooms, social connections, chat, and room customization. The principal workflow is: a user registers or logs in, discovers or creates a room, joins it, then chats or customizes it; room favorites, friend requests, notifications, and activity provide supporting social features. The sampled routes show Prisma-backed MySQL operations and MongoDB-backed notifications/activity. Watch sessions are a documented database capability, but no corresponding application route was shown, so that branch is represented only by the schema. UI-to-route wiring is not established by the excerpts.

Main entry points: [`web/src/lib/prisma.ts`](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/prisma.ts) (Prisma client), [`web/src/app/api/auth`](https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/auth) (Authentication routes), [`web/src/app/api/rooms/[roomId]/messages/route.ts`](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/rooms/%5BroomId%5D/messages/route.ts) (Room messages), [`web/src/app/api/rooms`](https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/rooms) (Room routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_dashboard["Hangout dashboard<br/>[page.tsx]"]
  node_customize_ui["Room editor<br/>[page.tsx]"]
  node_register_ui["Registration page<br/>[page.tsx]"]
end

subgraph group_identity["Identity"]
  node_auth_api["Authentication routes"]
  node_auth_lib["Session and auth<br/>[auth.ts]"]
  node_login_limit["Login rate limit"]
end

subgraph group_rooms["Rooms and chat"]
  node_room_api["Room routes"]
  node_chat_api["Room messages<br/>[route.ts]"]
  node_customize_api["Customization route<br/>[route.ts]"]
  node_room_access["Room access checks<br/>[rooms.ts]"]
end

subgraph group_social["Social features"]
  node_friends_api["Friend routes"]
  node_favorites_api["Room favorites<br/>[route.ts]"]
  node_notifications_api["Notifications route<br/>[route.ts]"]
  node_activity_api["Room activity route<br/>[route.ts]"]
  node_mongo_events["Event writers<br/>[mongo-events.ts]"]
end

subgraph group_persistence["Persistence"]
  node_mysql[("MySQL data<br/>[schema.prisma]")]
  node_prisma_client["Prisma client<br/>[prisma.ts]"]
  node_mongodb["MongoDB connection<br/>[mongodb.ts]"]
  node_notification_model["Notification model<br/>[notification.ts]"]
  node_activity_model["Activity model<br/>[roomActivity.ts]"]
  node_sql_demo[("SQL demo schema")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens registration"| node_register_ui
node_visitor -->|"uses hangout"| node_dashboard
node_visitor -.->|"authenticates"| node_auth_api
node_visitor -.->|"manages rooms"| node_room_api
node_visitor -.->|"manages friends"| node_friends_api
node_visitor -.->|"saves rooms"| node_favorites_api
node_register_ui -.->|"submits account"| node_auth_api
node_dashboard -.->|"requests rooms"| node_room_api
node_dashboard -.->|"requests chat"| node_chat_api
node_customize_ui -.->|"saves design"| node_customize_api
node_auth_api -->|"creates sessions"| node_auth_lib
node_auth_api -->|"limits attempts"| node_login_limit
node_auth_api -->|"reads and writes users"| node_prisma_client
node_room_api -->|"queries rooms"| node_prisma_client
node_room_api -->|"records creation"| node_mongo_events
node_chat_api -->|"checks membership"| node_room_access
node_chat_api -->|"reads and writes chat"| node_prisma_client
node_chat_api -->|"records messages"| node_mongo_events
node_customize_api -->|"checks membership"| node_room_access
node_customize_api -->|"stores room design"| node_prisma_client
node_friends_api -->|"manages relationships"| node_prisma_client
node_friends_api -->|"notifies recipients"| node_mongo_events
node_favorites_api -->|"checks room access"| node_room_access
node_favorites_api -->|"stores favorites"| node_prisma_client
node_notifications_api -->|"connects database"| node_mongodb
node_notifications_api -->|"reads and updates"| node_notification_model
node_activity_api -->|"checks memberships"| node_prisma_client
node_activity_api -->|"connects database"| node_mongodb
node_activity_api -->|"queries activity"| node_activity_model
node_mongo_events -.->|"writes events"| node_mongodb
node_mysql -.->|"defines data model"| node_prisma_client
node_sql_demo -.->|"documents data capabilities"| node_visitor

click node_dashboard "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/dashboard/page.tsx"
click node_customize_ui "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/dashboard/rooms/%5BroomId%5D/customize/page.tsx"
click node_register_ui "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/register/page.tsx"
click node_auth_api "https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/auth"
click node_auth_lib "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/auth.ts"
click node_login_limit "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/login-rate-limit.ts"
click node_room_api "https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/rooms"
click node_chat_api "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/rooms/%5BroomId%5D/messages/route.ts"
click node_customize_api "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/rooms/%5BroomId%5D/customization/route.ts"
click node_room_access "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/rooms.ts"
click node_friends_api "https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/friends"
click node_favorites_api "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/favorites/route.ts"
click node_notifications_api "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/notifications/route.ts"
click node_activity_api "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/rooms/activity/route.ts"
click node_mongo_events "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/mongo-events.ts"
click node_mysql "https://github.com/emzcodez/online-hangout-space/blob/main/web/prisma/schema.prisma"
click node_prisma_client "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/prisma.ts"
click node_mongodb "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/mongodb.ts"
click node_notification_model "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/models/notification.ts"
click node_activity_model "https://github.com/emzcodez/online-hangout-space/blob/main/web/src/models/roomActivity.ts"
click node_sql_demo "https://github.com/emzcodez/online-hangout-space/blob/main/online_hangout_space.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_dashboard,node_customize_ui,node_register_ui toneBlue
class node_auth_api,node_auth_lib,node_login_limit toneAmber
class node_room_api,node_chat_api,node_customize_api,node_room_access toneMint
class node_friends_api,node_favorites_api,node_notifications_api,node_activity_api,node_mongo_events toneRose
class node_mysql,node_prisma_client,node_mongodb,node_notification_model,node_activity_model,node_sql_demo,node_visitor toneIndigo
```

## Components

### Web experience

- [Hangout dashboard](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/dashboard/page.tsx): `web/src/app/dashboard/page.tsx`
- [Room editor](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/dashboard/rooms/%5BroomId%5D/customize/page.tsx): `web/src/app/dashboard/rooms/[roomId]/customize/page.tsx`
- [Registration page](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/register/page.tsx): `web/src/app/register/page.tsx`

### Identity

- [Authentication routes](https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/auth): `web/src/app/api/auth`
- [Session and auth](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/auth.ts): `web/src/lib/auth.ts`
- [Login rate limit](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/login-rate-limit.ts): `web/src/lib/login-rate-limit.ts`

### Rooms and chat

- [Room routes](https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/rooms): `web/src/app/api/rooms`
- [Room messages](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/rooms/%5BroomId%5D/messages/route.ts): `web/src/app/api/rooms/[roomId]/messages/route.ts`
- [Customization route](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/rooms/%5BroomId%5D/customization/route.ts): `web/src/app/api/rooms/[roomId]/customization/route.ts`
- [Room access checks](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/rooms.ts): `web/src/lib/rooms.ts`

### Social features

- [Friend routes](https://github.com/emzcodez/online-hangout-space/tree/main/web/src/app/api/friends): `web/src/app/api/friends`
- [Room favorites](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/favorites/route.ts): `web/src/app/api/favorites/route.ts`
- [Notifications route](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/notifications/route.ts): `web/src/app/api/notifications/route.ts`
- [Room activity route](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/app/api/rooms/activity/route.ts): `web/src/app/api/rooms/activity/route.ts`
- [Event writers](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/mongo-events.ts): `web/src/lib/mongo-events.ts`

### Persistence

- [MySQL data](https://github.com/emzcodez/online-hangout-space/blob/main/web/prisma/schema.prisma): `web/prisma/schema.prisma`
- [Prisma client](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/prisma.ts): `web/src/lib/prisma.ts`
- [MongoDB connection](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/lib/mongodb.ts): `web/src/lib/mongodb.ts`
- [Notification model](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/models/notification.ts): `web/src/models/notification.ts`
- [Activity model](https://github.com/emzcodez/online-hangout-space/blob/main/web/src/models/roomActivity.ts): `web/src/models/roomActivity.ts`
- [SQL demo schema](https://github.com/emzcodez/online-hangout-space/blob/main/online_hangout_space.sql): `online_hangout_space.sql`

### Other components

- **Visitor**

## Connections

- Visitor → Registration page: opens registration
- Visitor → Hangout dashboard: uses hangout
- Visitor → Authentication routes: authenticates
- Visitor → Room routes: manages rooms
- Visitor → Friend routes: manages friends
- Visitor → Room favorites: saves rooms
- Registration page → Authentication routes: submits account
- Hangout dashboard → Room routes: requests rooms
- Hangout dashboard → Room messages: requests chat
- Room editor → Customization route: saves design
- Authentication routes → Session and auth: creates sessions (evidence: `web/src/app/api/auth/login/route.ts`)
- Authentication routes → Login rate limit: limits attempts (evidence: `web/src/app/api/auth/login/route.ts`)
- Authentication routes → Prisma client: reads and writes users (evidence: `web/src/app/api/auth/register/route.ts`)
- Room routes → Prisma client: queries rooms (evidence: `web/src/app/api/rooms/route.ts`)
- Room routes → Event writers: records creation (evidence: `web/src/app/api/rooms/route.ts`)
- Room messages → Room access checks: checks membership (evidence: `web/src/app/api/rooms/[roomId]/messages/route.ts`)
- Room messages → Prisma client: reads and writes chat (evidence: `web/src/app/api/rooms/[roomId]/messages/route.ts`)
- Room messages → Event writers: records messages (evidence: `web/src/app/api/rooms/[roomId]/messages/route.ts`)
- Customization route → Room access checks: checks membership (evidence: `web/src/app/api/rooms/[roomId]/customization/route.ts`)
- Customization route → Prisma client: stores room design (evidence: `web/src/app/api/rooms/[roomId]/customization/route.ts`)
- Friend routes → Prisma client: manages relationships (evidence: `web/src/app/api/friends/requests/route.ts`)
- Friend routes → Event writers: notifies recipients (evidence: `web/src/app/api/friends/requests/route.ts`)
- Room favorites → Room access checks: checks room access (evidence: `web/src/app/api/favorites/route.ts`)
- Room favorites → Prisma client: stores favorites (evidence: `web/src/app/api/favorites/route.ts`)
- Notifications route → MongoDB connection: connects database (evidence: `web/src/app/api/notifications/route.ts`)
- Notifications route → Notification model: reads and updates (evidence: `web/src/app/api/notifications/route.ts`)
- Room activity route → Prisma client: checks memberships (evidence: `web/src/app/api/rooms/activity/route.ts`)
- Room activity route → MongoDB connection: connects database (evidence: `web/src/app/api/rooms/activity/route.ts`)
- Room activity route → Activity model: queries activity (evidence: `web/src/app/api/rooms/activity/route.ts`)
- Event writers → MongoDB connection: writes events
- MySQL data → Prisma client: defines data model
- SQL demo schema → Visitor: documents data capabilities (evidence: `README.md`)
