# fpindej/netrock architecture

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

- Interactive diagram: https://gitdiagram.com/fpindej/netrock
- Repository: https://github.com/fpindej/netrock

## Overview

NETrock is a full-stack .NET API and SvelteKit application foundation. A user makes requests through the frontend API client and CSRF-aware BFF proxy to the backend API; authentication and authorization then govern access to account and administrative capabilities. The README also documents OAuth, TOTP, email, audit, jobs, and file storage. The graph uses documented capabilities and sampled call sites; several subsystem connections are not directly evidenced by the excerpts and are left unwired.

Main entry points: [`src/backend/MyProject.Infrastructure/Persistence/MyProjectDbContext.cs`](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Persistence/MyProjectDbContext.cs) (PostgreSQL data), [`src/backend/MyProject.Infrastructure/Features/Authentication/Services/AuthenticationService.cs`](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Authentication/Services/AuthenticationService.cs) (Authentication service), [`src/backend/MyProject.WebApi/Features/Admin/AdminController.cs`](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Admin/AdminController.cs) (Admin endpoints), [`src/backend/MyProject.WebApi/Features/Authentication/AuthController.cs`](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Authentication/AuthController.cs) (Auth endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_frontend["SvelteKit app<br/>[hooks.server.ts]"]
  node_api_client["API client<br/>[client.ts]"]
  node_bff["BFF proxy<br/>[+server.ts]"]
end

subgraph group_api["API surface"]
  node_auth_api["Auth endpoints<br/>[AuthController.cs]"]
  node_twofactor_api["Two-factor endpoints"]
  node_users_api["User endpoints<br/>[UsersController.cs]"]
  node_admin_api["Admin endpoints<br/>[AdminController.cs]"]
end

subgraph group_identity["Identity and access"]
  node_authentication["Authentication service"]
  node_external_auth["External auth"]
  node_twofactor["TOTP service"]
  node_admin_service["Admin service<br/>[AdminService.cs]"]
  node_roles["Role management"]
  node_authorization["Permission authorization"]
  node_profile_service["User service<br/>[UserService.cs]"]
end

subgraph group_operations["Operations"]
  node_audit["Audit service<br/>[AuditService.cs]"]
  node_email["Email delivery"]
  node_jobs["Background jobs"]
  node_avatar["Image processing"]
  node_file_storage["S3 file storage"]
end

subgraph group_persistence["Persistence"]
  node_database[("PostgreSQL data")]
end

node_user(("User"))
node_s3[("S3-compatible store")]
node_oauth_providers["OAuth providers"]

node_user -->|"uses"| node_frontend
node_frontend -->|"requests"| node_api_client
node_api_client -->|"sends API calls"| node_bff
node_bff -->|"proxies requests"| node_auth_api
node_auth_api -->|"invokes"| node_authentication
node_twofactor_api -->|"completes login"| node_authentication
node_twofactor_api -->|"manages TOTP"| node_twofactor
node_auth_api -->|"handles external auth"| node_external_auth
node_external_auth -.->|"redirects for identity"| node_oauth_providers
node_authentication -->|"reads and writes"| node_database
node_authentication -->|"logs events"| node_audit
node_users_api -->|"invokes"| node_profile_service
node_users_api -->|"reads user events"| node_audit
node_profile_service -->|"processes images"| node_avatar
node_profile_service -->|"stores avatar files"| node_file_storage
node_file_storage -->|"reads and writes objects"| node_s3
node_admin_api -->|"manages users"| node_admin_service
node_admin_api -->|"manages roles"| node_roles
node_admin_api -->|"requires permissions"| node_authorization
node_admin_service -->|"reads and writes"| node_database
node_roles -->|"reads and writes"| node_database
node_audit -->|"stores events"| node_database
node_jobs -->|"manages job state"| node_database

click node_frontend "https://github.com/fpindej/netrock/blob/master/src/frontend/src/hooks.server.ts"
click node_api_client "https://github.com/fpindej/netrock/blob/master/src/frontend/src/lib/api/client.ts"
click node_bff "https://github.com/fpindej/netrock/blob/master/src/frontend/src/routes/api/%5B...path%5D/%2Bserver.ts"
click node_auth_api "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Authentication/AuthController.cs"
click node_twofactor_api "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Authentication/TwoFactorController.cs"
click node_users_api "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Users/UsersController.cs"
click node_admin_api "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Admin/AdminController.cs"
click node_authentication "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Authentication/Services/AuthenticationService.cs"
click node_external_auth "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Authentication/Services/ExternalAuthService.cs"
click node_twofactor "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Authentication/Services/TwoFactorService.cs"
click node_admin_service "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Admin/Services/AdminService.cs"
click node_roles "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Admin/Services/RoleManagementService.cs"
click node_authorization "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Authorization/PermissionAuthorizationHandler.cs"
click node_profile_service "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Identity/Services/UserService.cs"
click node_audit "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Audit/Services/AuditService.cs"
click node_email "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Email/Services/BackgroundEmailService.cs"
click node_jobs "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Jobs/Services/JobManagementService.cs"
click node_avatar "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Avatar/Services/ImageProcessingService.cs"
click node_file_storage "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/FileStorage/Services/S3FileStorageService.cs"
click node_database "https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Persistence/MyProjectDbContext.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_frontend,node_api_client,node_bff,node_user toneBlue
class node_auth_api,node_twofactor_api,node_users_api,node_admin_api,node_s3 toneAmber
class node_authentication,node_external_auth,node_twofactor,node_admin_service,node_roles,node_authorization,node_profile_service toneMint
class node_audit,node_email,node_jobs,node_avatar,node_file_storage toneRose
class node_database,node_oauth_providers toneIndigo
```

## Components

### Web client

- [SvelteKit app](https://github.com/fpindej/netrock/blob/master/src/frontend/src/hooks.server.ts): `src/frontend/src/hooks.server.ts`
- [API client](https://github.com/fpindej/netrock/blob/master/src/frontend/src/lib/api/client.ts): `src/frontend/src/lib/api/client.ts`
- [BFF proxy](https://github.com/fpindej/netrock/blob/master/src/frontend/src/routes/api/%5B...path%5D/%2Bserver.ts): `src/frontend/src/routes/api/[...path]/+server.ts`

### API surface

- [Auth endpoints](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Authentication/AuthController.cs): `src/backend/MyProject.WebApi/Features/Authentication/AuthController.cs`
- [Two-factor endpoints](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Authentication/TwoFactorController.cs): `src/backend/MyProject.WebApi/Features/Authentication/TwoFactorController.cs`
- [User endpoints](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Users/UsersController.cs): `src/backend/MyProject.WebApi/Features/Users/UsersController.cs`
- [Admin endpoints](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Features/Admin/AdminController.cs): `src/backend/MyProject.WebApi/Features/Admin/AdminController.cs`

### Identity and access

- [Authentication service](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Authentication/Services/AuthenticationService.cs): `src/backend/MyProject.Infrastructure/Features/Authentication/Services/AuthenticationService.cs`
- [External auth](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Authentication/Services/ExternalAuthService.cs): `src/backend/MyProject.Infrastructure/Features/Authentication/Services/ExternalAuthService.cs`
- [TOTP service](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Authentication/Services/TwoFactorService.cs): `src/backend/MyProject.Infrastructure/Features/Authentication/Services/TwoFactorService.cs`
- [Admin service](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Admin/Services/AdminService.cs): `src/backend/MyProject.Infrastructure/Features/Admin/Services/AdminService.cs`
- [Role management](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Admin/Services/RoleManagementService.cs): `src/backend/MyProject.Infrastructure/Features/Admin/Services/RoleManagementService.cs`
- [Permission authorization](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.WebApi/Authorization/PermissionAuthorizationHandler.cs): `src/backend/MyProject.WebApi/Authorization/PermissionAuthorizationHandler.cs`
- [User service](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Identity/Services/UserService.cs): `src/backend/MyProject.Infrastructure/Identity/Services/UserService.cs`

### Operations

- [Audit service](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Audit/Services/AuditService.cs): `src/backend/MyProject.Infrastructure/Features/Audit/Services/AuditService.cs`
- [Email delivery](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Email/Services/BackgroundEmailService.cs): `src/backend/MyProject.Infrastructure/Features/Email/Services/BackgroundEmailService.cs`
- [Background jobs](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Jobs/Services/JobManagementService.cs): `src/backend/MyProject.Infrastructure/Features/Jobs/Services/JobManagementService.cs`
- [Image processing](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/Avatar/Services/ImageProcessingService.cs): `src/backend/MyProject.Infrastructure/Features/Avatar/Services/ImageProcessingService.cs`
- [S3 file storage](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Features/FileStorage/Services/S3FileStorageService.cs): `src/backend/MyProject.Infrastructure/Features/FileStorage/Services/S3FileStorageService.cs`

### Persistence

- [PostgreSQL data](https://github.com/fpindej/netrock/blob/master/src/backend/MyProject.Infrastructure/Persistence/MyProjectDbContext.cs): `src/backend/MyProject.Infrastructure/Persistence/MyProjectDbContext.cs`

### Other components

- **User**
- **S3-compatible store**
- **OAuth providers**

## Connections

- User → SvelteKit app: uses
- SvelteKit app → API client: requests
- API client → BFF proxy: sends API calls
- BFF proxy → Auth endpoints: proxies requests
- Auth endpoints → Authentication service: invokes
- Two-factor endpoints → Authentication service: completes login
- Two-factor endpoints → TOTP service: manages TOTP
- Auth endpoints → External auth: handles external auth
- External auth → OAuth providers: redirects for identity
- Authentication service → PostgreSQL data: reads and writes
- Authentication service → Audit service: logs events
- User endpoints → User service: invokes
- User endpoints → Audit service: reads user events
- User service → Image processing: processes images
- User service → S3 file storage: stores avatar files
- S3 file storage → S3-compatible store: reads and writes objects
- Admin endpoints → Admin service: manages users
- Admin endpoints → Role management: manages roles
- Admin endpoints → Permission authorization: requires permissions
- Admin service → PostgreSQL data: reads and writes
- Role management → PostgreSQL data: reads and writes
- Audit service → PostgreSQL data: stores events
- Background jobs → PostgreSQL data: manages job state
