# goutamchoudharydev/connectgram architecture

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

- Interactive diagram: https://gitdiagram.com/goutamchoudharydev/connectgram
- Repository: https://github.com/goutamchoudharydev/connectgram

## Overview

ConnectGram is a social app for account registration and verification, publishing media posts, browsing profiles and feeds, reacting and commenting, following users, and real-time messaging. The client routes users through authenticated pages and feature services to the API; server controllers own domain operations and use repositories for persisted data. Sampled controllers establish several repository and Cloudinary interactions; the tree documents other feature modules and socket support, but their detailed wiring was not sampled, so uncertain links are omitted.

Main entry points: [`client/src/routes/AppRoutes.tsx`](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/routes/AppRoutes.tsx) (App routes), [`server/src/modules/auth/auth.controller.ts`](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/auth/auth.controller.ts) (Auth controller), [`server/src/app.ts`](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/app.ts) (API application), [`client/src/services/axios.ts`](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/services/axios.ts) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client app"]
  node_routes["App routes<br/>[AppRoutes.tsx]"]
  node_authui["Auth pages<br/>[LoginPage.tsx]"]
  node_authsvc["Auth service<br/>[auth.service.ts]"]
  node_profileui["Profile page<br/>[ProfilePage.tsx]"]
  node_postui["Post pages<br/>[HomePage.tsx]"]
  node_chatsui["Chat page<br/>[MessagePage.tsx]"]
  node_api["HTTP client<br/>[axios.ts]"]
end

subgraph group_identity["Identity"]
  node_authroutes["Auth routes<br/>[auth.routes.ts]"]
  node_authctrl["Auth controller<br/>[auth.controller.ts]"]
  node_authrepo["User and verification data<br/>[user.repository.ts]"]
  node_emailrepo["Verification data access"]
  node_mailer["Email delivery"]
end

subgraph group_social["Social content"]
  node_postroutes["Post routes<br/>[post.routes.ts]"]
  node_postctrl["Post controller<br/>[post.controller.ts]"]
  node_postrepo["Post data<br/>[post.repository.ts]"]
  node_commentctrl["Comment controller"]
  node_commentrepo["Comment data"]
  node_likectrl["Like controller<br/>[like.controller.ts]"]
  node_likerepo["Like data<br/>[like.repository.ts]"]
end

subgraph group_community["Community"]
  node_followctrl["Follow controller"]
  node_followrepo["Follow data"]
  node_profilectrl["Profile controller"]
  node_chatroutes["Chat routes<br/>[chat.routes.ts]"]
  node_chatctrl["Chat controller<br/>[chat.controller.ts]"]
  node_chatrepo["Chat data<br/>[chat.repository.ts]"]
  node_socket["Realtime socket<br/>[socket.ts]"]
end

subgraph group_server["API and persistence"]
  node_db[("Relational database")]
  node_serverapp["API application<br/>[app.ts]"]
  node_authmw["Authentication middleware<br/>[auth.middleware.ts]"]
end

node_person(("User"))
node_mail["Mail service"]
node_cloudinary["Media storage"]

