# shervinbdndev/retroshare architecture

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

- Interactive diagram: https://gitdiagram.com/shervinbdndev/retroshare
- Repository: https://github.com/shervinbdndev/retroshare

## Overview

RetroShare is a file-sharing platform with a REST control plane and a streaming gRPC data plane. Users authenticate, manage files and folders, and create protected share links; administrators manage accounts, roles, quotas, and system health. The graph includes the documented dashboard, activity logging, and authorization capabilities. Some implementations—especially share, dashboard, storage, and frontend modules—were not excerpted, so those relationships are shown only where the README or excerpts support them.

Main entry points: [`src/RetroShare.API/Program.cs`](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Program.cs) (REST API), [`src/RetroShare.Infrastructure/Data/AppDbContext.cs`](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Data/AppDbContext.cs) (SQLite data), [`src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs`](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs) (Streaming transfer), [`src/RetroShare.Application/Services/FileService.cs`](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/FileService.cs) (File lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry points"]
  node_api["REST API<br/>[Program.cs]"]
  node_auth_controller["Auth endpoints<br/>[AuthController.cs]"]
  node_file_controller["File endpoints<br/>[FilesController.cs]"]
  node_folder_controller["Folder endpoints"]
  node_share_controller["Share endpoints"]
  node_admin_controller["Admin endpoints<br/>[AdminController.cs]"]
  node_profile_controller["Profile endpoints"]
  node_trash_controller["Trash endpoints<br/>[TrashController.cs]"]
  node_grpc["Streaming transfer"]
end

subgraph group_domain["User capabilities"]
  node_auth_service["Account sessions<br/>[AuthService.cs]"]
  node_file_service["File lifecycle<br/>[FileService.cs]"]
  node_folder_service["Folder trees<br/>[FolderService.cs]"]
  node_share_service["Share links<br/>[ShareService.cs]"]
  node_user_service["User administration<br/>[UserServices.cs]"]
  node_role_service["Role management<br/>[RoleService.cs]"]
  node_dashboard["Dashboard metrics"]
end

subgraph group_security["Identity and policy"]
  node_permission["Permission checks"]
  node_jwt["JWT issuance<br/>[JwtTokenService.cs]"]
end

subgraph group_persistence["Persistence and transfer"]
  node_storage["Blob storage<br/>[IFileStorage.cs]"]
  node_database[("SQLite data<br/>[AppDbContext.cs]")]
  node_activity["Activity log<br/>[ActivityLog.cs]"]
end

node_user(("User"))
node_web(("Browser client"))

node_user -->|"uses"| node_web
node_web -->|"REST requests"| node_api
node_api -->|"routes"| node_auth_controller
node_api -->|"routes"| node_file_controller
node_api -->|"routes"| node_folder_controller
node_api -->|"routes"| node_share_controller
node_api -->|"routes"| node_admin_controller
node_api -->|"routes"| node_profile_controller
node_api -.->|"routes"| node_trash_controller
node_auth_controller -->|"delegates"| node_auth_service
node_file_controller -->|"delegates"| node_file_service
node_folder_controller -->|"delegates"| node_folder_service
node_share_controller -->|"delegates"| node_share_service
node_admin_controller -->|"manages users"| node_user_service
node_admin_controller -->|"manages roles"| node_role_service
node_profile_controller -->|"reads account"| node_auth_service
node_file_controller -->|"policy checks"| node_permission
node_grpc -->|"starts uploads"| node_file_service
node_grpc -->|"authorizes downloads"| node_file_service
node_grpc -->|"authorizes shares"| node_share_service
node_web -->|"gRPC-Web streams"| node_grpc
node_api -->|"maps service"| node_grpc
node_file_service -->|"uses blobs"| node_storage
node_auth_service -.->|"issues tokens"| node_jwt
node_auth_service -.->|"persists accounts"| node_database
node_file_service -.->|"persists metadata"| node_database
node_share_service -.->|"stores links"| node_database
node_dashboard -.->|"reads statistics"| node_database
node_user_service -.->|"updates accounts"| node_database
node_role_service -.->|"updates roles"| node_database
node_database -.->|"stores entries"| node_activity

click node_api "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Program.cs"
click node_auth_controller "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/AuthController.cs"
click node_file_controller "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/FilesController.cs"
click node_folder_controller "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/FoldersController.cs"
click node_share_controller "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/SharesController.cs"
click node_admin_controller "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/AdminController.cs"
click node_profile_controller "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/ProfileController.cs"
click node_trash_controller "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/TrashController.cs"
click node_auth_service "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/AuthService.cs"
click node_file_service "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/FileService.cs"
click node_folder_service "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/FolderService.cs"
click node_share_service "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/ShareService.cs"
click node_user_service "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/UserServices.cs"
click node_role_service "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/RoleService.cs"
click node_dashboard "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/DashboardService.cs"
click node_permission "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Authorization/PermissionAuthorization.cs"
click node_jwt "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Security/JwtTokenService.cs"
click node_grpc "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs"
click node_storage "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Interfaces/IFileStorage.cs"
click node_database "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Data/AppDbContext.cs"
click node_activity "https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Domain/Entities/ActivityLog.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_auth_controller,node_file_controller,node_folder_controller,node_share_controller,node_admin_controller,node_profile_controller,node_trash_controller,node_grpc,node_user,node_web toneBlue
class node_auth_service,node_file_service,node_folder_service,node_share_service,node_user_service,node_role_service,node_dashboard toneAmber
class node_permission,node_jwt toneMint
class node_storage,node_database,node_activity toneRose
```

## Components

### API entry points

- [REST API](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Program.cs): `src/RetroShare.API/Program.cs`
- [Auth endpoints](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/AuthController.cs): `src/RetroShare.API/Controllers/AuthController.cs`
- [File endpoints](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/FilesController.cs): `src/RetroShare.API/Controllers/FilesController.cs`
- [Folder endpoints](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/FoldersController.cs): `src/RetroShare.API/Controllers/FoldersController.cs`
- [Share endpoints](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/SharesController.cs): `src/RetroShare.API/Controllers/SharesController.cs`
- [Admin endpoints](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/AdminController.cs): `src/RetroShare.API/Controllers/AdminController.cs`
- [Profile endpoints](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/ProfileController.cs): `src/RetroShare.API/Controllers/ProfileController.cs`
- [Trash endpoints](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Controllers/TrashController.cs): `src/RetroShare.API/Controllers/TrashController.cs`
- [Streaming transfer](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs): `src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs`

### User capabilities

- [Account sessions](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/AuthService.cs): `src/RetroShare.Application/Services/AuthService.cs`
- [File lifecycle](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/FileService.cs): `src/RetroShare.Application/Services/FileService.cs`
- [Folder trees](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/FolderService.cs): `src/RetroShare.Application/Services/FolderService.cs`
- [Share links](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/ShareService.cs): `src/RetroShare.Application/Services/ShareService.cs`
- [User administration](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/UserServices.cs): `src/RetroShare.Application/Services/UserServices.cs`
- [Role management](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/RoleService.cs): `src/RetroShare.Application/Services/RoleService.cs`
- [Dashboard metrics](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Services/DashboardService.cs): `src/RetroShare.Application/Services/DashboardService.cs`

### Identity and policy

- [Permission checks](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.API/Authorization/PermissionAuthorization.cs): `src/RetroShare.API/Authorization/PermissionAuthorization.cs`
- [JWT issuance](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Security/JwtTokenService.cs): `src/RetroShare.Infrastructure/Security/JwtTokenService.cs`

### Persistence and transfer

- [Blob storage](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Application/Interfaces/IFileStorage.cs): `src/RetroShare.Application/Interfaces/IFileStorage.cs`
- [SQLite data](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Infrastructure/Data/AppDbContext.cs): `src/RetroShare.Infrastructure/Data/AppDbContext.cs`
- [Activity log](https://github.com/shervinbdndev/retroshare/blob/main/src/RetroShare.Domain/Entities/ActivityLog.cs): `src/RetroShare.Domain/Entities/ActivityLog.cs`

### Other components

- **User**
- **Browser client**

## Connections

- User → Browser client: uses (evidence: `README.md`)
- Browser client → REST API: REST requests (evidence: `README.md`)
- REST API → Auth endpoints: routes (evidence: `README.md`)
- REST API → File endpoints: routes (evidence: `README.md`)
- REST API → Folder endpoints: routes (evidence: `README.md`)
- REST API → Share endpoints: routes (evidence: `README.md`)
- REST API → Admin endpoints: routes (evidence: `README.md`)
- REST API → Profile endpoints: routes (evidence: `README.md`)
- REST API → Trash endpoints: routes
- Auth endpoints → Account sessions: delegates (evidence: `src/RetroShare.API/Controllers/AuthController.cs`)
- File endpoints → File lifecycle: delegates (evidence: `src/RetroShare.API/Controllers/FilesController.cs`)
- Folder endpoints → Folder trees: delegates (evidence: `README.md`)
- Share endpoints → Share links: delegates (evidence: `src/RetroShare.API/Controllers/SharesController.cs`)
- Admin endpoints → User administration: manages users (evidence: `src/RetroShare.API/Controllers/AdminController.cs`)
- Admin endpoints → Role management: manages roles (evidence: `src/RetroShare.API/Controllers/AdminController.cs`)
- Profile endpoints → Account sessions: reads account (evidence: `src/RetroShare.API/Controllers/ProfileController.cs`)
- File endpoints → Permission checks: policy checks (evidence: `README.md`)
- Streaming transfer → File lifecycle: starts uploads (evidence: `src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs`)
- Streaming transfer → File lifecycle: authorizes downloads (evidence: `src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs`)
- Streaming transfer → Share links: authorizes shares (evidence: `src/RetroShare.Infrastructure/Grpc/FileTransferGrpcService.cs`)
- Browser client → Streaming transfer: gRPC-Web streams (evidence: `README.md`)
- REST API → Streaming transfer: maps service (evidence: `src/RetroShare.API/Program.cs`)
- File lifecycle → Blob storage: uses blobs (evidence: `src/RetroShare.Application/Services/FileService.cs`)
- Account sessions → JWT issuance: issues tokens
- Account sessions → SQLite data: persists accounts
- File lifecycle → SQLite data: persists metadata
- Share links → SQLite data: stores links
- Dashboard metrics → SQLite data: reads statistics
- User administration → SQLite data: updates accounts
- Role management → SQLite data: updates roles
- SQLite data → Activity log: stores entries (evidence: `src/RetroShare.Infrastructure/Data/AppDbContext.cs`)
