# duresh-tech/my-streams architecture

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

- Interactive diagram: https://gitdiagram.com/duresh-tech/my-streams
- Repository: https://github.com/duresh-tech/my-streams

## Overview

My Streams is a multi-tenant SaaS for managing live-stream businesses on Flussonic servers. Tenants manage customers, servers, streams, plans and billing in the Tenant Portal; customers use a separate portal to view their assigned streams and invoices; system administrators manage tenants and platform configuration. The backend also handles stream events, alerts, dashboards and public stream sharing. The graph reflects README-described capabilities and sampled controller behavior; unsampled frontend-to-endpoint wiring and internal service calls are kept general or omitted.

Main entry points: [`backend/src/prisma/prisma.service.ts`](https://github.com/duresh-tech/my-streams/blob/main/backend/src/prisma/prisma.service.ts) (Application database), [`frontend/src/app/tenant/dashboard/page.tsx`](https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/tenant/dashboard/page.tsx) (Tenant Portal), [`frontend/src/app/system/dashboard/page.tsx`](https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/system/dashboard/page.tsx) (System Console), [`frontend/src/app/customer/servers/page.tsx`](https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/customer/servers/page.tsx) (Customer Portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["User portals"]
  node_system_portal["System Console<br/>[page.tsx]"]
  node_tenant_portal["Tenant Portal<br/>[page.tsx]"]
  node_customer_portal["Customer Portal<br/>[page.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_system_auth["System auth<br/>[auth.controller.ts]"]
  node_tenant_auth["Tenant auth"]
  node_customer_auth["Customer auth"]
  node_access_admin["RBAC administration"]
end

subgraph group_operations["Tenant operations"]
  node_tenant_customers["Customer management"]
  node_server_mgmt["Server management"]
  node_stream_mgmt["Stream management"]
  node_customer_services["Customer services"]
  node_billing["Invoices and billing"]
  node_finance["Ledger and plans"]
  node_events["Events and alerts"]
  node_dashboards["Insights dashboards"]
  node_settings["Business settings"]
  node_public_share["Public stream sharing"]
end

subgraph group_platform["Platform services"]
  node_system_config["App configuration"]
  node_database[("Application database<br/>[prisma.service.ts]")]
  node_file_storage["File storage<br/>[storage.service.ts]"]
end

subgraph group_integrations["External systems"]
  node_flussonic{{"Flussonic servers"}}
  node_mail{{"Email service"}}
end

node_system_actor(("System admin"))
node_tenant_actor(("Tenant team"))
node_customer_actor(("Customer"))

node_system_actor -->|"uses"| node_system_portal
node_tenant_actor -->|"uses"| node_tenant_portal
node_customer_actor -->|"uses"| node_customer_portal
node_system_portal -->|"authenticates via"| node_system_auth
node_tenant_portal -->|"authenticates via"| node_tenant_auth
node_customer_portal -->|"authenticates via"| node_customer_auth
node_system_portal -->|"administers access"| node_access_admin
node_system_portal -->|"manages settings"| node_system_config
node_system_portal -->|"requests insights"| node_dashboards
node_tenant_portal -->|"manages customers"| node_tenant_customers
node_tenant_portal -->|"manages servers"| node_server_mgmt
node_tenant_portal -->|"manages streams"| node_stream_mgmt
node_tenant_portal -->|"manages invoices"| node_billing
node_tenant_portal -->|"tracks finances"| node_finance
node_tenant_portal -->|"views events"| node_events
node_tenant_portal -->|"configures business"| node_settings
node_tenant_portal -->|"requests insights"| node_dashboards
node_customer_portal -->|"views account"| node_customer_services
node_customer_portal -->|"views invoices"| node_billing
node_customer_services -->|"reads live status"| node_flussonic
node_server_mgmt -->|"checks server"| node_flussonic
node_stream_mgmt -->|"reconciles streams"| node_flussonic
node_events -->|"sends alerts"| node_mail
node_billing -->|"books payments"| node_finance
node_system_config -->|"uploads files"| node_file_storage
node_customer_services -->|"uploads pictures"| node_file_storage
node_access_admin -->|"reads and writes"| node_database
node_system_auth -->|"reads and writes"| node_database
node_tenant_auth -->|"reads and writes"| node_database
node_customer_auth -->|"reads and writes"| node_database
node_tenant_customers -->|"reads and writes"| node_database
node_server_mgmt -->|"reads and writes"| node_database
node_stream_mgmt -->|"reads and writes"| node_database
node_customer_services -->|"reads and writes"| node_database
node_billing -->|"reads and writes"| node_database
node_finance -->|"reads and writes"| node_database
node_events -->|"reads and writes"| node_database
node_dashboards -->|"queries insights"| node_database
node_settings -->|"reads and writes"| node_database
node_public_share -->|"reads share data"| node_database

click node_system_portal "https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/system/dashboard/page.tsx"
click node_tenant_portal "https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/tenant/dashboard/page.tsx"
click node_customer_portal "https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/customer/servers/page.tsx"
click node_system_auth "https://github.com/duresh-tech/my-streams/blob/main/backend/src/auth/auth.controller.ts"
click node_tenant_auth "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-auth/tenant-auth.controller.ts"
click node_customer_auth "https://github.com/duresh-tech/my-streams/blob/main/backend/src/customer-auth/customer-auth.controller.ts"
click node_access_admin "https://github.com/duresh-tech/my-streams/blob/main/backend/src/permissions/permissions.controller.ts"
click node_tenant_customers "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-customers/tenant-customers-self.controller.ts"
click node_server_mgmt "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-flussonic-servers/tenant-flussonic-servers-self.controller.ts"
click node_stream_mgmt "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-streams/tenant-streams-self.controller.ts"
click node_customer_services "https://github.com/duresh-tech/my-streams/blob/main/backend/src/customer-portal/customer-portal.controller.ts"
click node_billing "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-billing/tenant-invoices-self.controller.ts"
click node_finance "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-income-expenses/tenant-income-expenses.service.ts"
click node_events "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-stream-events/tenant-stream-events-self.controller.ts"
click node_dashboards "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-dashboard/tenant-dashboard.controller.ts"
click node_settings "https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-business/tenant-business.controller.ts"
click node_public_share "https://github.com/duresh-tech/my-streams/blob/main/backend/src/public-share/public-share.controller.ts"
click node_system_config "https://github.com/duresh-tech/my-streams/blob/main/backend/src/app-settings/app-settings.controller.ts"
click node_database "https://github.com/duresh-tech/my-streams/blob/main/backend/src/prisma/prisma.service.ts"
click node_file_storage "https://github.com/duresh-tech/my-streams/blob/main/backend/src/storage/storage.service.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_system_portal,node_tenant_portal,node_customer_portal toneBlue
class node_system_auth,node_tenant_auth,node_customer_auth,node_access_admin toneAmber
class node_tenant_customers,node_server_mgmt,node_stream_mgmt,node_customer_services,node_billing,node_finance,node_events,node_dashboards,node_settings,node_public_share toneMint
class node_system_config,node_database,node_file_storage toneRose
class node_flussonic,node_mail,node_system_actor,node_tenant_actor,node_customer_actor toneIndigo
```

## Components

### User portals

- [System Console](https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/system/dashboard/page.tsx): `frontend/src/app/system/dashboard/page.tsx`
- [Tenant Portal](https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/tenant/dashboard/page.tsx): `frontend/src/app/tenant/dashboard/page.tsx`
- [Customer Portal](https://github.com/duresh-tech/my-streams/blob/main/frontend/src/app/customer/servers/page.tsx): `frontend/src/app/customer/servers/page.tsx`

### Identity and access

- [System auth](https://github.com/duresh-tech/my-streams/blob/main/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Tenant auth](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-auth/tenant-auth.controller.ts): `backend/src/tenant-auth/tenant-auth.controller.ts`
- [Customer auth](https://github.com/duresh-tech/my-streams/blob/main/backend/src/customer-auth/customer-auth.controller.ts): `backend/src/customer-auth/customer-auth.controller.ts`
- [RBAC administration](https://github.com/duresh-tech/my-streams/blob/main/backend/src/permissions/permissions.controller.ts): `backend/src/permissions/permissions.controller.ts`

### Tenant operations

- [Customer management](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-customers/tenant-customers-self.controller.ts): `backend/src/tenant-customers/tenant-customers-self.controller.ts`
- [Server management](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-flussonic-servers/tenant-flussonic-servers-self.controller.ts): `backend/src/tenant-flussonic-servers/tenant-flussonic-servers-self.controller.ts`
- [Stream management](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-streams/tenant-streams-self.controller.ts): `backend/src/tenant-streams/tenant-streams-self.controller.ts`
- [Customer services](https://github.com/duresh-tech/my-streams/blob/main/backend/src/customer-portal/customer-portal.controller.ts): `backend/src/customer-portal/customer-portal.controller.ts`
- [Invoices and billing](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-billing/tenant-invoices-self.controller.ts): `backend/src/tenant-billing/tenant-invoices-self.controller.ts`
- [Ledger and plans](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-income-expenses/tenant-income-expenses.service.ts): `backend/src/tenant-income-expenses/tenant-income-expenses.service.ts`
- [Events and alerts](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-stream-events/tenant-stream-events-self.controller.ts): `backend/src/tenant-stream-events/tenant-stream-events-self.controller.ts`
- [Insights dashboards](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-dashboard/tenant-dashboard.controller.ts): `backend/src/tenant-dashboard/tenant-dashboard.controller.ts`
- [Business settings](https://github.com/duresh-tech/my-streams/blob/main/backend/src/tenant-business/tenant-business.controller.ts): `backend/src/tenant-business/tenant-business.controller.ts`
- [Public stream sharing](https://github.com/duresh-tech/my-streams/blob/main/backend/src/public-share/public-share.controller.ts): `backend/src/public-share/public-share.controller.ts`

### Platform services

- [App configuration](https://github.com/duresh-tech/my-streams/blob/main/backend/src/app-settings/app-settings.controller.ts): `backend/src/app-settings/app-settings.controller.ts`
- [Application database](https://github.com/duresh-tech/my-streams/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- [File storage](https://github.com/duresh-tech/my-streams/blob/main/backend/src/storage/storage.service.ts): `backend/src/storage/storage.service.ts`

### External systems

- **Flussonic servers**
- **Email service**

### Other components

- **System admin**
- **Tenant team**
- **Customer**

## Connections

- System admin → System Console: uses
- Tenant team → Tenant Portal: uses
- Customer → Customer Portal: uses
- System Console → System auth: authenticates via
- Tenant Portal → Tenant auth: authenticates via
- Customer Portal → Customer auth: authenticates via
- System Console → RBAC administration: administers access
- System Console → App configuration: manages settings
- System Console → Insights dashboards: requests insights
- Tenant Portal → Customer management: manages customers
- Tenant Portal → Server management: manages servers
- Tenant Portal → Stream management: manages streams
- Tenant Portal → Invoices and billing: manages invoices
- Tenant Portal → Ledger and plans: tracks finances
- Tenant Portal → Events and alerts: views events
- Tenant Portal → Business settings: configures business
- Tenant Portal → Insights dashboards: requests insights
- Customer Portal → Customer services: views account
- Customer Portal → Invoices and billing: views invoices
- Customer services → Flussonic servers: reads live status
- Server management → Flussonic servers: checks server
- Stream management → Flussonic servers: reconciles streams
- Events and alerts → Email service: sends alerts
- Invoices and billing → Ledger and plans: books payments
- App configuration → File storage: uploads files
- Customer services → File storage: uploads pictures
- RBAC administration → Application database: reads and writes
- System auth → Application database: reads and writes
- Tenant auth → Application database: reads and writes
- Customer auth → Application database: reads and writes
- Customer management → Application database: reads and writes
- Server management → Application database: reads and writes
- Stream management → Application database: reads and writes
- Customer services → Application database: reads and writes
- Invoices and billing → Application database: reads and writes
- Ledger and plans → Application database: reads and writes
- Events and alerts → Application database: reads and writes
- Insights dashboards → Application database: queries insights
- Business settings → Application database: reads and writes
- Public stream sharing → Application database: reads share data