node_person -->|"navigates"| node_routes
node_routes -->|"routes to"| node_authui
node_routes -->|"routes to"| node_profileui
node_routes -->|"routes to"| node_postui
node_routes -->|"routes to"| node_chatsui
node_authui -->|"requests"| node_authsvc
node_authsvc -->|"sends HTTP"| node_api
node_profileui -->|"sends HTTP"| node_api
node_postui -->|"sends HTTP"| node_api
node_chatsui -->|"sends HTTP"| node_api
node_api -->|"calls API"| node_serverapp
node_serverapp -->|"mounts routes"| node_authroutes
node_serverapp -->|"mounts routes"| node_postroutes
node_serverapp -->|"mounts routes"| node_chatroutes
node_authroutes -->|"dispatches"| node_authctrl
node_postroutes -->|"dispatches"| node_postctrl
node_chatroutes -->|"dispatches"| node_chatctrl
node_authctrl -->|"reads/writes users"| node_authrepo
node_authctrl -->|"reads/writes codes"| node_emailrepo
node_authctrl -->|"sends verification"| node_mailer
node_mailer -->|"delivers email"| node_mail
node_authctrl -->|"issues tokens"| node_authmw
node_postctrl -->|"reads/writes posts"| node_postrepo
node_postctrl -->|"uploads media"| node_cloudinary
node_commentctrl -->|"looks up posts"| node_postrepo
node_commentctrl -->|"reads/writes comments"| node_commentrepo
node_likectrl -->|"looks up posts"| node_postrepo
node_likectrl -->|"reads/writes likes"| node_likerepo
node_followctrl -->|"looks up users"| node_authrepo
node_followctrl -->|"reads/writes follows"| node_followrepo
node_profilectrl -->|"reads/writes profile"| node_authrepo
node_profilectrl -->|"manages profile images"| node_cloudinary
node_chatctrl -->|"reads/writes conversations"| node_chatrepo
node_chatctrl -->|"looks up users"| node_authrepo
node_socket -.->|"realtime events"| node_person
node_db -->|"initializes for"| node_serverapp

