# ankit0514/skillswap-platform architecture

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

- Interactive diagram: https://gitdiagram.com/ankit0514/skillswap-platform
- Repository: https://github.com/ankit0514/skillswap-platform

## Overview

SkillSwap is a peer-to-peer skill exchange web application. Users create profiles listing skills to teach and learn, discover potential partners through search or AI recommendations, propose and manage swaps, and communicate through chat. The client routes users to these product areas and uses an API service to reach the Express server; the server mounts feature routes, whose handlers manage domain data. The tree and excerpts establish the main areas, but do not show all client API calls or Socket.io event wiring, so those connections are kept high-level.

Main entry points: [`client/src/App.js`](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/App.js) (Route application), [`server/src/server.js`](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/server.js) (HTTP server), [`client/src/services/api.js`](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/services/api.js) (API service), [`server/src/models/User.js`](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/User.js) (User records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Route application<br/>[App.js]"]
  node_auth_ui["Login and signup"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_explore["Explore people<br/>[Explore.jsx]"]
  node_profile["Profile and skills<br/>[Profile.jsx]"]
  node_swaps_ui["Swap management<br/>[MySwaps.jsx]"]
  node_auth_context["Auth context<br/>[AuthContext.jsx]"]
  node_api_client["API service<br/>[api.js]"]
end

subgraph group_api["API and access"]
  node_server["HTTP server<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_mongodb[("MongoDB")]
end

subgraph group_exchange["Discovery and exchange"]
  node_user_routes["User routes<br/>[userRoutes.js]"]
  node_swap_routes["Swap routes<br/>[swapRoutes.js]"]
  node_ai_routes["AI routes<br/>[aiRoutes.js]"]
  node_user_controller["User handlers<br/>[userController.js]"]
  node_swap_controller["Swap handlers<br/>[swapController.js]"]
  node_ai_controller["Recommendation handler<br/>[aiController.js]"]
  node_user_model["User records<br/>[User.js]"]
  node_swap_model["Swap records<br/>[SwapRequest.js]"]
end

subgraph group_messaging["Messaging"]
  node_messages_ui["Messages UI<br/>[Messages.jsx]"]
  node_socket_context["Socket context<br/>[SocketContext.jsx]"]
  node_chat_routes["Chat routes<br/>[chatRoutes.js]"]
  node_chat_controller["Chat handlers<br/>[chatController.js]"]
  node_chat_model["Chat records<br/>[Chat.js]"]
  node_message_model["Message records<br/>[Message.js]"]
  node_socket_server["Socket.io server<br/>[socket.js]"]
end

node_student(("Student"))
node_gemini["Gemini API"]

node_student -->|"uses"| node_app
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_explore
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_swaps_ui
node_app -->|"routes to"| node_messages_ui
node_app -->|"provides auth"| node_auth_context
node_app -->|"provides sockets"| node_socket_context
node_auth_ui -->|"requests auth"| node_api_client
node_dashboard -->|"requests data"| node_api_client
node_explore -->|"searches people"| node_api_client
node_profile -->|"updates profile"| node_api_client
node_explore -.->|"requests recommendations"| node_ai_routes
node_swaps_ui -->|"manages swaps"| node_api_client
node_messages_ui -->|"loads messages"| node_api_client
node_messages_ui -->|"uses realtime"| node_socket_context
node_api_client -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_swap_routes
node_server -->|"mounts"| node_ai_routes
node_server -->|"mounts"| node_chat_routes
node_server -->|"initializes"| node_socket_server
node_user_routes -->|"dispatches"| node_user_controller
node_swap_routes -->|"dispatches"| node_swap_controller
node_ai_routes -->|"dispatches"| node_ai_controller
node_chat_routes -->|"dispatches"| node_chat_controller
node_user_controller -->|"reads and updates"| node_user_model
node_swap_controller -->|"checks users"| node_user_model
node_swap_controller -->|"manages requests"| node_swap_model
node_ai_controller -->|"finds matches"| node_user_model
node_ai_controller -.->|"ranks matches"| node_gemini
node_chat_controller -->|"checks participant"| node_user_model
node_chat_controller -->|"finds and updates"| node_chat_model
node_chat_controller -->|"stores messages"| node_message_model
node_user_model -->|"persists"| node_mongodb
node_swap_model -->|"persists"| node_mongodb
node_chat_model -->|"persists"| node_mongodb
node_message_model -->|"persists"| node_mongodb

click node_app "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/App.js"
click node_auth_ui "https://github.com/ankit0514/skillswap-platform/tree/main/client/src/pages/Auth"
click node_dashboard "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Dashboard.jsx"
click node_explore "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Explore.jsx"
click node_profile "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Profile.jsx"
click node_swaps_ui "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/MySwaps.jsx"
click node_messages_ui "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Messages.jsx"
click node_auth_context "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/context/AuthContext.jsx"
click node_socket_context "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/context/SocketContext.jsx"
click node_api_client "https://github.com/ankit0514/skillswap-platform/blob/main/client/src/services/api.js"
click node_server "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/server.js"
click node_auth_routes "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/authRoutes.js"
click node_user_routes "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/userRoutes.js"
click node_swap_routes "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/swapRoutes.js"
click node_ai_routes "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/aiRoutes.js"
click node_chat_routes "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/chatRoutes.js"
click node_user_controller "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/userController.js"
click node_swap_controller "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/swapController.js"
click node_ai_controller "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/aiController.js"
click node_chat_controller "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/chatController.js"
click node_user_model "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/User.js"
click node_swap_model "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/SwapRequest.js"
click node_chat_model "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/Chat.js"
click node_message_model "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/Message.js"
click node_socket_server "https://github.com/ankit0514/skillswap-platform/blob/main/server/src/config/socket.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_auth_ui,node_dashboard,node_explore,node_profile,node_swaps_ui,node_auth_context,node_api_client toneBlue
class node_server,node_auth_routes,node_mongodb toneAmber
class node_user_routes,node_swap_routes,node_ai_routes,node_user_controller,node_swap_controller,node_ai_controller,node_user_model,node_swap_model,node_gemini toneMint
class node_messages_ui,node_socket_context,node_chat_routes,node_chat_controller,node_chat_model,node_message_model,node_socket_server toneRose
class node_student toneIndigo
```

## Components

### Web client

- [Route application](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/App.js): `client/src/App.js`
- [Login and signup](https://github.com/ankit0514/skillswap-platform/tree/main/client/src/pages/Auth): `client/src/pages/Auth`
- [Dashboard](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Explore people](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Explore.jsx): `client/src/pages/Explore.jsx`
- [Profile and skills](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Swap management](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/MySwaps.jsx): `client/src/pages/MySwaps.jsx`
- [Auth context](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [API service](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/services/api.js): `client/src/services/api.js`

### API and access

- [HTTP server](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/server.js): `server/src/server.js`
- [Auth routes](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/authRoutes.js): `server/src/routes/authRoutes.js`
- **MongoDB**

### Discovery and exchange

- [User routes](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/userRoutes.js): `server/src/routes/userRoutes.js`
- [Swap routes](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/swapRoutes.js): `server/src/routes/swapRoutes.js`
- [AI routes](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/aiRoutes.js): `server/src/routes/aiRoutes.js`
- [User handlers](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/userController.js): `server/src/controllers/userController.js`
- [Swap handlers](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/swapController.js): `server/src/controllers/swapController.js`
- [Recommendation handler](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/aiController.js): `server/src/controllers/aiController.js`
- [User records](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/User.js): `server/src/models/User.js`
- [Swap records](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/SwapRequest.js): `server/src/models/SwapRequest.js`

### Messaging

- [Messages UI](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/pages/Messages.jsx): `client/src/pages/Messages.jsx`
- [Socket context](https://github.com/ankit0514/skillswap-platform/blob/main/client/src/context/SocketContext.jsx): `client/src/context/SocketContext.jsx`
- [Chat routes](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/routes/chatRoutes.js): `server/src/routes/chatRoutes.js`
- [Chat handlers](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/controllers/chatController.js): `server/src/controllers/chatController.js`
- [Chat records](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/Chat.js): `server/src/models/Chat.js`
- [Message records](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/models/Message.js): `server/src/models/Message.js`
- [Socket.io server](https://github.com/ankit0514/skillswap-platform/blob/main/server/src/config/socket.js): `server/src/config/socket.js`

### Other components

- **Student**
- **Gemini API**

## Connections

- Student → Route application: uses
- Route application → Login and signup: routes to
- Route application → Dashboard: routes to
- Route application → Explore people: routes to
- Route application → Profile and skills: routes to
- Route application → Swap management: routes to
- Route application → Messages UI: routes to
- Route application → Auth context: provides auth
- Route application → Socket context: provides sockets
- Login and signup → API service: requests auth
- Dashboard → API service: requests data
- Explore people → API service: searches people
- Profile and skills → API service: updates profile
- Explore people → AI routes: requests recommendations
- Swap management → API service: manages swaps
- Messages UI → API service: loads messages
- Messages UI → Socket context: uses realtime
- API service → HTTP server: HTTP requests
- HTTP server → Auth routes: mounts
- HTTP server → User routes: mounts
- HTTP server → Swap routes: mounts
- HTTP server → AI routes: mounts
- HTTP server → Chat routes: mounts
- HTTP server → Socket.io server: initializes
- User routes → User handlers: dispatches
- Swap routes → Swap handlers: dispatches
- AI routes → Recommendation handler: dispatches
- Chat routes → Chat handlers: dispatches
- User handlers → User records: reads and updates
- Swap handlers → User records: checks users
- Swap handlers → Swap records: manages requests
- Recommendation handler → User records: finds matches
- Recommendation handler → Gemini API: ranks matches
- Chat handlers → User records: checks participant
- Chat handlers → Chat records: finds and updates
- Chat handlers → Message records: stores messages
- User records → MongoDB: persists
- Swap records → MongoDB: persists
- Chat records → MongoDB: persists
- Message records → MongoDB: persists
