# burakorkmez/tinder-clone architecture

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

- Interactive diagram: https://gitdiagram.com/burakorkmez/tinder-clone
- Repository: https://github.com/burakorkmez/tinder-clone

## Overview

Tinder Clone’s main workflow is account access, profile setup, browsing eligible profiles, swiping to create mutual matches, then chatting with matches. The client routes pages and uses Zustand stores for API and socket interactions; the Express server mounts protected routes whose controllers update MongoDB models and emit real-time events. The README also documents image uploads and notifications; source-index references support their subsystem placement, though some implementation details were not excerpted. Dashed socket links mark the client/server event connection where the shown excerpts do not establish the full wiring.

Main entry points: [`api/server.js`](https://github.com/burakorkmez/tinder-clone/blob/master/api/server.js) (HTTP server), [`client/src/App.jsx`](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/App.jsx) (App routing), [`api/middleware/auth.js`](https://github.com/burakorkmez/tinder-clone/blob/master/api/middleware/auth.js) (JWT guard), [`client/src/store/useAuthStore.js`](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useAuthStore.js) (Auth state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_authpage["Authentication page<br/>[AuthPage.jsx]"]
  node_home["Discovery page<br/>[HomePage.jsx]"]
  node_profilepage["Profile page<br/>[ProfilePage.jsx]"]
  node_chatpage["Chat page<br/>[ChatPage.jsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_authstore["Auth state<br/>[useAuthStore.js]"]
  node_userstore["Profile state<br/>[useUserStore.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_authcontroller["Auth operations<br/>[authController.js]"]
  node_authguard["JWT guard<br/>[auth.js]"]
  node_useroutes["User routes<br/>[userRoutes.js]"]
  node_usercontroller["Profile operations<br/>[userController.js]"]
  node_usermodel[("User records<br/>[User.js]")]
  node_cloudinary["Image hosting<br/>[cloudinary.js]"]
end

subgraph group_matching["Discovery and matching"]
  node_matchstore["Match state<br/>[useMatchStore.js]"]
  node_matchroutes["Match routes<br/>[matchRoutes.js]"]
  node_matchcontroller["Match logic<br/>[matchController.js]"]
end

subgraph group_messaging["Chat and realtime"]
  node_message_store["Message state<br/>[useMessageStore.js]"]
  node_messageroutes["Message routes<br/>[messageRoutes.js]"]
  node_messagecontroller["Message operations"]
  node_messagemodel[("Message records<br/>[Message.js]")]
  node_clientsocket["Socket client<br/>[socket.client.js]"]
  node_serversocket["Socket server<br/>[socket.server.js]"]
end

node_person(("User"))
node_server["HTTP server<br/>[server.js]"]
node_database[("MongoDB")]
node_image_service["Cloudinary service"]

node_person -->|"uses"| node_app
node_app -->|"checks session"| node_authstore
node_app -->|"routes to"| node_authpage
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_profilepage
node_app -->|"routes to"| node_chatpage
node_authpage -->|"submits credentials"| node_authstore
node_home -->|"loads and swipes"| node_matchstore
node_profilepage -->|"updates profile"| node_userstore
node_chatpage -->|"loads chat"| node_message_store
node_authstore -->|"initializes socket"| node_clientsocket
node_authstore -->|"calls auth API"| node_authroutes
node_userstore -->|"calls user API"| node_useroutes
node_matchstore -->|"calls match API"| node_matchroutes
node_message_store -->|"calls message API"| node_messageroutes
node_message_store -->|"subscribes to events"| node_clientsocket
node_matchstore -->|"subscribes to matches"| node_clientsocket
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_useroutes
node_server -->|"mounts routes"| node_matchroutes
node_server -->|"mounts routes"| node_messageroutes
node_server -->|"initializes socket"| node_serversocket
node_server -->|"connects"| node_database
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"protects session route"| node_authguard
node_useroutes -->|"protects routes"| node_authguard
node_useroutes -->|"dispatches"| node_usercontroller
node_matchroutes -->|"protects routes"| node_authguard
node_matchroutes -->|"dispatches"| node_matchcontroller
node_messageroutes -->|"protects routes"| node_authguard
node_messageroutes -->|"dispatches"| node_messagecontroller
node_authguard -->|"loads user"| node_usermodel
node_authcontroller -->|"reads and writes"| node_usermodel
node_usercontroller -->|"updates profile"| node_usermodel
node_usercontroller -->|"uploads image"| node_cloudinary
node_cloudinary -.->|"stores images"| node_image_service
node_matchcontroller -->|"filters and updates"| node_usermodel
node_matchcontroller -->|"emits match events"| node_serversocket
node_messagecontroller -->|"reads and writes"| node_messagemodel
node_messagecontroller -->|"emits messages"| node_serversocket
node_serversocket -.->|"sends realtime events"| node_clientsocket

click node_app "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/App.jsx"
click node_authpage "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/AuthPage.jsx"
click node_home "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/HomePage.jsx"
click node_profilepage "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/ProfilePage.jsx"
click node_chatpage "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/ChatPage.jsx"
click node_authstore "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useAuthStore.js"
click node_userstore "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useUserStore.js"
click node_authroutes "https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/authRoutes.js"
click node_authcontroller "https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/authController.js"
click node_authguard "https://github.com/burakorkmez/tinder-clone/blob/master/api/middleware/auth.js"
click node_useroutes "https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/userRoutes.js"
click node_usercontroller "https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/userController.js"
click node_usermodel "https://github.com/burakorkmez/tinder-clone/blob/master/api/models/User.js"
click node_cloudinary "https://github.com/burakorkmez/tinder-clone/blob/master/api/config/cloudinary.js"
click node_matchstore "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useMatchStore.js"
click node_matchroutes "https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/matchRoutes.js"
click node_matchcontroller "https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/matchController.js"
click node_message_store "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useMessageStore.js"
click node_messageroutes "https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/messageRoutes.js"
click node_messagecontroller "https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/messageController.js"
click node_messagemodel "https://github.com/burakorkmez/tinder-clone/blob/master/api/models/Message.js"
click node_clientsocket "https://github.com/burakorkmez/tinder-clone/blob/master/client/src/socket/socket.client.js"
click node_serversocket "https://github.com/burakorkmez/tinder-clone/blob/master/api/socket/socket.server.js"
click node_server "https://github.com/burakorkmez/tinder-clone/blob/master/api/server.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_authpage,node_home,node_profilepage,node_chatpage,node_person toneBlue
class node_authstore,node_userstore,node_authroutes,node_authcontroller,node_authguard,node_useroutes,node_usercontroller,node_usermodel,node_cloudinary,node_database toneAmber
class node_matchstore,node_matchroutes,node_matchcontroller,node_server toneMint
class node_message_store,node_messageroutes,node_messagecontroller,node_messagemodel,node_clientsocket,node_serversocket toneRose
class node_image_service toneIndigo
```

## Components

### Client experience

- [App routing](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/App.jsx): `client/src/App.jsx`
- [Authentication page](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/AuthPage.jsx): `client/src/pages/AuthPage.jsx`
- [Discovery page](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/HomePage.jsx): `client/src/pages/HomePage.jsx`
- [Profile page](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/ProfilePage.jsx): `client/src/pages/ProfilePage.jsx`
- [Chat page](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/pages/ChatPage.jsx): `client/src/pages/ChatPage.jsx`

### Identity and profiles

- [Auth state](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useAuthStore.js): `client/src/store/useAuthStore.js`
- [Profile state](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useUserStore.js): `client/src/store/useUserStore.js`
- [Auth routes](https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/authRoutes.js): `api/routes/authRoutes.js`
- [Auth operations](https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/authController.js): `api/controllers/authController.js`
- [JWT guard](https://github.com/burakorkmez/tinder-clone/blob/master/api/middleware/auth.js): `api/middleware/auth.js`
- [User routes](https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/userRoutes.js): `api/routes/userRoutes.js`
- [Profile operations](https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/userController.js): `api/controllers/userController.js`
- [User records](https://github.com/burakorkmez/tinder-clone/blob/master/api/models/User.js): `api/models/User.js`
- [Image hosting](https://github.com/burakorkmez/tinder-clone/blob/master/api/config/cloudinary.js): `api/config/cloudinary.js`

### Discovery and matching

- [Match state](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useMatchStore.js): `client/src/store/useMatchStore.js`
- [Match routes](https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/matchRoutes.js): `api/routes/matchRoutes.js`
- [Match logic](https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/matchController.js): `api/controllers/matchController.js`

### Chat and realtime

- [Message state](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/store/useMessageStore.js): `client/src/store/useMessageStore.js`
- [Message routes](https://github.com/burakorkmez/tinder-clone/blob/master/api/routes/messageRoutes.js): `api/routes/messageRoutes.js`
- [Message operations](https://github.com/burakorkmez/tinder-clone/blob/master/api/controllers/messageController.js): `api/controllers/messageController.js`
- [Message records](https://github.com/burakorkmez/tinder-clone/blob/master/api/models/Message.js): `api/models/Message.js`
- [Socket client](https://github.com/burakorkmez/tinder-clone/blob/master/client/src/socket/socket.client.js): `client/src/socket/socket.client.js`
- [Socket server](https://github.com/burakorkmez/tinder-clone/blob/master/api/socket/socket.server.js): `api/socket/socket.server.js`

### Other components

- **User**
- [HTTP server](https://github.com/burakorkmez/tinder-clone/blob/master/api/server.js): `api/server.js`
- **MongoDB**
- **Cloudinary service**

## Connections

- User → App routing: uses
- App routing → Auth state: checks session (evidence: `client/src/App.jsx`)
- App routing → Authentication page: routes to (evidence: `client/src/App.jsx`)
- App routing → Discovery page: routes to (evidence: `client/src/App.jsx`)
- App routing → Profile page: routes to (evidence: `client/src/App.jsx`)
- App routing → Chat page: routes to (evidence: `client/src/App.jsx`)
- Authentication page → Auth state: submits credentials (evidence: `client/src/pages/AuthPage.jsx`)
- Discovery page → Match state: loads and swipes (evidence: `client/src/pages/HomePage.jsx`)
- Profile page → Profile state: updates profile (evidence: `client/src/pages/ProfilePage.jsx`)
- Chat page → Message state: loads chat (evidence: `client/src/pages/ChatPage.jsx`)
- Auth state → Socket client: initializes socket (evidence: `client/src/store/useAuthStore.js`)
- Auth state → Auth routes: calls auth API (evidence: `client/src/store/useAuthStore.js`)
- Profile state → User routes: calls user API (evidence: `client/src/store/useUserStore.js`)
- Match state → Match routes: calls match API (evidence: `client/src/store/useMatchStore.js`)
- Message state → Message routes: calls message API (evidence: `client/src/store/useMessageStore.js`)
- Message state → Socket client: subscribes to events (evidence: `client/src/store/useMessageStore.js`)
- Match state → Socket client: subscribes to matches (evidence: `client/src/store/useMatchStore.js`)
- HTTP server → Auth routes: mounts routes (evidence: `api/server.js`)
- HTTP server → User routes: mounts routes (evidence: `api/server.js`)
- HTTP server → Match routes: mounts routes (evidence: `api/server.js`)
- HTTP server → Message routes: mounts routes (evidence: `api/server.js`)
- HTTP server → Socket server: initializes socket (evidence: `api/server.js`)
- HTTP server → MongoDB: connects (evidence: `api/server.js`)
- Auth routes → Auth operations: dispatches (evidence: `api/routes/authRoutes.js`)
- Auth routes → JWT guard: protects session route (evidence: `api/routes/authRoutes.js`)
- User routes → JWT guard: protects routes (evidence: `api/routes/userRoutes.js`)
- User routes → Profile operations: dispatches (evidence: `api/routes/userRoutes.js`)
- Match routes → JWT guard: protects routes (evidence: `api/routes/matchRoutes.js`)
- Match routes → Match logic: dispatches (evidence: `api/routes/matchRoutes.js`)
- Message routes → JWT guard: protects routes (evidence: `api/routes/messageRoutes.js`)
- Message routes → Message operations: dispatches (evidence: `api/routes/messageRoutes.js`)
- JWT guard → User records: loads user (evidence: `api/middleware/auth.js`)
- Auth operations → User records: reads and writes (evidence: `api/controllers/authController.js`)
- Profile operations → User records: updates profile (evidence: `api/controllers/userController.js`)
- Profile operations → Image hosting: uploads image (evidence: `api/controllers/userController.js`)
- Image hosting → Cloudinary service: stores images
- Match logic → User records: filters and updates (evidence: `api/controllers/matchController.js`)
- Match logic → Socket server: emits match events (evidence: `api/controllers/matchController.js`)
- Message operations → Message records: reads and writes (evidence: `api/controllers/messageController.js`)
- Message operations → Socket server: emits messages (evidence: `api/controllers/messageController.js`)
- Socket server → Socket client: sends realtime events
