# harrypotter112122/campus-connect architecture

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

- Interactive diagram: https://gitdiagram.com/harrypotter112122/campus-connect
- Repository: https://github.com/harrypotter112122/campus-connect

## Overview

CampusConnect is a campus messaging SPA backed by authenticated REST endpoints, Socket.IO, and SQLite. A user restores or creates an account, enters chat, discovers people or manages conversations, and exchanges persistent messages and attachments; optional summaries call an AI provider. The graph preserves the documented chat capabilities, but some frontend pages and backend routes were not excerpted, so their internal calls are not inferred. Dashed links mark documented client-server or external-service relationships whose transport wiring is not shown in the excerpts.

Main entry points: [`server/src/index.js`](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/index.js) (HTTP and socket server), [`server/src/lib/db.js`](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/lib/db.js) (SQLite data store), [`client/src/App.jsx`](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/App.jsx) (Application routing), [`server/src/routes/conversations.js`](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/conversations.js) (Conversation management and history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Application routing<br/>[App.jsx]"]
  node_authpage["Sign in and registration<br/>[AuthPage.jsx]"]
  node_chatpage["Chat workspace<br/>[ChatPage.jsx]"]
  node_chatwindow["Conversation view<br/>[ChatWindow.jsx]"]
  node_clientapi["REST client<br/>[api.js]"]
  node_clientsocket["Socket client<br/>[socket.js]"]
end

subgraph group_identity["Identity"]
  node_authstate["Session state<br/>[useAuth.jsx]"]
  node_server["HTTP and socket server<br/>[index.js]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
end

subgraph group_messaging["Messaging"]
  node_users["Student discovery and profiles<br/>[users.js]"]
  node_conversations["Conversation management and history<br/>[conversations.js]"]
  node_realtime["Realtime chat and presence<br/>[socket.js]"]
  node_uploads["Media and file sharing<br/>[uploads.js]"]
end

subgraph group_persistence["Persistence"]
  node_db[("SQLite data store<br/>[db.js]")]
  node_uploadstore[("Uploaded files")]
end

subgraph group_integrations["Integrations"]
  node_summaries["Conversation action summaries<br/>[summary.js]"]
  node_ai{{"AI provider"}}
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"provides session"| node_authstate
node_app -->|"routes unauthenticated"| node_authpage
node_app -->|"routes authenticated"| node_chatpage
node_authstate -->|"restores and updates"| node_clientapi
node_authstate -->|"connects after login"| node_clientsocket
node_chatwindow -->|"requests data"| node_clientapi
node_chatwindow -->|"uses realtime events"| node_clientsocket
node_clientapi -.->|"calls REST API"| node_server
node_clientsocket -.->|"opens socket"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_users
node_server -->|"mounts routes"| node_conversations
node_server -->|"mounts routes"| node_summaries
node_server -->|"mounts routes"| node_uploads
node_server -->|"initializes handlers"| node_realtime
node_server -->|"initializes database"| node_db
node_authroutes -->|"reads and writes"| node_db
node_users -->|"queries profiles"| node_db
node_conversations -->|"reads and writes"| node_db
node_conversations -->|"checks presence"| node_realtime
node_realtime -->|"persists messages"| node_db
node_uploads -->|"records attachments"| node_db
node_uploads -->|"stores and serves files"| node_uploadstore
node_realtime -.->|"broadcasts room messages"| node_conversations
node_summaries -->|"loads conversation"| node_db
node_summaries -->|"requests analysis"| node_ai

click node_app "https://github.com/harrypotter112122/campus-connect/blob/main/client/src/App.jsx"
click node_authpage "https://github.com/harrypotter112122/campus-connect/blob/main/client/src/pages/AuthPage.jsx"
click node_chatpage "https://github.com/harrypotter112122/campus-connect/blob/main/client/src/pages/ChatPage.jsx"
click node_chatwindow "https://github.com/harrypotter112122/campus-connect/blob/main/client/src/components/ChatWindow.jsx"
click node_authstate "https://github.com/harrypotter112122/campus-connect/blob/main/client/src/hooks/useAuth.jsx"
click node_clientapi "https://github.com/harrypotter112122/campus-connect/blob/main/client/src/lib/api.js"
click node_clientsocket "https://github.com/harrypotter112122/campus-connect/blob/main/client/src/lib/socket.js"
click node_server "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/index.js"
click node_authroutes "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/auth.js"
click node_users "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/users.js"
click node_conversations "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/conversations.js"
click node_realtime "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/lib/socket.js"
click node_uploads "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/uploads.js"
click node_summaries "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/summary.js"
click node_db "https://github.com/harrypotter112122/campus-connect/blob/main/server/src/lib/db.js"
click node_uploadstore "https://github.com/harrypotter112122/campus-connect/tree/main/server/uploads"

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_app,node_authpage,node_chatpage,node_chatwindow,node_clientapi,node_clientsocket toneBlue
class node_authstate,node_server,node_authroutes toneAmber
class node_users,node_conversations,node_realtime,node_uploads toneMint
class node_db,node_uploadstore toneRose
class node_summaries,node_ai,node_student toneIndigo
```

## Components

### Web client

- [Application routing](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Sign in and registration](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/pages/AuthPage.jsx): `client/src/pages/AuthPage.jsx`
- [Chat workspace](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/pages/ChatPage.jsx): `client/src/pages/ChatPage.jsx`
- [Conversation view](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/components/ChatWindow.jsx): `client/src/components/ChatWindow.jsx`
- [REST client](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/lib/api.js): `client/src/lib/api.js`
- [Socket client](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/lib/socket.js): `client/src/lib/socket.js`

### Identity

- [Session state](https://github.com/harrypotter112122/campus-connect/blob/main/client/src/hooks/useAuth.jsx): `client/src/hooks/useAuth.jsx`
- [HTTP and socket server](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/index.js): `server/src/index.js`
- [Authentication routes](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`

### Messaging

- [Student discovery and profiles](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/users.js): `server/src/routes/users.js`
- [Conversation management and history](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/conversations.js): `server/src/routes/conversations.js`
- [Realtime chat and presence](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/lib/socket.js): `server/src/lib/socket.js`
- [Media and file sharing](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/uploads.js): `server/src/routes/uploads.js`

### Persistence

- [SQLite data store](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/lib/db.js): `server/src/lib/db.js`
- [Uploaded files](https://github.com/harrypotter112122/campus-connect/tree/main/server/uploads): `server/uploads`

### Integrations

- [Conversation action summaries](https://github.com/harrypotter112122/campus-connect/blob/main/server/src/routes/summary.js): `server/src/routes/summary.js`
- **AI provider**

### Other components

- **Student**

## Connections

- Student → Application routing: uses (evidence: `README.md`)
- Application routing → Session state: provides session (evidence: `client/src/App.jsx`)
- Application routing → Sign in and registration: routes unauthenticated (evidence: `client/src/App.jsx`)
- Application routing → Chat workspace: routes authenticated (evidence: `client/src/App.jsx`)
- Session state → REST client: restores and updates (evidence: `client/src/hooks/useAuth.jsx`)
- Session state → Socket client: connects after login (evidence: `client/src/hooks/useAuth.jsx`)
- Conversation view → REST client: requests data (evidence: `client/src/components/ChatWindow.jsx`)
- Conversation view → Socket client: uses realtime events (evidence: `client/src/components/ChatWindow.jsx`)
- REST client → HTTP and socket server: calls REST API (evidence: `README.md`)
- Socket client → HTTP and socket server: opens socket (evidence: `README.md`)
- HTTP and socket server → Authentication routes: mounts routes (evidence: `server/src/index.js`)
- HTTP and socket server → Student discovery and profiles: mounts routes (evidence: `server/src/index.js`)
- HTTP and socket server → Conversation management and history: mounts routes (evidence: `server/src/index.js`)
- HTTP and socket server → Conversation action summaries: mounts routes (evidence: `server/src/index.js`)
- HTTP and socket server → Media and file sharing: mounts routes (evidence: `server/src/index.js`)
- HTTP and socket server → Realtime chat and presence: initializes handlers (evidence: `server/src/index.js`)
- HTTP and socket server → SQLite data store: initializes database (evidence: `server/src/index.js`)
- Authentication routes → SQLite data store: reads and writes (evidence: `server/src/routes/auth.js`)
- Student discovery and profiles → SQLite data store: queries profiles (evidence: `server/src/routes/users.js`)
- Conversation management and history → SQLite data store: reads and writes (evidence: `server/src/routes/conversations.js`)
- Conversation management and history → Realtime chat and presence: checks presence (evidence: `server/src/routes/conversations.js`)
- Realtime chat and presence → SQLite data store: persists messages (evidence: `server/src/lib/socket.js`)
- Media and file sharing → SQLite data store: records attachments (evidence: `server/src/routes/uploads.js`)
- Media and file sharing → Uploaded files: stores and serves files (evidence: `server/src/routes/uploads.js`)
- Realtime chat and presence → Conversation management and history: broadcasts room messages (evidence: `README.md`)
- Conversation action summaries → SQLite data store: loads conversation (evidence: `server/src/routes/summary.js`)
- Conversation action summaries → AI provider: requests analysis (evidence: `server/src/routes/summary.js`)
