# itqan-community/cms-backend architecture

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

- Interactive diagram: https://gitdiagram.com/itqan-community/cms-backend
- Repository: https://github.com/itqan-community/cms-backend

## Overview

Fanar is a Quranic content management and distribution backend. Publishers and staff manage licensed, versioned resources through the portal; developers and publisher-branded clients consume content through the public and tenant APIs, while platform users use the CMS API. Content services and domain models underpin these workflows, with package delivery and usage analytics as supporting capabilities. The README documents the API audiences and capabilities; sampled source confirms selected storage, background-task, and identity relationships, but many endpoint-to-service calls were not excerpted.

Main entry points: [`apps/content/api/public/ayah_text.py`](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/public/ayah_text.py) (Public API), [`apps/content/api/portal/asset_content.py`](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/portal/asset_content.py) (Portal API), [`apps/content/models.py`](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/models.py) (Content records), [`apps/content/tasks.py`](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/tasks.py) (Background tasks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["API interfaces"]
  node_cms_api["CMS API<br/>[applications.py]"]
  node_portal_api["Portal API<br/>[asset_content.py]"]
  node_tenant_api["Tenant API<br/>[recitation_list.py]"]
  node_public_api["Public API<br/>[ayah_text.py]"]
end

subgraph group_content["Content lifecycle"]
  node_content_models[("Content records<br/>[models.py]")]
  node_content_services["Content services<br/>[asset_content.py]"]
  node_recitation["Recitation services<br/>[recitation.py]"]
  node_recommendations["Recommendations<br/>[recommendations.py]"]
  node_quran["Quran data access<br/>[quran.py]"]
end

subgraph group_platform["Platform services"]
  node_storage["File storage<br/>[storage.py]"]
  node_publisher_membership["Publisher membership"]
  node_users[("Users and apps<br/>[models.py]")]
  node_package_registry["Package registry"]
end

subgraph group_operations["Operations and analytics"]
  node_usage["Usage analytics<br/>[usage_reports.py]"]
  node_background_tasks["Background tasks<br/>[tasks.py]"]
  node_dependabot["Repository updates<br/>[github_client.py]"]
end

node_publishers(("Publishers and staff"))
node_developers(("Developer clients"))
node_github["GitHub"]

node_publishers -->|"manage content"| node_portal_api
node_portal_api -.->|"manage resources"| node_content_services
node_content_services -.->|"persist content"| node_content_models
node_content_models -->|"store files"| node_storage
node_publishers -->|"serve tenant content"| node_tenant_api
node_developers -->|"request content"| node_public_api
node_developers -->|"manage applications"| node_cms_api
node_public_api -.->|"expose Quran data"| node_quran
node_public_api -.->|"serve recitations"| node_recitation
node_public_api -.->|"request recommendations"| node_recommendations
node_public_api -->|"serve resources"| node_content_models
node_portal_api -.->|"govern access"| node_publisher_membership
node_cms_api -->|"manage accounts"| node_users
node_portal_api -.->|"manage packages"| node_package_registry
node_public_api -->|"distribute packages"| node_package_registry
node_public_api -.->|"track usage"| node_usage
node_background_tasks -->|"read content"| node_content_models
node_background_tasks -->|"compute suggestions"| node_recommendations
node_dependabot -->|"query repositories"| node_github
node_background_tasks -->|"dispatch updates"| node_dependabot
node_publisher_membership -->|"create member accounts"| node_users

click node_cms_api "https://github.com/itqan-community/cms-backend/blob/staging/apps/users/api/internal/applications.py"
click node_portal_api "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/portal/asset_content.py"
click node_tenant_api "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/tenant/recitation_list.py"
click node_public_api "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/public/ayah_text.py"
click node_content_models "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/models.py"
click node_content_services "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/services/asset_content.py"
click node_recitation "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/services/recitation.py"
click node_recommendations "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/services/recommendations.py"
click node_quran "https://github.com/itqan-community/cms-backend/blob/staging/apps/quran/services/quran.py"
click node_storage "https://github.com/itqan-community/cms-backend/blob/staging/apps/core/mixins/storage.py"
click node_publisher_membership "https://github.com/itqan-community/cms-backend/blob/staging/apps/publishers/services/publisher_member_invitation_service.py"
click node_users "https://github.com/itqan-community/cms-backend/blob/staging/apps/users/models.py"
click node_package_registry "https://github.com/itqan-community/cms-backend/blob/staging/apps/package_manager/services/package_registry.py"
click node_usage "https://github.com/itqan-community/cms-backend/blob/staging/apps/usage_tracking/services/usage_reports.py"
click node_background_tasks "https://github.com/itqan-community/cms-backend/blob/staging/apps/content/tasks.py"
click node_dependabot "https://github.com/itqan-community/cms-backend/blob/staging/apps/dependabot/services/github_client.py"

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_cms_api,node_portal_api,node_tenant_api,node_public_api,node_developers toneBlue
class node_content_models,node_content_services,node_recitation,node_recommendations,node_quran toneAmber
class node_storage,node_publisher_membership,node_users,node_package_registry toneMint
class node_usage,node_background_tasks,node_dependabot toneRose
class node_publishers,node_github toneIndigo
```

## Components

### API interfaces

- [CMS API](https://github.com/itqan-community/cms-backend/blob/staging/apps/users/api/internal/applications.py): `apps/users/api/internal/applications.py`
- [Portal API](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/portal/asset_content.py): `apps/content/api/portal/asset_content.py`
- [Tenant API](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/tenant/recitation_list.py): `apps/content/api/tenant/recitation_list.py`
- [Public API](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/api/public/ayah_text.py): `apps/content/api/public/ayah_text.py`

### Content lifecycle

- [Content records](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/models.py): `apps/content/models.py`
- [Content services](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/services/asset_content.py): `apps/content/services/asset_content.py`
- [Recitation services](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/services/recitation.py): `apps/content/services/recitation.py`
- [Recommendations](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/services/recommendations.py): `apps/content/services/recommendations.py`
- [Quran data access](https://github.com/itqan-community/cms-backend/blob/staging/apps/quran/services/quran.py): `apps/quran/services/quran.py`

### Platform services

- [File storage](https://github.com/itqan-community/cms-backend/blob/staging/apps/core/mixins/storage.py): `apps/core/mixins/storage.py`
- [Publisher membership](https://github.com/itqan-community/cms-backend/blob/staging/apps/publishers/services/publisher_member_invitation_service.py): `apps/publishers/services/publisher_member_invitation_service.py`
- [Users and apps](https://github.com/itqan-community/cms-backend/blob/staging/apps/users/models.py): `apps/users/models.py`
- [Package registry](https://github.com/itqan-community/cms-backend/blob/staging/apps/package_manager/services/package_registry.py): `apps/package_manager/services/package_registry.py`

### Operations and analytics

- [Usage analytics](https://github.com/itqan-community/cms-backend/blob/staging/apps/usage_tracking/services/usage_reports.py): `apps/usage_tracking/services/usage_reports.py`
- [Background tasks](https://github.com/itqan-community/cms-backend/blob/staging/apps/content/tasks.py): `apps/content/tasks.py`
- [Repository updates](https://github.com/itqan-community/cms-backend/blob/staging/apps/dependabot/services/github_client.py): `apps/dependabot/services/github_client.py`

### Other components

- **Publishers and staff**
- **Developer clients**
- **GitHub**

## Connections

- Publishers and staff → Portal API: manage content (evidence: `README.md`)
- Portal API → Content services: manage resources
- Content services → Content records: persist content
- Content records → File storage: store files (evidence: `apps/content/models.py`)
- Publishers and staff → Tenant API: serve tenant content (evidence: `README.md`)
- Developer clients → Public API: request content (evidence: `README.md`)
- Developer clients → CMS API: manage applications (evidence: `README.md`)
- Public API → Quran data access: expose Quran data
- Public API → Recitation services: serve recitations
- Public API → Recommendations: request recommendations
- Public API → Content records: serve resources (evidence: `README.md`)
- Portal API → Publisher membership: govern access
- CMS API → Users and apps: manage accounts (evidence: `apps/users/api/internal/applications.py`)
- Portal API → Package registry: manage packages
- Public API → Package registry: distribute packages (evidence: `README.md`)
- Public API → Usage analytics: track usage
- Background tasks → Content records: read content (evidence: `apps/content/tasks.py`)
- Background tasks → Recommendations: compute suggestions (evidence: `apps/content/tasks.py`)
- Repository updates → GitHub: query repositories (evidence: `apps/dependabot/services/github_client.py`)
- Background tasks → Repository updates: dispatch updates
- Publisher membership → Users and apps: create member accounts (evidence: `apps/publishers/services/publisher_member_invitation_service.py`)