click node_routes "https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/routes/AppRoutes.tsx"
click node_authui "https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/auth/pages/LoginPage.tsx"
click node_authsvc "https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/auth/services/auth.service.ts"
click node_profileui "https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/profile/pages/ProfilePage.tsx"
click node_postui "https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/post/pages/HomePage.tsx"
click node_chatsui "https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/chat/pages/MessagePage.tsx"
click node_api "https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/services/axios.ts"
click node_authroutes "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/auth/auth.routes.ts"
click node_authctrl "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/auth/auth.controller.ts"
click node_authrepo "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/user.repository.ts"
click node_emailrepo "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/emailVerification.repository.ts"
click node_mailer "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/utils/send-email.utils.ts"
click node_postroutes "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/post/post.routes.ts"
click node_postctrl "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/post/post.controller.ts"
click node_postrepo "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/post.repository.ts"
click node_commentctrl "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/comment/comment.controller.ts"
click node_commentrepo "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/comment.repository.ts"
click node_likectrl "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/like/like.controller.ts"
click node_likerepo "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/like.repository.ts"
click node_followctrl "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/follow/follow.controller.ts"
click node_followrepo "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/follow.repository.ts"
click node_profilectrl "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/profile/profile.controller.ts"
click node_chatroutes "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/chat/chat.routes.ts"
click node_chatctrl "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/chat/chat.controller.ts"
click node_chatrepo "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/chat.repository.ts"
click node_socket "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/socket/socket.ts"
click node_db "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/config/datasource.config.ts"
click node_serverapp "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/app.ts"
click node_authmw "https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/middleware/auth.middleware.ts"

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_routes,node_authui,node_authsvc,node_profileui,node_postui,node_chatsui,node_api,node_person toneBlue
class node_authroutes,node_authctrl,node_authrepo,node_emailrepo,node_mailer,node_cloudinary toneAmber
class node_postroutes,node_postctrl,node_postrepo,node_commentctrl,node_commentrepo,node_likectrl,node_likerepo toneMint
class node_followctrl,node_followrepo,node_profilectrl,node_chatroutes,node_chatctrl,node_chatrepo,node_socket toneRose
class node_db,node_serverapp,node_authmw,node_mail toneIndigo
```

## Components

### Client app

- [App routes](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/routes/AppRoutes.tsx): `client/src/routes/AppRoutes.tsx`
- [Auth pages](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/auth/pages/LoginPage.tsx): `client/src/features/auth/pages/LoginPage.tsx`
- [Auth service](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/auth/services/auth.service.ts): `client/src/features/auth/services/auth.service.ts`
- [Profile page](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/profile/pages/ProfilePage.tsx): `client/src/features/profile/pages/ProfilePage.tsx`
- [Post pages](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/post/pages/HomePage.tsx): `client/src/features/post/pages/HomePage.tsx`
- [Chat page](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/features/chat/pages/MessagePage.tsx): `client/src/features/chat/pages/MessagePage.tsx`
- [HTTP client](https://github.com/goutamchoudharydev/connectgram/blob/main/client/src/services/axios.ts): `client/src/services/axios.ts`

### Identity

- [Auth routes](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/auth/auth.routes.ts): `server/src/modules/auth/auth.routes.ts`
- [Auth controller](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/auth/auth.controller.ts): `server/src/modules/auth/auth.controller.ts`
- [User and verification data](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/user.repository.ts): `server/src/repositories/user.repository.ts`
- [Verification data access](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/emailVerification.repository.ts): `server/src/repositories/emailVerification.repository.ts`
- [Email delivery](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/utils/send-email.utils.ts): `server/src/utils/send-email.utils.ts`

### Social content

- [Post routes](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/post/post.routes.ts): `server/src/modules/post/post.routes.ts`
- [Post controller](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/post/post.controller.ts): `server/src/modules/post/post.controller.ts`
- [Post data](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/post.repository.ts): `server/src/repositories/post.repository.ts`
- [Comment controller](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/comment/comment.controller.ts): `server/src/modules/comment/comment.controller.ts`
- [Comment data](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/comment.repository.ts): `server/src/repositories/comment.repository.ts`
- [Like controller](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/like/like.controller.ts): `server/src/modules/like/like.controller.ts`
- [Like data](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/like.repository.ts): `server/src/repositories/like.repository.ts`

### Community

- [Follow controller](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/follow/follow.controller.ts): `server/src/modules/follow/follow.controller.ts`
- [Follow data](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/follow.repository.ts): `server/src/repositories/follow.repository.ts`
- [Profile controller](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/profile/profile.controller.ts): `server/src/modules/profile/profile.controller.ts`
- [Chat routes](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/chat/chat.routes.ts): `server/src/modules/chat/chat.routes.ts`
- [Chat controller](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/chat/chat.controller.ts): `server/src/modules/chat/chat.controller.ts`
- [Chat data](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/repositories/chat.repository.ts): `server/src/repositories/chat.repository.ts`
- [Realtime socket](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/modules/socket/socket.ts): `server/src/modules/socket/socket.ts`

### API and persistence

- [Relational database](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/config/datasource.config.ts): `server/src/config/datasource.config.ts`
- [API application](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/app.ts): `server/src/app.ts`
- [Authentication middleware](https://github.com/goutamchoudharydev/connectgram/blob/main/server/src/middleware/auth.middleware.ts): `server/src/middleware/auth.middleware.ts`

### Other components

- **User**
- **Mail service**
- **Media storage**

## Connections

- User → App routes: navigates
- App routes → Auth pages: routes to
- App routes → Profile page: routes to
- App routes → Post pages: routes to
- App routes → Chat page: routes to
- Auth pages → Auth service: requests
- Auth service → HTTP client: sends HTTP
- Profile page → HTTP client: sends HTTP
- Post pages → HTTP client: sends HTTP
- Chat page → HTTP client: sends HTTP
- HTTP client → API application: calls API
- API application → Auth routes: mounts routes
- API application → Post routes: mounts routes
- API application → Chat routes: mounts routes
- Auth routes → Auth controller: dispatches
- Post routes → Post controller: dispatches
- Chat routes → Chat controller: dispatches
- Auth controller → User and verification data: reads/writes users
- Auth controller → Verification data access: reads/writes codes
- Auth controller → Email delivery: sends verification
- Email delivery → Mail service: delivers email
- Auth controller → Authentication middleware: issues tokens
- Post controller → Post data: reads/writes posts
- Post controller → Media storage: uploads media
- Comment controller → Post data: looks up posts
- Comment controller → Comment data: reads/writes comments
- Like controller → Post data: looks up posts
- Like controller → Like data: reads/writes likes
- Follow controller → User and verification data: looks up users
- Follow controller → Follow data: reads/writes follows
- Profile controller → User and verification data: reads/writes profile
- Profile controller → Media storage: manages profile images
- Chat controller → Chat data: reads/writes conversations
- Chat controller → User and verification data: looks up users
- Realtime socket → User: realtime events
- Relational database → API application: initializes for
