# cuteprog20/sala-app architecture

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

- Interactive diagram: https://gitdiagram.com/cuteprog20/sala-app
- Repository: https://github.com/cuteprog20/sala-app

## Overview

This is a NestJS API for a faith-content mobile app, with staff authoring and publishing, end-user profiles and progress, incremental content sync, and an SMS login-code hook. Mobile and staff requests enter through separate controllers; staff content operations delegate to authoring services, while user data and sync use the repository abstraction backed by Supabase. SMS delivery is a separate webhook path. The excerpts show these main calls and app wiring; some implementation details, including media handling and health checks, are only identified by the source index.

Main entry points: [`src/app.module.ts`](https://github.com/cuteprog20/sala-app/blob/master/src/app.module.ts) (NestJS app), [`src/content/admin.controller.ts`](https://github.com/cuteprog20/sala-app/blob/master/src/content/admin.controller.ts) (Admin API), [`src/auth/auth.guard.ts`](https://github.com/cuteprog20/sala-app/blob/master/src/auth/auth.guard.ts) (JWT auth), [`src/supabase/supabase.repository.ts`](https://github.com/cuteprog20/sala-app/blob/master/src/supabase/supabase.repository.ts) (Supabase repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and runtime"]
  node_api["NestJS app<br/>[app.module.ts]"]
  node_auth["JWT auth<br/>[auth.guard.ts]"]
  node_roles["Staff roles<br/>[roles.guard.ts]"]
  node_config["Environment config<br/>[env.ts]"]
  node_repo_port["Data repository port<br/>[data.repository.ts]"]
  node_supabase_repo["Supabase repository"]
  node_health["Health endpoint"]
end

subgraph group_content["Content operations"]
  node_admin["Admin API"]
  node_content_service["Content authoring<br/>[content.service.ts]"]
  node_entities["Content schemas<br/>[entities.ts]"]
  node_media["Media management<br/>[media.service.ts]"]
end

subgraph group_mobile["Mobile API"]
  node_me["User profile API<br/>[me.controller.ts]"]
  node_sync_api["Sync API<br/>[sync.controller.ts]"]
  node_sync_service["Incremental sync<br/>[sync.service.ts]"]
end

subgraph group_integrations["External integrations"]
  node_supabase_auth["Supabase Auth"]
  node_beem["Beem SMS"]
  node_supabase_db[("Supabase data")]
  node_sms_hook["SMS hook"]
  node_signature["Webhook signature"]
  node_sms_provider["SMS provider<br/>[sms.provider.ts]"]
  node_beem_provider["Beem provider<br/>[beem.provider.ts]"]
end

node_mobile_user(("Mobile app"))
node_staff(("Staff user"))

node_api -->|"registers"| node_admin
node_api -->|"registers"| node_me
node_api -->|"registers"| node_sync_api
node_api -->|"registers"| node_sms_hook
node_api -->|"registers"| node_health
node_api -->|"binds repository"| node_supabase_repo
node_api -->|"binds provider"| node_beem_provider
node_mobile_user -->|"requests"| node_me
node_mobile_user -->|"requests"| node_sync_api
node_staff -->|"requests"| node_admin
node_admin -->|"guards with"| node_auth
node_admin -->|"guards with"| node_roles
node_me -->|"guards with"| node_auth
node_sync_api -->|"guards with"| node_auth
node_auth -->|"loads settings"| node_config
node_auth -->|"verifies tokens"| node_supabase_auth
node_admin -->|"delegates authoring"| node_content_service
node_admin -->|"delegates media"| node_media
node_content_service -->|"reads and writes"| node_repo_port
node_content_service -->|"validates and builds"| node_entities
node_content_service -->|"loads settings"| node_config
node_me -->|"reads and writes"| node_repo_port
node_sync_api -->|"calls"| node_sync_service
node_sync_service -->|"fetches changes"| node_repo_port
node_supabase_repo -->|"implements"| node_repo_port
node_supabase_repo -->|"loads settings"| node_config
node_supabase_repo -->|"queries"| node_supabase_db
node_sms_hook -->|"verifies webhook"| node_signature
node_sms_hook -->|"sends code"| node_sms_provider
node_sms_hook -->|"loads secret"| node_config
node_sms_provider -->|"implemented by"| node_beem_provider
node_beem_provider -.->|"delivers SMS"| node_beem

click node_api "https://github.com/cuteprog20/sala-app/blob/master/src/app.module.ts"
click node_auth "https://github.com/cuteprog20/sala-app/blob/master/src/auth/auth.guard.ts"
click node_roles "https://github.com/cuteprog20/sala-app/blob/master/src/auth/roles.guard.ts"
click node_config "https://github.com/cuteprog20/sala-app/blob/master/src/config/env.ts"
click node_admin "https://github.com/cuteprog20/sala-app/blob/master/src/content/admin.controller.ts"
click node_content_service "https://github.com/cuteprog20/sala-app/blob/master/src/content/content.service.ts"
click node_entities "https://github.com/cuteprog20/sala-app/blob/master/src/content/entities.ts"
click node_media "https://github.com/cuteprog20/sala-app/blob/master/src/content/media.service.ts"
click node_me "https://github.com/cuteprog20/sala-app/blob/master/src/me/me.controller.ts"
click node_sync_api "https://github.com/cuteprog20/sala-app/blob/master/src/sync/sync.controller.ts"
click node_sync_service "https://github.com/cuteprog20/sala-app/blob/master/src/sync/sync.service.ts"
click node_repo_port "https://github.com/cuteprog20/sala-app/blob/master/src/supabase/data.repository.ts"
click node_supabase_repo "https://github.com/cuteprog20/sala-app/blob/master/src/supabase/supabase.repository.ts"
click node_sms_hook "https://github.com/cuteprog20/sala-app/blob/master/src/hooks/send-sms.controller.ts"
click node_signature "https://github.com/cuteprog20/sala-app/blob/master/src/hooks/webhook-signature.ts"
click node_sms_provider "https://github.com/cuteprog20/sala-app/blob/master/src/sms/sms.provider.ts"
click node_beem_provider "https://github.com/cuteprog20/sala-app/blob/master/src/sms/beem.provider.ts"
click node_health "https://github.com/cuteprog20/sala-app/blob/master/src/health/health.controller.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_api,node_auth,node_roles,node_config,node_repo_port,node_supabase_repo,node_health,node_staff toneBlue
class node_admin,node_content_service,node_entities,node_media toneAmber
class node_me,node_sync_api,node_sync_service toneMint
class node_supabase_auth,node_beem,node_supabase_db,node_sms_hook,node_signature,node_sms_provider,node_beem_provider toneRose
class node_mobile_user toneIndigo
```

## Components

### Access and runtime

- [NestJS app](https://github.com/cuteprog20/sala-app/blob/master/src/app.module.ts): `src/app.module.ts`
- [JWT auth](https://github.com/cuteprog20/sala-app/blob/master/src/auth/auth.guard.ts): `src/auth/auth.guard.ts`
- [Staff roles](https://github.com/cuteprog20/sala-app/blob/master/src/auth/roles.guard.ts): `src/auth/roles.guard.ts`
- [Environment config](https://github.com/cuteprog20/sala-app/blob/master/src/config/env.ts): `src/config/env.ts`
- [Data repository port](https://github.com/cuteprog20/sala-app/blob/master/src/supabase/data.repository.ts): `src/supabase/data.repository.ts`
- [Supabase repository](https://github.com/cuteprog20/sala-app/blob/master/src/supabase/supabase.repository.ts): `src/supabase/supabase.repository.ts`
- [Health endpoint](https://github.com/cuteprog20/sala-app/blob/master/src/health/health.controller.ts): `src/health/health.controller.ts`

### Content operations

- [Admin API](https://github.com/cuteprog20/sala-app/blob/master/src/content/admin.controller.ts): `src/content/admin.controller.ts`
- [Content authoring](https://github.com/cuteprog20/sala-app/blob/master/src/content/content.service.ts): `src/content/content.service.ts`
- [Content schemas](https://github.com/cuteprog20/sala-app/blob/master/src/content/entities.ts): `src/content/entities.ts`
- [Media management](https://github.com/cuteprog20/sala-app/blob/master/src/content/media.service.ts): `src/content/media.service.ts`

### Mobile API

- [User profile API](https://github.com/cuteprog20/sala-app/blob/master/src/me/me.controller.ts): `src/me/me.controller.ts`
- [Sync API](https://github.com/cuteprog20/sala-app/blob/master/src/sync/sync.controller.ts): `src/sync/sync.controller.ts`
- [Incremental sync](https://github.com/cuteprog20/sala-app/blob/master/src/sync/sync.service.ts): `src/sync/sync.service.ts`

### External integrations

- **Supabase Auth**
- **Beem SMS**
- **Supabase data**
- [SMS hook](https://github.com/cuteprog20/sala-app/blob/master/src/hooks/send-sms.controller.ts): `src/hooks/send-sms.controller.ts`
- [Webhook signature](https://github.com/cuteprog20/sala-app/blob/master/src/hooks/webhook-signature.ts): `src/hooks/webhook-signature.ts`
- [SMS provider](https://github.com/cuteprog20/sala-app/blob/master/src/sms/sms.provider.ts): `src/sms/sms.provider.ts`
- [Beem provider](https://github.com/cuteprog20/sala-app/blob/master/src/sms/beem.provider.ts): `src/sms/beem.provider.ts`

### Other components

- **Mobile app**
- **Staff user**

## Connections

- NestJS app → Admin API: registers (evidence: `src/app.module.ts`)
- NestJS app → User profile API: registers (evidence: `src/app.module.ts`)
- NestJS app → Sync API: registers (evidence: `src/app.module.ts`)
- NestJS app → SMS hook: registers (evidence: `src/app.module.ts`)
- NestJS app → Health endpoint: registers (evidence: `src/app.module.ts`)
- NestJS app → Supabase repository: binds repository (evidence: `src/app.module.ts`)
- NestJS app → Beem provider: binds provider (evidence: `src/app.module.ts`)
- Mobile app → User profile API: requests (evidence: `src/me/me.controller.ts`)
- Mobile app → Sync API: requests (evidence: `src/sync/sync.controller.ts`)
- Staff user → Admin API: requests (evidence: `src/content/admin.controller.ts`)
- Admin API → JWT auth: guards with (evidence: `src/content/admin.controller.ts`)
- Admin API → Staff roles: guards with (evidence: `src/content/admin.controller.ts`)
- User profile API → JWT auth: guards with (evidence: `src/me/me.controller.ts`)
- Sync API → JWT auth: guards with (evidence: `src/sync/sync.controller.ts`)
- JWT auth → Environment config: loads settings (evidence: `src/auth/auth.guard.ts`)
- JWT auth → Supabase Auth: verifies tokens (evidence: `src/auth/auth.guard.ts`)
- Admin API → Content authoring: delegates authoring (evidence: `src/content/admin.controller.ts`)
- Admin API → Media management: delegates media (evidence: `src/content/admin.controller.ts`)
- Content authoring → Data repository port: reads and writes (evidence: `src/content/content.service.ts`)
- Content authoring → Content schemas: validates and builds (evidence: `src/content/content.service.ts`)
- Content authoring → Environment config: loads settings (evidence: `src/content/content.service.ts`)
- User profile API → Data repository port: reads and writes (evidence: `src/me/me.controller.ts`)
- Sync API → Incremental sync: calls (evidence: `src/sync/sync.controller.ts`)
- Incremental sync → Data repository port: fetches changes (evidence: `src/sync/sync.service.ts`)
- Supabase repository → Data repository port: implements (evidence: `src/supabase/supabase.repository.ts`)
- Supabase repository → Environment config: loads settings (evidence: `src/supabase/supabase.repository.ts`)
- Supabase repository → Supabase data: queries (evidence: `src/supabase/supabase.repository.ts`)
- SMS hook → Webhook signature: verifies webhook (evidence: `src/hooks/send-sms.controller.ts`)
- SMS hook → SMS provider: sends code (evidence: `src/hooks/send-sms.controller.ts`)
- SMS hook → Environment config: loads secret (evidence: `src/hooks/send-sms.controller.ts`)
- SMS provider → Beem provider: implemented by (evidence: `src/app.module.ts`)
- Beem provider → Beem SMS: delivers SMS
