# abolfazlabdollahii/collegegram architecture

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

## Overview

Collegegram is a social-networking application: people register and verify accounts, then create and discover posts, interact with other users, and receive notifications. The web client exposes authenticated profile, post, search, explore, saved-post, friendship, and notification screens; the API mounts corresponding route families. Sampled controllers show post and user operations delegated to services, while authentication services use repositories and OTP/verification services. The tree documents search indexing and realtime support, but their detailed runtime wiring was not sampled.

Main entry points: [`apps/api/src/app.ts`](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/app.ts) (API app), [`apps/api/src/services/auth.service.ts`](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/auth.service.ts) (Auth service), [`apps/web/src/routes/AppRoutes.tsx`](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/web/src/routes/AppRoutes.tsx) (App routes), [`apps/api/src/controllers/user.controller.ts`](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/controllers/user.controller.ts) (User controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_webapp["Web entry<br/>[main.tsx]"]
  node_routes["App routes<br/>[AppRoutes.tsx]"]
  node_screens["Social screens"]
  node_webapi["Web API clients"]
  node_authctx["Auth context<br/>[AuthProvider.tsx]"]
end

subgraph group_api["API application"]
  node_apiapp["API app<br/>[app.ts]"]
  node_authroutes["Auth routes<br/>[auth.route.ts]"]
  node_userroutes["User routes<br/>[user.route.ts]"]
  node_postroutes["Post routes<br/>[post.route.ts]"]
  node_notifroutes["Notification routes"]
  node_searchroutes["Search routes<br/>[search.route.ts]"]
  node_friendroutes["Close-friend routes"]
  node_authcontroller["Auth controller<br/>[auth.controller.ts]"]
  node_usercontroller["User controller<br/>[user.controller.ts]"]
  node_postcontroller["Post controller<br/>[post.controller.ts]"]
end

subgraph group_domain["Social domain"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
  node_userservice["User service<br/>[user.service.ts]"]
  node_postservice["Post service<br/>[post.service.ts]"]
  node_commentservice["Comment service<br/>[comment.service.ts]"]
  node_notifservice["Notification service"]
  node_searchservice["Search services"]
end

subgraph group_data["Persistence and integrations"]
  node_authrepo["Auth repository<br/>[auth.repository.ts]"]
  node_postrepo["Post repository<br/>[post.repository.ts]"]
  node_userrepo["User repository<br/>[user.repository.ts]"]
  node_db[("Mongo models")]
end

node_person(("User"))
node_elastic[("Elasticsearch")]
node_redis[("Redis")]
node_email["Email provider"]
node_realtime(("Socket clients"))

node_person -->|"uses"| node_webapp
node_webapp -->|"renders"| node_routes
node_routes -->|"selects"| node_screens
node_routes -->|"protects"| node_authctx
node_screens -->|"requests"| node_webapi
node_webapi -->|"HTTP calls"| node_apiapp
node_apiapp -->|"mounts"| node_authroutes
node_apiapp -->|"mounts"| node_userroutes
node_apiapp -->|"mounts"| node_postroutes
node_apiapp -->|"mounts"| node_notifroutes
node_apiapp -->|"mounts"| node_searchroutes
node_apiapp -->|"mounts"| node_friendroutes
node_authroutes -->|"routes to"| node_authcontroller
node_userroutes -->|"routes to"| node_usercontroller
node_postroutes -->|"routes to"| node_postcontroller
node_authcontroller -->|"delegates"| node_authservice
node_authservice -->|"queries"| node_authrepo
node_authrepo -->|"reads/writes"| node_db
node_usercontroller -->|"delegates"| node_userservice
node_usercontroller -->|"delegates"| node_postservice
node_postcontroller -->|"delegates"| node_postservice
node_postcontroller -->|"delegates"| node_commentservice
node_postservice -->|"uses"| node_postrepo
node_postrepo -->|"reads/writes"| node_db
node_userservice -->|"uses"| node_userrepo
node_userrepo -->|"reads/writes"| node_db
node_authservice -.->|"sends mail"| node_email
node_authservice -.->|"indexes"| node_elastic
node_searchservice -.->|"searches"| node_elastic
node_notifservice -.->|"notifies"| node_realtime
node_notifservice -.->|"uses"| node_redis

click node_webapp "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/web/src/main.tsx"
click node_routes "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/web/src/routes/AppRoutes.tsx"
click node_screens "https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/web/src/pages"
click node_webapi "https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/web/src/api"
click node_authctx "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/web/src/context/AuthProvider.tsx"
click node_apiapp "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/app.ts"
click node_authroutes "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/auth.route.ts"
click node_userroutes "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/user.route.ts"
click node_postroutes "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/post.route.ts"
click node_notifroutes "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/notification.route.ts"
click node_searchroutes "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/search.route.ts"
click node_friendroutes "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/closeFriend.route.ts"
click node_authcontroller "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/controllers/auth.controller.ts"
click node_usercontroller "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/controllers/user.controller.ts"
click node_postcontroller "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/controllers/post.controller.ts"
click node_authservice "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/auth.service.ts"
click node_userservice "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/user.service.ts"
click node_postservice "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/post.service.ts"
click node_commentservice "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/comment.service.ts"
click node_notifservice "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/notification.service.ts"
click node_searchservice "https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/api/src/services"
click node_authrepo "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/repositories/auth.repository.ts"
click node_postrepo "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/repositories/post.repository.ts"
click node_userrepo "https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/repositories/user.repository.ts"
click node_db "https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/api/src/db/models"

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_webapp,node_routes,node_screens,node_webapi,node_authctx,node_person,node_realtime toneBlue
class node_apiapp,node_authroutes,node_userroutes,node_postroutes,node_notifroutes,node_searchroutes,node_friendroutes,node_authcontroller,node_usercontroller,node_postcontroller,node_elastic,node_redis toneAmber
class node_authservice,node_userservice,node_postservice,node_commentservice,node_notifservice,node_searchservice toneMint
class node_authrepo,node_postrepo,node_userrepo,node_db toneRose
class node_email toneIndigo
```

## Components

### Web client

- [Web entry](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/web/src/main.tsx): `apps/web/src/main.tsx`
- [App routes](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/web/src/routes/AppRoutes.tsx): `apps/web/src/routes/AppRoutes.tsx`
- [Social screens](https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/web/src/pages): `apps/web/src/pages`
- [Web API clients](https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/web/src/api): `apps/web/src/api`
- [Auth context](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/web/src/context/AuthProvider.tsx): `apps/web/src/context/AuthProvider.tsx`

### API application

- [API app](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/app.ts): `apps/api/src/app.ts`
- [Auth routes](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/auth.route.ts): `apps/api/src/routes/v1/auth.route.ts`
- [User routes](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/user.route.ts): `apps/api/src/routes/v1/user.route.ts`
- [Post routes](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/post.route.ts): `apps/api/src/routes/v1/post.route.ts`
- [Notification routes](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/notification.route.ts): `apps/api/src/routes/v1/notification.route.ts`
- [Search routes](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/search.route.ts): `apps/api/src/routes/v1/search.route.ts`
- [Close-friend routes](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/routes/v1/closeFriend.route.ts): `apps/api/src/routes/v1/closeFriend.route.ts`
- [Auth controller](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/controllers/auth.controller.ts): `apps/api/src/controllers/auth.controller.ts`
- [User controller](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/controllers/user.controller.ts): `apps/api/src/controllers/user.controller.ts`
- [Post controller](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/controllers/post.controller.ts): `apps/api/src/controllers/post.controller.ts`

### Social domain

- [Auth service](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/auth.service.ts): `apps/api/src/services/auth.service.ts`
- [User service](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/user.service.ts): `apps/api/src/services/user.service.ts`
- [Post service](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/post.service.ts): `apps/api/src/services/post.service.ts`
- [Comment service](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/comment.service.ts): `apps/api/src/services/comment.service.ts`
- [Notification service](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/services/notification.service.ts): `apps/api/src/services/notification.service.ts`
- [Search services](https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/api/src/services): `apps/api/src/services`

### Persistence and integrations

- [Auth repository](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/repositories/auth.repository.ts): `apps/api/src/repositories/auth.repository.ts`
- [Post repository](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/repositories/post.repository.ts): `apps/api/src/repositories/post.repository.ts`
- [User repository](https://github.com/abolfazlabdollahii/collegegram/blob/main/apps/api/src/repositories/user.repository.ts): `apps/api/src/repositories/user.repository.ts`
- [Mongo models](https://github.com/abolfazlabdollahii/collegegram/tree/main/apps/api/src/db/models): `apps/api/src/db/models`

### Other components

- **User**
- **Elasticsearch**
- **Redis**
- **Email provider**
- **Socket clients**

## Connections

- User → Web entry: uses
- Web entry → App routes: renders
- App routes → Social screens: selects
- App routes → Auth context: protects
- Social screens → Web API clients: requests
- Web API clients → API app: HTTP calls
- API app → Auth routes: mounts
- API app → User routes: mounts
- API app → Post routes: mounts
- API app → Notification routes: mounts
- API app → Search routes: mounts
- API app → Close-friend routes: mounts
- Auth routes → Auth controller: routes to
- User routes → User controller: routes to
- Post routes → Post controller: routes to
- Auth controller → Auth service: delegates
- Auth service → Auth repository: queries
- Auth repository → Mongo models: reads/writes
- User controller → User service: delegates
- User controller → Post service: delegates
- Post controller → Post service: delegates
- Post controller → Comment service: delegates
- Post service → Post repository: uses
- Post repository → Mongo models: reads/writes
- User service → User repository: uses
- User repository → Mongo models: reads/writes
- Auth service → Email provider: sends mail
- Auth service → Elasticsearch: indexes
- Search services → Elasticsearch: searches
- Notification service → Socket clients: notifies
- Notification service → Redis: uses
