# hazzem-web/linkup-socialmedia architecture

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

- Interactive diagram: https://gitdiagram.com/hazzem-web/linkup-socialmedia
- Repository: https://github.com/hazzem-web/linkup-socialmedia

## Overview

LinkUp is an Express/TypeScript social-network backend. Its implemented request path starts at the app bootstrap, dispatches to feature routers, and handles authentication and profile operations through service and persistence layers. The README also describes posts, messaging, and media, though the sampled sources do not establish their internal behavior. Edges reflect the bootstrap, sampled calls, or explicit README claims; unsampled feature internals are left unconnected where their relationships are not evidenced.

Main entry points: [`src/app.controller.ts`](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/app.controller.ts) (App bootstrap), [`src/modules/auth/auth.service.ts`](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/auth/auth.service.ts) (Authentication), [`src/modules/users/user.service.ts`](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/users/user.service.ts) (Profile management), [`src/config/env.service.ts`](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/config/env.service.ts) (Environment config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP and realtime entry"]
  node_bootstrap["App bootstrap<br/>[app.controller.ts]"]
  node_server["Server entry<br/>[main.ts]"]
  node_middleware["Request middleware<br/>[auth.middleware.ts]"]
  node_validation["Request validation"]
  node_socket["Socket connection<br/>[app.controller.ts]"]
end

subgraph group_features["Social features"]
  node_authctl["Auth endpoints<br/>[auth.controller.ts]"]
  node_authsvc["Authentication<br/>[auth.service.ts]"]
  node_usersctl["Profile endpoints<br/>[user.controller.ts]"]
  node_usersvc["Profile management<br/>[user.service.ts]"]
  node_posts["Posts and engagement<br/>[post.controller.ts]"]
  node_messages["Messaging"]
end

subgraph group_platform["Identity and integrations"]
  node_redis[("Redis service<br/>[redis.service.ts]")]
  node_tokens["JWT tokens<br/>[token.service.ts]"]
  node_security["Password security"]
  node_email["Email events<br/>[email.events.ts]"]
  node_s3["Media storage<br/>[s3.service.ts]"]
  node_firebase["Push notifications"]
  node_config["Environment config<br/>[env.service.ts]"]
end

subgraph group_data["Persistence and models"]
  node_repository["Generic repository<br/>[base.repository.ts]"]
  node_models[("Social data models<br/>[post.model.ts]")]
end

node_client(("API client"))
node_mongo[("MongoDB")]
node_smtp["Email provider"]
node_aws[("AWS S3")]

node_client -->|"sends requests"| node_bootstrap
node_server -->|"starts app"| node_bootstrap
node_bootstrap -->|"mounts router"| node_authctl
node_bootstrap -->|"mounts router"| node_usersctl
node_bootstrap -->|"mounts router"| node_posts
node_bootstrap -->|"mounts router"| node_messages
node_authctl -->|"calls"| node_authsvc
node_usersctl -->|"calls"| node_usersvc
node_authctl -->|"uses"| node_validation
node_usersctl -->|"uses"| node_middleware
node_authsvc -->|"queries users"| node_repository
node_authsvc -->|"uses user model"| node_models
node_usersvc -->|"queries users"| node_repository
node_usersvc -->|"uses user model"| node_models
node_bootstrap -->|"connects database"| node_mongo
node_authsvc -->|"hashes passwords"| node_security
node_authsvc -->|"issues tokens"| node_tokens
node_authsvc -->|"checks OTP"| node_redis
node_middleware -->|"verifies bearer"| node_tokens
node_middleware -->|"checks revocation"| node_redis
node_authsvc -->|"emits email events"| node_email
node_email -->|"sends email"| node_smtp
node_usersvc -->|"manages profile media"| node_s3
node_s3 -->|"stores media"| node_aws
node_usersvc -->|"sends notification"| node_firebase
node_bootstrap -->|"opens socket server"| node_socket
node_repository -.->|"persists model queries"| node_mongo
node_config -->|"configures connection"| node_redis
node_config -->|"configures storage"| node_s3
node_config -->|"configures signatures"| node_tokens

click node_bootstrap "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/app.controller.ts"
click node_server "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/main.ts"
click node_middleware "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/middleware/auth.middleware.ts"
click node_validation "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/middleware/validation.middleware.ts"
click node_authctl "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/auth/auth.controller.ts"
click node_authsvc "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/auth/auth.service.ts"
click node_usersctl "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/users/user.controller.ts"
click node_usersvc "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/users/user.service.ts"
click node_posts "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/posts/post.controller.ts"
click node_messages "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/messages/message.controller.ts"
click node_socket "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/app.controller.ts"
click node_repository "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/database/repository/base.repository.ts"
click node_models "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/database/models/post.model.ts"
click node_redis "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/redis.service.ts"
click node_tokens "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/token.service.ts"
click node_security "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/security.service.ts"
click node_email "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/utils/email/email.events.ts"
click node_s3 "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/s3.service.ts"
click node_firebase "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/firebase.service.ts"
click node_config "https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/config/env.service.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_bootstrap,node_server,node_middleware,node_validation,node_socket,node_client toneBlue
class node_authctl,node_authsvc,node_usersctl,node_usersvc,node_posts,node_messages,node_mongo,node_aws toneAmber
class node_redis,node_tokens,node_security,node_email,node_s3,node_firebase,node_config toneMint
class node_repository,node_models toneRose
class node_smtp toneIndigo
```

## Components

### HTTP and realtime entry

- [App bootstrap](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/app.controller.ts): `src/app.controller.ts`
- [Server entry](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/main.ts): `src/main.ts`
- [Request middleware](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/middleware/auth.middleware.ts): `src/middleware/auth.middleware.ts`
- [Request validation](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/middleware/validation.middleware.ts): `src/middleware/validation.middleware.ts`
- [Socket connection](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/app.controller.ts): `src/app.controller.ts`

### Social features

- [Auth endpoints](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/auth/auth.controller.ts): `src/modules/auth/auth.controller.ts`
- [Authentication](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/auth/auth.service.ts): `src/modules/auth/auth.service.ts`
- [Profile endpoints](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/users/user.controller.ts): `src/modules/users/user.controller.ts`
- [Profile management](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/users/user.service.ts): `src/modules/users/user.service.ts`
- [Posts and engagement](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/posts/post.controller.ts): `src/modules/posts/post.controller.ts`
- [Messaging](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/modules/messages/message.controller.ts): `src/modules/messages/message.controller.ts`

### Identity and integrations

- [Redis service](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/redis.service.ts): `src/common/services/redis.service.ts`
- [JWT tokens](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/token.service.ts): `src/common/services/token.service.ts`
- [Password security](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/security.service.ts): `src/common/services/security.service.ts`
- [Email events](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/utils/email/email.events.ts): `src/common/utils/email/email.events.ts`
- [Media storage](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/s3.service.ts): `src/common/services/s3.service.ts`
- [Push notifications](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/common/services/firebase.service.ts): `src/common/services/firebase.service.ts`
- [Environment config](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/config/env.service.ts): `src/config/env.service.ts`

### Persistence and models

- [Generic repository](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/database/repository/base.repository.ts): `src/database/repository/base.repository.ts`
- [Social data models](https://github.com/hazzem-web/linkup-socialmedia/blob/master/src/database/models/post.model.ts): `src/database/models/post.model.ts`

### Other components

- **API client**
- **MongoDB**
- **Email provider**
- **AWS S3**

## Connections

- API client → App bootstrap: sends requests
- Server entry → App bootstrap: starts app (evidence: `src/main.ts`)
- App bootstrap → Auth endpoints: mounts router (evidence: `src/app.controller.ts`)
- App bootstrap → Profile endpoints: mounts router (evidence: `src/app.controller.ts`)
- App bootstrap → Posts and engagement: mounts router (evidence: `src/app.controller.ts`)
- App bootstrap → Messaging: mounts router (evidence: `src/app.controller.ts`)
- Auth endpoints → Authentication: calls (evidence: `src/modules/auth/auth.controller.ts`)
- Profile endpoints → Profile management: calls (evidence: `src/modules/users/user.controller.ts`)
- Auth endpoints → Request validation: uses (evidence: `src/modules/auth/auth.controller.ts`)
- Profile endpoints → Request middleware: uses (evidence: `src/modules/users/user.controller.ts`)
- Authentication → Generic repository: queries users (evidence: `src/modules/auth/auth.service.ts`)
- Authentication → Social data models: uses user model (evidence: `src/modules/auth/auth.service.ts`)
- Profile management → Generic repository: queries users (evidence: `src/modules/users/user.service.ts`)
- Profile management → Social data models: uses user model (evidence: `src/modules/users/user.service.ts`)
- App bootstrap → MongoDB: connects database (evidence: `src/app.controller.ts`)
- Authentication → Password security: hashes passwords (evidence: `src/modules/auth/auth.service.ts`)
- Authentication → JWT tokens: issues tokens (evidence: `src/modules/auth/auth.service.ts`)
- Authentication → Redis service: checks OTP (evidence: `src/modules/auth/auth.service.ts`)
- Request middleware → JWT tokens: verifies bearer (evidence: `src/middleware/auth.middleware.ts`)
- Request middleware → Redis service: checks revocation (evidence: `src/middleware/auth.middleware.ts`)
- Authentication → Email events: emits email events (evidence: `src/modules/auth/auth.service.ts`)
- Email events → Email provider: sends email (evidence: `README.md`)
- Profile management → Media storage: manages profile media (evidence: `src/modules/users/user.service.ts`)
- Media storage → AWS S3: stores media (evidence: `README.md`)
- Profile management → Push notifications: sends notification (evidence: `src/modules/users/user.service.ts`)
- App bootstrap → Socket connection: opens socket server (evidence: `src/app.controller.ts`)
- Generic repository → MongoDB: persists model queries
- Environment config → Redis service: configures connection (evidence: `src/common/services/redis.service.ts`)
- Environment config → Media storage: configures storage (evidence: `src/common/services/s3.service.ts`)
- Environment config → JWT tokens: configures signatures (evidence: `src/common/services/token.service.ts`)
