# harsha12a/justus architecture

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

- Interactive diagram: https://gitdiagram.com/harsha12a/justus
- Repository: https://github.com/harsha12a/justus

## Overview

JustUs is a web chat application. Users can register or log in, then access protected chat and profile views; the server supports creating chats and retrieving messages, while Socket.IO handles live message delivery and deletion. The sampled source confirms signup’s HTTP request and the realtime server’s message persistence and dispatch. Other client request wiring and router-to-controller mappings were not sampled, so those links are omitted.

Main entry points: [`server/src/index.js`](https://github.com/harsha12a/justus/blob/master/server/src/index.js) (HTTP entry), [`client/src/App.tsx`](https://github.com/harsha12a/justus/blob/master/client/src/App.tsx) (App router), [`server/src/utils/prisma.config.js`](https://github.com/harsha12a/justus/blob/master/server/src/utils/prisma.config.js) (Prisma client), [`client/src/components/ProtectedRoute.tsx`](https://github.com/harsha12a/justus/blob/master/client/src/components/ProtectedRoute.tsx) (Protected routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App router<br/>[App.tsx]"]
  node_signup["Signup<br/>[SignUp.tsx]"]
  node_login["Login<br/>[Login.tsx]"]
  node_protected["Protected routes<br/>[ProtectedRoute.tsx]"]
  node_chatui["Chat view<br/>[Chat.tsx]"]
  node_profile["Profile view<br/>[Profile.tsx]"]
  node_state["Persisted state<br/>[store.ts]"]
end

subgraph group_server["HTTP service"]
  node_clientapi["Chat API<br/>[chat.route.js]"]
  node_userapi["User API<br/>[user.route.js]"]
  node_messageapi["Message API<br/>[message.route.js]"]
  node_entry["HTTP entry<br/>[index.js]"]
  node_users["User operations<br/>[user.controller.js]"]
  node_chats["Chat operations<br/>[chat.controller.js]"]
  node_messages["Message operations"]
  node_auth["Token verification<br/>[tokenVerify.js]"]
end

subgraph group_realtime["Realtime messaging"]
  node_socket["Socket handlers<br/>[socket.js]"]
  node_socketserver["Socket.IO server<br/>[index.js]"]
end

subgraph group_persistence["Data persistence"]
  node_prisma["Prisma client<br/>[prisma.config.js]"]
  node_database[("Application database<br/>[schema.prisma]")]
end

node_visitor(("User"))
node_httpclient(("Browser HTTP client"))

node_visitor -->|"uses"| node_app
node_app -->|"routes"| node_signup
node_app -->|"routes"| node_login
node_app -->|"guards"| node_protected
node_protected -->|"allows"| node_chatui
node_protected -->|"allows"| node_profile
node_app -->|"renders within"| node_state
node_signup -->|"posts signup"| node_httpclient
node_entry -->|"mounts"| node_userapi
node_entry -->|"mounts"| node_clientapi
node_entry -->|"mounts"| node_messageapi
node_entry -->|"creates"| node_socketserver
node_entry -->|"initializes"| node_socket
node_socket -->|"calls save/delete"| node_messages
node_users -->|"reads/writes"| node_prisma
node_chats -->|"reads/writes"| node_prisma
node_messages -->|"reads/writes"| node_prisma
node_prisma -->|"accesses"| node_database
node_httpclient -->|"HTTP requests"| node_entry
node_socketserver -->|"dispatches events"| node_socket

click node_app "https://github.com/harsha12a/justus/blob/master/client/src/App.tsx"
click node_signup "https://github.com/harsha12a/justus/blob/master/client/src/components/SignUp.tsx"
click node_login "https://github.com/harsha12a/justus/blob/master/client/src/components/Login.tsx"
click node_protected "https://github.com/harsha12a/justus/blob/master/client/src/components/ProtectedRoute.tsx"
click node_chatui "https://github.com/harsha12a/justus/blob/master/client/src/components/Chat.tsx"
click node_profile "https://github.com/harsha12a/justus/blob/master/client/src/components/Profile.tsx"
click node_state "https://github.com/harsha12a/justus/blob/master/client/src/redux/store.ts"
click node_clientapi "https://github.com/harsha12a/justus/blob/master/server/src/routers/chat.route.js"
click node_userapi "https://github.com/harsha12a/justus/blob/master/server/src/routers/user.route.js"
click node_messageapi "https://github.com/harsha12a/justus/blob/master/server/src/routers/message.route.js"
click node_entry "https://github.com/harsha12a/justus/blob/master/server/src/index.js"
click node_users "https://github.com/harsha12a/justus/blob/master/server/src/controllers/user.controller.js"
click node_chats "https://github.com/harsha12a/justus/blob/master/server/src/controllers/chat.controller.js"
click node_messages "https://github.com/harsha12a/justus/blob/master/server/src/controllers/message.controller.js"
click node_auth "https://github.com/harsha12a/justus/blob/master/server/src/middlewares/tokenVerify.js"
click node_socket "https://github.com/harsha12a/justus/blob/master/server/socket/socket.js"
click node_prisma "https://github.com/harsha12a/justus/blob/master/server/src/utils/prisma.config.js"
click node_database "https://github.com/harsha12a/justus/blob/master/server/prisma/schema.prisma"
click node_socketserver "https://github.com/harsha12a/justus/blob/master/server/src/index.js"

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_signup,node_login,node_protected,node_chatui,node_profile,node_state,node_visitor,node_httpclient toneBlue
class node_clientapi,node_userapi,node_messageapi,node_entry,node_users,node_chats,node_messages,node_auth toneAmber
class node_socket,node_socketserver toneMint
class node_prisma,node_database toneRose
```

## Components

### Web client

- [App router](https://github.com/harsha12a/justus/blob/master/client/src/App.tsx): `client/src/App.tsx`
- [Signup](https://github.com/harsha12a/justus/blob/master/client/src/components/SignUp.tsx): `client/src/components/SignUp.tsx`
- [Login](https://github.com/harsha12a/justus/blob/master/client/src/components/Login.tsx): `client/src/components/Login.tsx`
- [Protected routes](https://github.com/harsha12a/justus/blob/master/client/src/components/ProtectedRoute.tsx): `client/src/components/ProtectedRoute.tsx`
- [Chat view](https://github.com/harsha12a/justus/blob/master/client/src/components/Chat.tsx): `client/src/components/Chat.tsx`
- [Profile view](https://github.com/harsha12a/justus/blob/master/client/src/components/Profile.tsx): `client/src/components/Profile.tsx`
- [Persisted state](https://github.com/harsha12a/justus/blob/master/client/src/redux/store.ts): `client/src/redux/store.ts`

### HTTP service

- [Chat API](https://github.com/harsha12a/justus/blob/master/server/src/routers/chat.route.js): `server/src/routers/chat.route.js`
- [User API](https://github.com/harsha12a/justus/blob/master/server/src/routers/user.route.js): `server/src/routers/user.route.js`
- [Message API](https://github.com/harsha12a/justus/blob/master/server/src/routers/message.route.js): `server/src/routers/message.route.js`
- [HTTP entry](https://github.com/harsha12a/justus/blob/master/server/src/index.js): `server/src/index.js`
- [User operations](https://github.com/harsha12a/justus/blob/master/server/src/controllers/user.controller.js): `server/src/controllers/user.controller.js`
- [Chat operations](https://github.com/harsha12a/justus/blob/master/server/src/controllers/chat.controller.js): `server/src/controllers/chat.controller.js`
- [Message operations](https://github.com/harsha12a/justus/blob/master/server/src/controllers/message.controller.js): `server/src/controllers/message.controller.js`
- [Token verification](https://github.com/harsha12a/justus/blob/master/server/src/middlewares/tokenVerify.js): `server/src/middlewares/tokenVerify.js`

### Realtime messaging

- [Socket handlers](https://github.com/harsha12a/justus/blob/master/server/socket/socket.js): `server/socket/socket.js`
- [Socket.IO server](https://github.com/harsha12a/justus/blob/master/server/src/index.js): `server/src/index.js`

### Data persistence

- [Prisma client](https://github.com/harsha12a/justus/blob/master/server/src/utils/prisma.config.js): `server/src/utils/prisma.config.js`
- [Application database](https://github.com/harsha12a/justus/blob/master/server/prisma/schema.prisma): `server/prisma/schema.prisma`

### Other components

- **User**
- **Browser HTTP client**

## Connections

- User → App router: uses
- App router → Signup: routes
- App router → Login: routes
- App router → Protected routes: guards
- Protected routes → Chat view: allows
- Protected routes → Profile view: allows
- App router → Persisted state: renders within
- Signup → Browser HTTP client: posts signup
- HTTP entry → User API: mounts
- HTTP entry → Chat API: mounts
- HTTP entry → Message API: mounts
- HTTP entry → Socket.IO server: creates
- HTTP entry → Socket handlers: initializes
- Socket handlers → Message operations: calls save/delete
- User operations → Prisma client: reads/writes
- Chat operations → Prisma client: reads/writes
- Message operations → Prisma client: reads/writes
- Prisma client → Application database: accesses
- Browser HTTP client → HTTP entry: HTTP requests
- Socket.IO server → Socket handlers: dispatches events
