# islamkhaled1/skillswap architecture

> Architecture diagram of the GitHub repository islamkhaled1/skillswap, 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/islamkhaled1/skillswap
- Repository: https://github.com/islamkhaled1/skillswap

## Overview

SkillSwap is a peer-to-peer skill-exchange backend where users arrange teaching sessions and transfer time-minute credits. The main evidenced runtime path is session booking through the API, which validates an accepted swap, checks quota and wallet balance under locks, and records an escrow hold; completion, cancellation, no-show, and dispute handling settle or release credits. The README also documents discovery, proposals, chat, reviews, and tier quotas, though several implementations are not sampled. Those branches are shown at supported paths; their internal wiring is therefore limited.

Main entry points: [`src/SkillSwap.API/Controllers/SessionsController.cs`](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/SessionsController.cs) (Session endpoints), [`src/SkillSwap.API/Program.cs`](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Program.cs) (REST API), [`src/SkillSwap.Application/Services/SessionBookingService.cs`](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/SessionBookingService.cs) (Booking and escrow), [`src/SkillSwap.API/Controllers/WalletsController.cs`](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/WalletsController.cs) (Wallet endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_api["REST API<br/>[Program.cs]"]
  node_identity["JWT identity<br/>[JwtTokenService.cs]"]
end

subgraph group_exchange["Skill exchange"]
  node_skills["Skills and matching<br/>[Skill.cs]"]
  node_availability["Availability"]
  node_swap["Swap proposals<br/>[SwapRequest.cs]"]
  node_chat["Conversations and chat<br/>[ChatHub.cs]"]
end

subgraph group_sessions["Session lifecycle"]
  node_session_api["Session endpoints"]
  node_session_admin["Session administration"]
  node_booking["Booking and escrow"]
  node_session_ops["Session operations<br/>[SessionService.cs]"]
  node_completion["Completion and expiry"]
  node_session_jobs["Session background jobs"]
end

subgraph group_finance["Wallet and quota"]
  node_wallet_api["Wallet endpoints"]
  node_wallet_service["Wallet and ledger<br/>[WalletService.cs]"]
  node_ledger["Credit ledger"]
  node_quota["Learning quotas<br/>[QuotaService.cs]"]
  node_wallet_lock["Wallet row locking"]
end

subgraph group_platform["Community features"]
  node_reviews["Reviews<br/>[Review.cs]"]
  node_persistence[("EF data context")]
end

node_user(("Platform user"))

node_user -->|"uses"| node_api
node_user -->|"chats"| node_chat
node_api -->|"routes sessions"| node_session_api
node_api -->|"routes wallets"| node_wallet_api
node_api -->|"authenticates with"| node_identity
node_user -->|"discovers skills"| node_skills
node_user -->|"sets availability"| node_availability
node_user -->|"proposes swaps"| node_swap
node_user -->|"reviews sessions"| node_reviews
node_session_api -->|"books sessions"| node_booking
node_session_api -->|"manages sessions"| node_session_ops
node_session_api -->|"completes sessions"| node_completion
node_session_admin -->|"resolves disputes"| node_session_ops
node_booking -->|"checks quota"| node_quota
node_booking -->|"locks wallets"| node_wallet_lock
node_completion -->|"locks wallets"| node_wallet_lock
node_session_ops -->|"locks wallets"| node_wallet_lock
node_session_api -.->|"scheduled lifecycle"| node_session_jobs
node_session_jobs -->|"invokes lifecycle"| node_completion
node_wallet_api -->|"reads wallet"| node_wallet_service
node_wallet_api -->|"reads ledger"| node_ledger
node_wallet_api -->|"reads quota"| node_quota
node_booking -.->|"reads and writes"| node_persistence
node_completion -.->|"reads and writes"| node_persistence
node_session_ops -.->|"reads and writes"| node_persistence
node_chat -->|"registered by"| node_api
node_user -->|"books and manages"| node_session_api

click node_api "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Program.cs"
click node_identity "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/Services/JwtTokenService.cs"
click node_skills "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/Skill.cs"
click node_availability "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/AvailabilitySlot.cs"
click node_swap "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/SwapRequest.cs"
click node_chat "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Hubs/ChatHub.cs"
click node_session_api "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/SessionsController.cs"
click node_session_admin "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/AdminSessionsController.cs"
click node_booking "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/SessionBookingService.cs"
click node_session_ops "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/SessionService.cs"
click node_completion "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/SessionCompletionService.cs"
click node_session_jobs "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/BackgroundJobs/SessionAutoCompletionBackgroundService.cs"
click node_wallet_api "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/WalletsController.cs"
click node_wallet_service "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/WalletService.cs"
click node_ledger "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/CreditLedgerService.cs"
click node_quota "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/QuotaService.cs"
click node_wallet_lock "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/Services/SqlWalletLockService.cs"
click node_reviews "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/Review.cs"
click node_persistence "https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/Persistence/ApplicationDbContext.cs"

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_api,node_identity,node_user toneBlue
class node_skills,node_availability,node_swap,node_chat toneAmber
class node_session_api,node_session_admin,node_booking,node_session_ops,node_completion,node_session_jobs toneMint
class node_wallet_api,node_wallet_service,node_ledger,node_quota,node_wallet_lock toneRose
class node_reviews,node_persistence toneIndigo
```

## Components

### API and identity

- [REST API](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Program.cs): `src/SkillSwap.API/Program.cs`
- [JWT identity](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/Services/JwtTokenService.cs): `src/SkillSwap.Infrastructure/Services/JwtTokenService.cs`

### Skill exchange

- [Skills and matching](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/Skill.cs): `src/SkillSwap.Domain/Entities/Skill.cs`
- [Availability](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/AvailabilitySlot.cs): `src/SkillSwap.Domain/Entities/AvailabilitySlot.cs`
- [Swap proposals](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/SwapRequest.cs): `src/SkillSwap.Domain/Entities/SwapRequest.cs`
- [Conversations and chat](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Hubs/ChatHub.cs): `src/SkillSwap.API/Hubs/ChatHub.cs`

### Session lifecycle

- [Session endpoints](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/SessionsController.cs): `src/SkillSwap.API/Controllers/SessionsController.cs`
- [Session administration](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/AdminSessionsController.cs): `src/SkillSwap.API/Controllers/AdminSessionsController.cs`
- [Booking and escrow](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/SessionBookingService.cs): `src/SkillSwap.Application/Services/SessionBookingService.cs`
- [Session operations](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/SessionService.cs): `src/SkillSwap.Application/Services/SessionService.cs`
- [Completion and expiry](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/SessionCompletionService.cs): `src/SkillSwap.Application/Services/SessionCompletionService.cs`
- [Session background jobs](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/BackgroundJobs/SessionAutoCompletionBackgroundService.cs): `src/SkillSwap.Infrastructure/BackgroundJobs/SessionAutoCompletionBackgroundService.cs`

### Wallet and quota

- [Wallet endpoints](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.API/Controllers/WalletsController.cs): `src/SkillSwap.API/Controllers/WalletsController.cs`
- [Wallet and ledger](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/WalletService.cs): `src/SkillSwap.Application/Services/WalletService.cs`
- [Credit ledger](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/CreditLedgerService.cs): `src/SkillSwap.Application/Services/CreditLedgerService.cs`
- [Learning quotas](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Application/Services/QuotaService.cs): `src/SkillSwap.Application/Services/QuotaService.cs`
- [Wallet row locking](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/Services/SqlWalletLockService.cs): `src/SkillSwap.Infrastructure/Services/SqlWalletLockService.cs`

### Community features

- [Reviews](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Domain/Entities/Review.cs): `src/SkillSwap.Domain/Entities/Review.cs`
- [EF data context](https://github.com/islamkhaled1/skillswap/blob/main/src/SkillSwap.Infrastructure/Persistence/ApplicationDbContext.cs): `src/SkillSwap.Infrastructure/Persistence/ApplicationDbContext.cs`

### Other components

- **Platform user**

## Connections

- Platform user → REST API: uses (evidence: `README.md`)
- Platform user → Conversations and chat: chats (evidence: `README.md`)
- REST API → Session endpoints: routes sessions (evidence: `src/SkillSwap.API/Controllers/SessionsController.cs`)
- REST API → Wallet endpoints: routes wallets (evidence: `src/SkillSwap.API/Controllers/WalletsController.cs`)
- REST API → JWT identity: authenticates with
- Platform user → Skills and matching: discovers skills (evidence: `README.md`)
- Platform user → Availability: sets availability (evidence: `README.md`)
- Platform user → Swap proposals: proposes swaps (evidence: `README.md`)
- Platform user → Reviews: reviews sessions (evidence: `README.md`)
- Session endpoints → Booking and escrow: books sessions (evidence: `src/SkillSwap.API/Controllers/SessionsController.cs`)
- Session endpoints → Session operations: manages sessions (evidence: `src/SkillSwap.API/Controllers/SessionsController.cs`)
- Session endpoints → Completion and expiry: completes sessions (evidence: `src/SkillSwap.API/Controllers/SessionsController.cs`)
- Session administration → Session operations: resolves disputes (evidence: `src/SkillSwap.API/Controllers/AdminSessionsController.cs`)
- Booking and escrow → Learning quotas: checks quota (evidence: `src/SkillSwap.Application/Services/SessionBookingService.cs`)
- Booking and escrow → Wallet row locking: locks wallets (evidence: `src/SkillSwap.Application/Services/SessionBookingService.cs`)
- Completion and expiry → Wallet row locking: locks wallets (evidence: `src/SkillSwap.Application/Services/SessionCompletionService.cs`)
- Session operations → Wallet row locking: locks wallets (evidence: `src/SkillSwap.Application/Services/SessionService.cs`)
- Session endpoints → Session background jobs: scheduled lifecycle
- Session background jobs → Completion and expiry: invokes lifecycle (evidence: `src/SkillSwap.Infrastructure/BackgroundJobs/SessionAutoCompletionBackgroundService.cs`)
- Wallet endpoints → Wallet and ledger: reads wallet (evidence: `src/SkillSwap.API/Controllers/WalletsController.cs`)
- Wallet endpoints → Credit ledger: reads ledger (evidence: `src/SkillSwap.API/Controllers/WalletsController.cs`)
- Wallet endpoints → Learning quotas: reads quota (evidence: `src/SkillSwap.API/Controllers/WalletsController.cs`)
- Booking and escrow → EF data context: reads and writes
- Completion and expiry → EF data context: reads and writes
- Session operations → EF data context: reads and writes
- Conversations and chat → REST API: registered by (evidence: `src/SkillSwap.API/Program.cs`)
- Platform user → Session endpoints: books and manages (evidence: `README.md`)
