# haroonghaffar/connect architecture

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

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

## Overview

Connect is a social-posting application: users register or log in, browse and search, view profiles, and create posts with images, likes, and comments. The frontend routes users to feature pages, which use a shared API client; the Express server mounts authentication, post, and user routes, whose handlers access user/post models and Cloudinary uploads. The graph includes profile, search, and post workflows alongside authentication. Some frontend component internals and database wiring were not shown, so uncertain relationships are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/haroonghaffar/connect/blob/main/frontend/src/App.jsx) (Route application), [`frontend/src/services/api.js`](https://github.com/haroonghaffar/connect/blob/main/frontend/src/services/api.js) (API client), [`backend/routes/postRoutes.js`](https://github.com/haroonghaffar/connect/blob/main/backend/routes/postRoutes.js) (Post routes), [`backend/routes/userRoutes.js`](https://github.com/haroonghaffar/connect/blob/main/backend/routes/userRoutes.js) (User routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Route application<br/>[App.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_home["Post feed<br/>[Home.jsx]"]
  node_profile["Profile<br/>[Profile.jsx]"]
  node_search["User search<br/>[Search.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_backend["API application"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_postroutes["Post routes<br/>[postRoutes.js]"]
  node_userroutes["User routes<br/>[userRoutes.js]"]
  node_auth["Authentication<br/>[authController.js]"]
  node_posts["Post handling<br/>[postController.js]"]
  node_users["User handling<br/>[userController.js]"]
  node_protect["JWT protection<br/>[authMiddleware.js]"]
  node_upload["Image upload"]
end

subgraph group_domain["Domain data"]
  node_user_model["User model<br/>[User.js]"]
  node_post_model["Post model<br/>[Post.js]"]
end

subgraph group_integrations["External services"]
  node_cloudinary_config["Image service config<br/>[cloudinary.js]"]
  node_cloudinary["Cloudinary"]
end

node_visitor(("User"))

node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_search
node_login -->|"uses"| node_api
node_register -->|"uses"| node_api
node_home -->|"uses"| node_api
node_profile -->|"uses"| node_api
node_search -->|"uses"| node_api
node_home -->|"uses"| node_navbar
node_profile -->|"uses"| node_navbar
node_search -->|"uses"| node_navbar
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_postroutes
node_server -->|"mounts"| node_userroutes
node_authroutes -->|"dispatches"| node_auth
node_postroutes -->|"dispatches"| node_posts
node_userroutes -->|"dispatches"| node_users
node_postroutes -->|"uses"| node_protect
node_userroutes -->|"uses"| node_protect
node_postroutes -->|"uses"| node_upload
node_userroutes -->|"uses"| node_upload
node_auth -->|"queries"| node_user_model
node_protect -->|"loads user"| node_user_model
node_posts -->|"queries"| node_post_model
node_posts -->|"uploads via"| node_cloudinary_config
node_users -->|"queries"| node_user_model
node_users -->|"queries"| node_post_model
node_users -->|"uploads via"| node_cloudinary_config
node_cloudinary_config -->|"configures"| node_cloudinary
node_api -.->|"HTTP requests"| node_server
node_visitor -.->|"uses"| node_app

click node_app "https://github.com/haroonghaffar/connect/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Login.jsx"
click node_register "https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Register.jsx"
click node_home "https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Home.jsx"
click node_profile "https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Profile.jsx"
click node_search "https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Search.jsx"
click node_navbar "https://github.com/haroonghaffar/connect/blob/main/frontend/src/components/Navbar.jsx"
click node_api "https://github.com/haroonghaffar/connect/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/haroonghaffar/connect/blob/main/backend/server.js"
click node_authroutes "https://github.com/haroonghaffar/connect/blob/main/backend/routes/authRoutes.js"
click node_postroutes "https://github.com/haroonghaffar/connect/blob/main/backend/routes/postRoutes.js"
click node_userroutes "https://github.com/haroonghaffar/connect/blob/main/backend/routes/userRoutes.js"
click node_auth "https://github.com/haroonghaffar/connect/blob/main/backend/controllers/authController.js"
click node_posts "https://github.com/haroonghaffar/connect/blob/main/backend/controllers/postController.js"
click node_users "https://github.com/haroonghaffar/connect/blob/main/backend/controllers/userController.js"
click node_protect "https://github.com/haroonghaffar/connect/blob/main/backend/middleware/authMiddleware.js"
click node_upload "https://github.com/haroonghaffar/connect/blob/main/backend/middleware/uploadMiddleware.js"
click node_user_model "https://github.com/haroonghaffar/connect/blob/main/backend/models/User.js"
click node_post_model "https://github.com/haroonghaffar/connect/blob/main/backend/models/Post.js"
click node_cloudinary_config "https://github.com/haroonghaffar/connect/blob/main/backend/config/cloudinary.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_login,node_register,node_home,node_profile,node_search,node_navbar,node_api,node_visitor toneBlue
class node_server,node_authroutes,node_postroutes,node_userroutes,node_auth,node_posts,node_users,node_protect,node_upload toneAmber
class node_user_model,node_post_model toneMint
class node_cloudinary_config,node_cloudinary toneRose
```

## Components

### Web application

- [Route application](https://github.com/haroonghaffar/connect/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login](https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Registration](https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Register.jsx): `frontend/src/pages/Register.jsx`
- [Post feed](https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Profile](https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [User search](https://github.com/haroonghaffar/connect/blob/main/frontend/src/pages/Search.jsx): `frontend/src/pages/Search.jsx`
- [Navigation](https://github.com/haroonghaffar/connect/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [API client](https://github.com/haroonghaffar/connect/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API application

- [Express server](https://github.com/haroonghaffar/connect/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/haroonghaffar/connect/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Post routes](https://github.com/haroonghaffar/connect/blob/main/backend/routes/postRoutes.js): `backend/routes/postRoutes.js`
- [User routes](https://github.com/haroonghaffar/connect/blob/main/backend/routes/userRoutes.js): `backend/routes/userRoutes.js`
- [Authentication](https://github.com/haroonghaffar/connect/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Post handling](https://github.com/haroonghaffar/connect/blob/main/backend/controllers/postController.js): `backend/controllers/postController.js`
- [User handling](https://github.com/haroonghaffar/connect/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [JWT protection](https://github.com/haroonghaffar/connect/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Image upload](https://github.com/haroonghaffar/connect/blob/main/backend/middleware/uploadMiddleware.js): `backend/middleware/uploadMiddleware.js`

### Domain data

- [User model](https://github.com/haroonghaffar/connect/blob/main/backend/models/User.js): `backend/models/User.js`
- [Post model](https://github.com/haroonghaffar/connect/blob/main/backend/models/Post.js): `backend/models/Post.js`

### External services

- [Image service config](https://github.com/haroonghaffar/connect/blob/main/backend/config/cloudinary.js): `backend/config/cloudinary.js`
- **Cloudinary**

### Other components

- **User**

## Connections

- Route application → Login: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Registration: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Post feed: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Profile: routes to (evidence: `frontend/src/App.jsx`)
- Route application → User search: routes to (evidence: `frontend/src/App.jsx`)
- Login → API client: uses (evidence: `frontend/src/pages/Login.jsx`)
- Registration → API client: uses (evidence: `frontend/src/pages/Register.jsx`)
- Post feed → API client: uses (evidence: `frontend/src/pages/Home.jsx`)
- Profile → API client: uses (evidence: `frontend/src/pages/Profile.jsx`)
- User search → API client: uses (evidence: `frontend/src/pages/Search.jsx`)
- Post feed → Navigation: uses (evidence: `frontend/src/pages/Home.jsx`)
- Profile → Navigation: uses (evidence: `frontend/src/pages/Profile.jsx`)
- User search → Navigation: uses (evidence: `frontend/src/pages/Search.jsx`)
- Express server → Auth routes: mounts (evidence: `backend/server.js`)
- Express server → Post routes: mounts (evidence: `backend/server.js`)
- Express server → User routes: mounts (evidence: `backend/server.js`)
- Auth routes → Authentication: dispatches (evidence: `backend/routes/authRoutes.js`)
- Post routes → Post handling: dispatches (evidence: `backend/routes/postRoutes.js`)
- User routes → User handling: dispatches (evidence: `backend/routes/userRoutes.js`)
- Post routes → JWT protection: uses (evidence: `backend/routes/postRoutes.js`)
- User routes → JWT protection: uses (evidence: `backend/routes/userRoutes.js`)
- Post routes → Image upload: uses (evidence: `backend/routes/postRoutes.js`)
- User routes → Image upload: uses (evidence: `backend/routes/userRoutes.js`)
- Authentication → User model: queries (evidence: `backend/controllers/authController.js`)
- JWT protection → User model: loads user (evidence: `backend/middleware/authMiddleware.js`)
- Post handling → Post model: queries (evidence: `backend/controllers/postController.js`)
- Post handling → Image service config: uploads via (evidence: `backend/controllers/postController.js`)
- User handling → User model: queries (evidence: `backend/controllers/userController.js`)
- User handling → Post model: queries (evidence: `backend/controllers/userController.js`)
- User handling → Image service config: uploads via (evidence: `backend/controllers/userController.js`)
- Image service config → Cloudinary: configures (evidence: `backend/config/cloudinary.js`)
- API client → Express server: HTTP requests
- User → Route application: uses
