# princekr267/skillsphere architecture

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

- Interactive diagram: https://gitdiagram.com/princekr267/skillsphere
- Repository: https://github.com/princekr267/skillsphere

## Overview

SkillSphere is a hyperlocal freelance marketplace. Clients and freelancers register with role-specific profiles and locations; clients post gigs, freelancers discover nearby work and apply, and clients manage applicants and hiring. The product also supports milestone progress, escrow payments, appointments, reviews, company accounts, real-time messaging and notifications, and administration. The graph combines the documented marketplace workflow with sampled route, authentication, API, persistence, and socket wiring. Several domain controllers were not sampled, so their internal calls are not expanded.

Main entry points: [`server/src/server.ts`](https://github.com/princekr267/skillsphere/blob/main/server/src/server.ts) (HTTP and socket server), [`client/src/utils/api.ts`](https://github.com/princekr267/skillsphere/blob/main/client/src/utils/api.ts) (API client), [`server/src/socket.ts`](https://github.com/princekr267/skillsphere/blob/main/server/src/socket.ts) (Realtime events), [`server/src/controllers/gigController.ts`](https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/gigController.ts) (Gig lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Marketplace client"]
  node_app["Application routing<br/>[App.tsx]"]
  node_authui["Identity and sessions<br/>[AuthContext.tsx]"]
  node_api["API client<br/>[api.ts]"]
  node_discovery["Gig discovery<br/>[BrowseGigs.tsx]"]
  node_clientwork["Client gig management"]
  node_freelancer["Freelancer workspace"]
  node_clientdash["Client dashboard"]
  node_profile["Profiles and reviews"]
  node_companyui["Company accounts"]
  node_adminui["Administration<br/>[AdminDashboard.tsx]"]
end

subgraph group_server["API and domain services"]
  node_server["HTTP and socket server<br/>[server.ts]"]
  node_auth["Authentication<br/>[authController.ts]"]
  node_gigs["Gig lifecycle<br/>[gigController.ts]"]
  node_payments["Payments and escrow"]
  node_reviews["Review handling"]
  node_companies["Company operations"]
  node_moderation["Content moderation"]
end

subgraph group_data["Marketplace data"]
  node_mongo[("MongoDB<br/>[db.ts]")]
  node_userstore[("User records<br/>[User.ts]")]
  node_gigstore[("Gig records<br/>[Gig.ts]")]
  node_proposalstore[("Proposals<br/>[Proposal.ts]")]
  node_paymentstore[("Payment records<br/>[Payment.ts]")]
  node_reviewstore[("Review records<br/>[Review.ts]")]
end

subgraph group_realtime["Realtime and messaging"]
  node_notifications[("Notifications<br/>[Notification.ts]")]
  node_socket["Realtime events<br/>[socket.ts]"]
  node_messages[("Chat messages<br/>[Message.ts]")]
end

node_users(("Clients and freelancers"))

node_users -->|"use marketplace"| node_app
node_app -->|"provides session"| node_authui
node_app -->|"routes to"| node_discovery
node_app -->|"routes to"| node_clientdash
node_app -->|"routes to"| node_profile
node_authui -->|"calls API"| node_api
node_discovery -.->|"requests gigs"| node_api
node_clientdash -->|"opens manager"| node_clientwork
node_clientwork -.->|"requests gig data"| node_api
node_freelancer -.->|"requests work data"| node_api
node_profile -.->|"requests profile data"| node_api
node_companyui -.->|"requests company data"| node_api
node_adminui -.->|"requests admin data"| node_api
node_api -.->|"sends HTTP requests"| node_server
node_server -->|"connects to"| node_mongo
node_server -->|"mounts auth routes"| node_auth
node_server -->|"mounts gig routes"| node_gigs
node_server -->|"mounts review routes"| node_reviews
node_server -->|"mounts company routes"| node_companies
node_server -->|"initializes socket"| node_socket
node_auth -->|"loads users"| node_userstore
node_gigs -->|"creates and queries"| node_gigstore
node_gigs -->|"moderates gig text"| node_moderation
node_reviews -->|"queries reviews"| node_reviewstore
node_reviews -->|"checks gig status"| node_gigstore
node_reviews -->|"updates rating"| node_userstore
node_reviews -->|"sends notification"| node_socket
node_gigs -->|"uses proposals"| node_proposalstore
node_gigs -->|"creates notifications"| node_notifications
node_gigs -->|"emits events"| node_socket
node_payments -->|"uses payment records"| node_paymentstore
node_payments -->|"uses gig records"| node_gigstore
node_payments -->|"uses proposals"| node_proposalstore
node_payments -->|"uses notifications"| node_notifications
node_payments -->|"emits events"| node_socket
node_socket -->|"creates messages"| node_messages
node_socket -->|"moderates chat"| node_moderation
node_socket -->|"checks gig access"| node_gigstore

click node_app "https://github.com/princekr267/skillsphere/blob/main/client/src/App.tsx"
click node_authui "https://github.com/princekr267/skillsphere/blob/main/client/src/context/AuthContext.tsx"
click node_api "https://github.com/princekr267/skillsphere/blob/main/client/src/utils/api.ts"
click node_discovery "https://github.com/princekr267/skillsphere/blob/main/client/src/pages/BrowseGigs.tsx"
click node_clientwork "https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/ClientGigManager.tsx"
click node_freelancer "https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/FreelancerDashboard.tsx"
click node_clientdash "https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/ClientDashboard.tsx"
click node_profile "https://github.com/princekr267/skillsphere/blob/main/client/src/pages/FreelancerProfile.tsx"
click node_companyui "https://github.com/princekr267/skillsphere/blob/main/client/src/pages/CompanyDashboard.tsx"
click node_adminui "https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/AdminDashboard.tsx"
click node_server "https://github.com/princekr267/skillsphere/blob/main/server/src/server.ts"
click node_auth "https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/authController.ts"
click node_gigs "https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/gigController.ts"
click node_payments "https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/paymentController.ts"
click node_reviews "https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/reviewController.ts"
click node_companies "https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/companyController.ts"
click node_moderation "https://github.com/princekr267/skillsphere/blob/main/server/src/services/moderationService.ts"
click node_mongo "https://github.com/princekr267/skillsphere/blob/main/server/src/config/db.ts"
click node_userstore "https://github.com/princekr267/skillsphere/blob/main/server/src/models/User.ts"
click node_gigstore "https://github.com/princekr267/skillsphere/blob/main/server/src/models/Gig.ts"
click node_proposalstore "https://github.com/princekr267/skillsphere/blob/main/server/src/models/Proposal.ts"
click node_paymentstore "https://github.com/princekr267/skillsphere/blob/main/server/src/models/Payment.ts"
click node_reviewstore "https://github.com/princekr267/skillsphere/blob/main/server/src/models/Review.ts"
click node_notifications "https://github.com/princekr267/skillsphere/blob/main/server/src/models/Notification.ts"
click node_socket "https://github.com/princekr267/skillsphere/blob/main/server/src/socket.ts"
click node_messages "https://github.com/princekr267/skillsphere/blob/main/server/src/models/Message.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_app,node_authui,node_api,node_discovery,node_clientwork,node_freelancer,node_clientdash,node_profile,node_companyui,node_adminui,node_users toneBlue
class node_server,node_auth,node_gigs,node_payments,node_reviews,node_companies,node_moderation toneAmber
class node_mongo,node_userstore,node_gigstore,node_proposalstore,node_paymentstore,node_reviewstore toneMint
class node_notifications,node_socket,node_messages toneRose
```

## Components

### Marketplace client

- [Application routing](https://github.com/princekr267/skillsphere/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Identity and sessions](https://github.com/princekr267/skillsphere/blob/main/client/src/context/AuthContext.tsx): `client/src/context/AuthContext.tsx`
- [API client](https://github.com/princekr267/skillsphere/blob/main/client/src/utils/api.ts): `client/src/utils/api.ts`
- [Gig discovery](https://github.com/princekr267/skillsphere/blob/main/client/src/pages/BrowseGigs.tsx): `client/src/pages/BrowseGigs.tsx`
- [Client gig management](https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/ClientGigManager.tsx): `client/src/pages/dashboards/ClientGigManager.tsx`
- [Freelancer workspace](https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/FreelancerDashboard.tsx): `client/src/pages/dashboards/FreelancerDashboard.tsx`
- [Client dashboard](https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/ClientDashboard.tsx): `client/src/pages/dashboards/ClientDashboard.tsx`
- [Profiles and reviews](https://github.com/princekr267/skillsphere/blob/main/client/src/pages/FreelancerProfile.tsx): `client/src/pages/FreelancerProfile.tsx`
- [Company accounts](https://github.com/princekr267/skillsphere/blob/main/client/src/pages/CompanyDashboard.tsx): `client/src/pages/CompanyDashboard.tsx`
- [Administration](https://github.com/princekr267/skillsphere/blob/main/client/src/pages/dashboards/AdminDashboard.tsx): `client/src/pages/dashboards/AdminDashboard.tsx`

### API and domain services

- [HTTP and socket server](https://github.com/princekr267/skillsphere/blob/main/server/src/server.ts): `server/src/server.ts`
- [Authentication](https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/authController.ts): `server/src/controllers/authController.ts`
- [Gig lifecycle](https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/gigController.ts): `server/src/controllers/gigController.ts`
- [Payments and escrow](https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/paymentController.ts): `server/src/controllers/paymentController.ts`
- [Review handling](https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/reviewController.ts): `server/src/controllers/reviewController.ts`
- [Company operations](https://github.com/princekr267/skillsphere/blob/main/server/src/controllers/companyController.ts): `server/src/controllers/companyController.ts`
- [Content moderation](https://github.com/princekr267/skillsphere/blob/main/server/src/services/moderationService.ts): `server/src/services/moderationService.ts`

### Marketplace data

- [MongoDB](https://github.com/princekr267/skillsphere/blob/main/server/src/config/db.ts): `server/src/config/db.ts`
- [User records](https://github.com/princekr267/skillsphere/blob/main/server/src/models/User.ts): `server/src/models/User.ts`
- [Gig records](https://github.com/princekr267/skillsphere/blob/main/server/src/models/Gig.ts): `server/src/models/Gig.ts`
- [Proposals](https://github.com/princekr267/skillsphere/blob/main/server/src/models/Proposal.ts): `server/src/models/Proposal.ts`
- [Payment records](https://github.com/princekr267/skillsphere/blob/main/server/src/models/Payment.ts): `server/src/models/Payment.ts`
- [Review records](https://github.com/princekr267/skillsphere/blob/main/server/src/models/Review.ts): `server/src/models/Review.ts`

### Realtime and messaging

- [Notifications](https://github.com/princekr267/skillsphere/blob/main/server/src/models/Notification.ts): `server/src/models/Notification.ts`
- [Realtime events](https://github.com/princekr267/skillsphere/blob/main/server/src/socket.ts): `server/src/socket.ts`
- [Chat messages](https://github.com/princekr267/skillsphere/blob/main/server/src/models/Message.ts): `server/src/models/Message.ts`

### Other components

- **Clients and freelancers**

## Connections

- Clients and freelancers → Application routing: use marketplace
- Application routing → Identity and sessions: provides session (evidence: `client/src/App.tsx`)
- Application routing → Gig discovery: routes to (evidence: `client/src/App.tsx`)
- Application routing → Client dashboard: routes to (evidence: `client/src/App.tsx`)
- Application routing → Profiles and reviews: routes to (evidence: `client/src/App.tsx`)
- Identity and sessions → API client: calls API (evidence: `client/src/context/AuthContext.tsx`)
- Gig discovery → API client: requests gigs
- Client dashboard → Client gig management: opens manager (evidence: `client/src/pages/dashboards/ClientDashboard.tsx`)
- Client gig management → API client: requests gig data (evidence: `client/src/pages/dashboards/ClientGigManager.tsx`)
- Freelancer workspace → API client: requests work data
- Profiles and reviews → API client: requests profile data
- Company accounts → API client: requests company data
- Administration → API client: requests admin data
- API client → HTTP and socket server: sends HTTP requests
- HTTP and socket server → MongoDB: connects to (evidence: `server/src/server.ts`)
- HTTP and socket server → Authentication: mounts auth routes (evidence: `server/src/server.ts`)
- HTTP and socket server → Gig lifecycle: mounts gig routes (evidence: `server/src/server.ts`)
- HTTP and socket server → Review handling: mounts review routes (evidence: `server/src/server.ts`)
- HTTP and socket server → Company operations: mounts company routes (evidence: `server/src/server.ts`)
- HTTP and socket server → Realtime events: initializes socket (evidence: `server/src/server.ts`)
- Authentication → User records: loads users (evidence: `server/src/controllers/authController.ts`)
- Gig lifecycle → Gig records: creates and queries (evidence: `server/src/controllers/gigController.ts`)
- Gig lifecycle → Content moderation: moderates gig text (evidence: `server/src/controllers/gigController.ts`)
- Review handling → Review records: queries reviews (evidence: `server/src/controllers/reviewController.ts`)
- Review handling → Gig records: checks gig status (evidence: `server/src/controllers/reviewController.ts`)
- Review handling → User records: updates rating (evidence: `server/src/controllers/reviewController.ts`)
- Review handling → Realtime events: sends notification (evidence: `server/src/controllers/reviewController.ts`)
- Gig lifecycle → Proposals: uses proposals (evidence: `server/src/controllers/gigController.ts`)
- Gig lifecycle → Notifications: creates notifications (evidence: `server/src/controllers/gigController.ts`)
- Gig lifecycle → Realtime events: emits events (evidence: `server/src/controllers/gigController.ts`)
- Payments and escrow → Payment records: uses payment records (evidence: `server/src/controllers/paymentController.ts`)
- Payments and escrow → Gig records: uses gig records (evidence: `server/src/controllers/paymentController.ts`)
- Payments and escrow → Proposals: uses proposals (evidence: `server/src/controllers/paymentController.ts`)
- Payments and escrow → Notifications: uses notifications (evidence: `server/src/controllers/paymentController.ts`)
- Payments and escrow → Realtime events: emits events (evidence: `server/src/controllers/paymentController.ts`)
- Realtime events → Chat messages: creates messages (evidence: `server/src/socket.ts`)
- Realtime events → Content moderation: moderates chat (evidence: `server/src/socket.ts`)
- Realtime events → Gig records: checks gig access (evidence: `server/src/socket.ts`)
