# anushkagupta12/skillswap architecture

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

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

## Overview

SkillSwap is a skill-barter platform: users create profiles, discover and rank complementary skills, send swap requests, and communicate through persisted real-time chat. The graph follows the documented user-to-result journey while showing backend persistence, authentication, and socket presence as supporting layers. Several UI and API capabilities are documented but their implementation was not excerpted; those modules are represented at their exact tree paths, with links limited to evidenced calls or README statements.

Main entry points: [`frontend/src/App.jsx`](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/context/AuthContext.jsx`](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/AuthContext.jsx) (Auth state), [`frontend/src/pages/Chat.jsx`](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Chat.jsx) (Chat experience), [`frontend/src/context/SocketContext.jsx`](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/SocketContext.jsx) (Socket client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_routes["App routing<br/>[App.jsx]"]
  node_notifications["Live swap alerts<br/>[SocketContext.jsx]"]
  node_navbar["Navigation and inbox<br/>[Navbar.jsx]"]
  node_toast["Toast feedback<br/>[ToastContext.jsx]"]
  node_avatar["Avatar<br/>[Avatar.jsx]"]
  node_spinner["Loading indicator<br/>[Spinner.jsx]"]
  node_community["Community content<br/>[Community.jsx]"]
  node_feedback["Feedback content<br/>[Feedback.jsx]"]
  node_home["Landing page<br/>[Home.jsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth_ui["Auth state<br/>[AuthContext.jsx]"]
  node_auth_pages["Sign in / register"]
  node_profile_page["Profile editor<br/>[Profile.jsx]"]
  node_user_profile["Member profile<br/>[UserProfile.jsx]"]
  node_skill_input["Skill editor<br/>[SkillInput.jsx]"]
end

subgraph group_discovery["Skill discovery and swaps"]
  node_browse["Browse and search<br/>[Browse.jsx]"]
  node_matches["Match rankings<br/>[Matches.jsx]"]
  node_matching_ui["Matching presentation<br/>[SmartMatching.jsx]"]
  node_user_card["Member cards<br/>[UserCard.jsx]"]
  node_swap_requests["Swap request APIs<br/>[users.js]"]
end

subgraph group_messaging["Messaging and presence"]
  node_chat_page["Chat experience<br/>[Chat.jsx]"]
  node_chat_ui["Chat display<br/>[ChatUI.jsx]"]
  node_socket_context["Socket client<br/>[SocketContext.jsx]"]
  node_socket_server["Socket server<br/>[server.js]"]
  node_chat_api["Chat APIs<br/>[chat.js]"]
end

subgraph group_platform["API and persistence"]
  node_user_model[("User records<br/>[User.js]")]
  node_auth_routes["Auth API<br/>[auth.js]"]
  node_jwt_guard["JWT protection<br/>[auth.js]"]
  node_chat_models[("Conversations and messages<br/>[Chat.js]")]
  node_database[("MongoDB")]
  node_server["Express API server<br/>[server.js]"]
  node_db_connector["Database connector<br/>[db.js]"]
end

node_visitor(("Visitor / member"))

node_visitor -->|"uses"| node_routes
node_routes -->|"provides"| node_auth_ui
node_routes -->|"routes to"| node_auth_pages
node_routes -->|"routes to"| node_browse
node_routes -->|"routes to"| node_matches
node_routes -->|"routes to"| node_chat_page
node_routes -->|"routes to"| node_user_profile
node_routes -->|"routes to"| node_profile_page
node_auth_pages -->|"calls auth"| node_auth_ui
node_auth_pages -->|"requests"| node_auth_routes
node_auth_ui -->|"loads identity"| node_auth_routes
node_profile_page -->|"updates profile"| node_auth_ui
node_auth_routes -->|"guards profile"| node_jwt_guard
node_auth_routes -->|"reads and updates"| node_user_model
node_jwt_guard -->|"loads user"| node_user_model
node_user_model -.->|"persists"| node_database
node_browse -->|"renders"| node_user_card
node_browse -->|"requests users"| node_auth_ui
node_matches -->|"renders"| node_user_card
node_matches -.->|"presents matches"| node_matching_ui
node_matches -->|"requests matches"| node_auth_ui
node_user_card -->|"renders"| node_avatar
node_user_profile -->|"requests profile"| node_auth_ui
node_user_profile -->|"uses presence"| node_socket_context
node_user_profile -.->|"sends requests"| node_swap_requests
node_swap_requests -->|"guards routes"| node_jwt_guard
node_swap_requests -->|"reads and updates"| node_user_model
node_navbar -->|"uses account"| node_auth_ui
node_navbar -->|"shows alerts"| node_socket_context
node_routes -->|"renders alerts"| node_notifications
node_notifications -.->|"receives events"| node_socket_server
node_chat_page -->|"requests chat"| node_auth_ui
node_chat_page -->|"uses messaging"| node_socket_context
node_chat_page -.->|"renders"| node_chat_ui
node_chat_page -->|"renders"| node_avatar
node_socket_context -->|"uses token"| node_auth_ui
node_socket_context -->|"sends socket events"| node_socket_server
node_socket_server -->|"creates and reads"| node_chat_models
node_chat_api -->|"guards routes"| node_jwt_guard
node_chat_api -->|"reads and writes"| node_chat_models
node_chat_models -.->|"persists"| node_database
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_swap_requests
node_server -->|"mounts"| node_chat_api
node_server -->|"connects"| node_db_connector
node_db_connector -.->|"connects"| node_database
node_profile_page -->|"edits skills"| node_skill_input
node_auth_pages -->|"collects skills"| node_skill_input

click node_routes "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_pages "https://github.com/anushkagupta12/skillswap/tree/main/frontend/src/pages"
click node_profile_page "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Profile.jsx"
click node_user_profile "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/UserProfile.jsx"
click node_user_model "https://github.com/anushkagupta12/skillswap/blob/main/backend/models/User.js"
click node_auth_routes "https://github.com/anushkagupta12/skillswap/blob/main/backend/routes/auth.js"
click node_jwt_guard "https://github.com/anushkagupta12/skillswap/blob/main/backend/middleware/auth.js"
click node_browse "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Browse.jsx"
click node_matches "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Matches.jsx"
click node_matching_ui "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/SmartMatching.jsx"
click node_user_card "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/UserCard.jsx"
click node_swap_requests "https://github.com/anushkagupta12/skillswap/blob/main/backend/routes/users.js"
click node_notifications "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/SocketContext.jsx"
click node_navbar "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Navbar.jsx"
click node_chat_page "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Chat.jsx"
click node_chat_ui "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/ChatUI.jsx"
click node_socket_context "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/SocketContext.jsx"
click node_socket_server "https://github.com/anushkagupta12/skillswap/blob/main/backend/server.js"
click node_chat_api "https://github.com/anushkagupta12/skillswap/blob/main/backend/routes/chat.js"
click node_chat_models "https://github.com/anushkagupta12/skillswap/blob/main/backend/models/Chat.js"
click node_server "https://github.com/anushkagupta12/skillswap/blob/main/backend/server.js"
click node_db_connector "https://github.com/anushkagupta12/skillswap/blob/main/backend/config/db.js"
click node_toast "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/ToastContext.jsx"
click node_avatar "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Avatar.jsx"
click node_skill_input "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/SkillInput.jsx"
click node_spinner "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Spinner.jsx"
click node_community "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Community.jsx"
click node_feedback "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Feedback.jsx"
click node_home "https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Home.jsx"

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_routes,node_notifications,node_navbar,node_toast,node_avatar,node_spinner,node_community,node_feedback,node_home toneBlue
class node_auth_ui,node_auth_pages,node_profile_page,node_user_profile,node_skill_input toneAmber
class node_browse,node_matches,node_matching_ui,node_user_card,node_swap_requests toneMint
class node_chat_page,node_chat_ui,node_socket_context,node_socket_server,node_chat_api toneRose
class node_user_model,node_auth_routes,node_jwt_guard,node_chat_models,node_database,node_server,node_db_connector,node_visitor toneIndigo
```

## Components

### User experience

- [App routing](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Live swap alerts](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/SocketContext.jsx): `frontend/src/context/SocketContext.jsx`
- [Navigation and inbox](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Toast feedback](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/ToastContext.jsx): `frontend/src/context/ToastContext.jsx`
- [Avatar](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Avatar.jsx): `frontend/src/components/Avatar.jsx`
- [Loading indicator](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Spinner.jsx): `frontend/src/components/Spinner.jsx`
- [Community content](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Community.jsx): `frontend/src/components/Community.jsx`
- [Feedback content](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/Feedback.jsx): `frontend/src/components/Feedback.jsx`
- [Landing page](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`

### Identity and profiles

- [Auth state](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Sign in / register](https://github.com/anushkagupta12/skillswap/tree/main/frontend/src/pages): `frontend/src/pages`
- [Profile editor](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [Member profile](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/UserProfile.jsx): `frontend/src/pages/UserProfile.jsx`
- [Skill editor](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/SkillInput.jsx): `frontend/src/components/SkillInput.jsx`

### Skill discovery and swaps

- [Browse and search](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Browse.jsx): `frontend/src/pages/Browse.jsx`
- [Match rankings](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Matches.jsx): `frontend/src/pages/Matches.jsx`
- [Matching presentation](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/SmartMatching.jsx): `frontend/src/components/SmartMatching.jsx`
- [Member cards](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/UserCard.jsx): `frontend/src/components/UserCard.jsx`
- [Swap request APIs](https://github.com/anushkagupta12/skillswap/blob/main/backend/routes/users.js): `backend/routes/users.js`

### Messaging and presence

- [Chat experience](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Chat display](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/components/ChatUI.jsx): `frontend/src/components/ChatUI.jsx`
- [Socket client](https://github.com/anushkagupta12/skillswap/blob/main/frontend/src/context/SocketContext.jsx): `frontend/src/context/SocketContext.jsx`
- [Socket server](https://github.com/anushkagupta12/skillswap/blob/main/backend/server.js): `backend/server.js`
- [Chat APIs](https://github.com/anushkagupta12/skillswap/blob/main/backend/routes/chat.js): `backend/routes/chat.js`

### API and persistence

- [User records](https://github.com/anushkagupta12/skillswap/blob/main/backend/models/User.js): `backend/models/User.js`
- [Auth API](https://github.com/anushkagupta12/skillswap/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [JWT protection](https://github.com/anushkagupta12/skillswap/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Conversations and messages](https://github.com/anushkagupta12/skillswap/blob/main/backend/models/Chat.js): `backend/models/Chat.js`
- **MongoDB**
- [Express API server](https://github.com/anushkagupta12/skillswap/blob/main/backend/server.js): `backend/server.js`
- [Database connector](https://github.com/anushkagupta12/skillswap/blob/main/backend/config/db.js): `backend/config/db.js`

### Other components

- **Visitor / member**

## Connections

- Visitor / member → App routing: uses (evidence: `frontend/src/App.jsx`)
- App routing → Auth state: provides (evidence: `frontend/src/App.jsx`)
- App routing → Sign in / register: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Browse and search: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Match rankings: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Chat experience: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Member profile: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Profile editor: routes to (evidence: `frontend/src/App.jsx`)
- Sign in / register → Auth state: calls auth (evidence: `frontend/src/pages/Login.jsx`)
- Sign in / register → Auth API: requests
- Auth state → Auth API: loads identity (evidence: `frontend/src/context/AuthContext.jsx`)
- Profile editor → Auth state: updates profile (evidence: `frontend/src/pages/Profile.jsx`)
- Auth API → JWT protection: guards profile (evidence: `backend/routes/auth.js`)
- Auth API → User records: reads and updates (evidence: `backend/routes/auth.js`)
- JWT protection → User records: loads user (evidence: `backend/middleware/auth.js`)
- User records → MongoDB: persists
- Browse and search → Member cards: renders (evidence: `frontend/src/pages/Browse.jsx`)
- Browse and search → Auth state: requests users (evidence: `frontend/src/pages/Browse.jsx`)
- Match rankings → Member cards: renders (evidence: `frontend/src/pages/Matches.jsx`)
- Match rankings → Matching presentation: presents matches
- Match rankings → Auth state: requests matches (evidence: `frontend/src/pages/Matches.jsx`)
- Member cards → Avatar: renders (evidence: `frontend/src/components/UserCard.jsx`)
- Member profile → Auth state: requests profile (evidence: `frontend/src/pages/UserProfile.jsx`)
- Member profile → Socket client: uses presence (evidence: `frontend/src/pages/UserProfile.jsx`)
- Member profile → Swap request APIs: sends requests
- Swap request APIs → JWT protection: guards routes (evidence: `backend/routes/users.js`)
- Swap request APIs → User records: reads and updates (evidence: `backend/routes/users.js`)
- Navigation and inbox → Auth state: uses account (evidence: `frontend/src/components/Navbar.jsx`)
- Navigation and inbox → Socket client: shows alerts (evidence: `frontend/src/components/Navbar.jsx`)
- App routing → Live swap alerts: renders alerts (evidence: `frontend/src/App.jsx`)
- Live swap alerts → Socket server: receives events
- Chat experience → Auth state: requests chat (evidence: `frontend/src/pages/Chat.jsx`)
- Chat experience → Socket client: uses messaging (evidence: `frontend/src/pages/Chat.jsx`)
- Chat experience → Chat display: renders
- Chat experience → Avatar: renders (evidence: `frontend/src/pages/Chat.jsx`)
- Socket client → Auth state: uses token (evidence: `frontend/src/context/SocketContext.jsx`)
- Socket client → Socket server: sends socket events (evidence: `frontend/src/context/SocketContext.jsx`)
- Socket server → Conversations and messages: creates and reads (evidence: `backend/server.js`)
- Chat APIs → JWT protection: guards routes (evidence: `backend/routes/chat.js`)
- Chat APIs → Conversations and messages: reads and writes (evidence: `backend/routes/chat.js`)
- Conversations and messages → MongoDB: persists
- Express API server → Auth API: mounts (evidence: `backend/server.js`)
- Express API server → Swap request APIs: mounts (evidence: `backend/server.js`)
- Express API server → Chat APIs: mounts (evidence: `backend/server.js`)
- Express API server → Database connector: connects (evidence: `backend/server.js`)
- Database connector → MongoDB: connects
- Profile editor → Skill editor: edits skills (evidence: `frontend/src/pages/Profile.jsx`)
- Sign in / register → Skill editor: collects skills (evidence: `frontend/src/pages/Register.jsx`)
