# suyog123-hub/cms-project architecture

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

- Interactive diagram: https://gitdiagram.com/suyog123-hub/cms-project
- Repository: https://github.com/suyog123-hub/cms-project

## Overview

1. This repository is a Django REST Framework CMS backend, organized as a modular monolith. The Django project lives in `cms/`, and each business area is its own app with the same standard shape: `models.py`, `serializers.py`, `views.py`, `urls.py`, `admin.py`, migrations, and tests.

2. The main functional domains are:
   - `app_user` for registration and login
   - `app_content` for article/content management
   - `app_services` for service pages
   - `app_portfolio` for portfolio/project pages
   - `app_testimonials` for testimonials
   - `app_faq` for FAQ entries
   - `app_seo` for SEO metadata
   These are separate API boundaries, but they all sit on the same Django database and share the same auth and request pipeline.

3. The request flow is conventional DRF: `cms/urls.py` routes into each app’s URL module, the URL modules map to class-based API views, views invoke serializers for validation/representation, and serializers persist or read Django ORM models. That means the architecture is “URL → View → Serializer → Model → MySQL.”

4. Data storage is MySQL, configured through environment variables in `cms/settings.py` and the `.env` template. The project uses PyMySQL rather than a separate service layer, so persistence is handled directly by Django ORM models and migrations. Uploaded media files are stored under `media/`, with separate subfolders for content images and post thumbnails/featured images.

5. A major architectural trait is polymorphic content association. `app_seo`, `app_testimonials`, and `app_faq` use `ContentType`/`GenericForeignKey`-style relations so records can attach to different primary models instead of hard-coding one parent type. This reduces duplication and creates reusable metadata/content blocks across content, services, portfolio, and other entities.

6. The “core content” apps share a similar schema pattern: title/slug/content fields, category and tag relations, status workflow, timestamps, author linkage, and image fields. `app_content`, `app_services`, and `app_portfolio` each define their own categories/tags/models rather than using a shared content taxonomy, so the domain boundaries are separated at the model level even though the shape is similar.

7. Authentication is handled by JWT using `djangorestframework-simplejwt`, with `app_user` providing register/login endpoints and the standard token obtain/refresh endpoints available at `/api/token/` and `/api/token/refresh/`. The API is therefore stateless for client calls after login, and protected routes require bearer tokens.

8. Cross-cutting request behavior is centralized rather than repeated in each app. The repository includes `pagination.py` for custom page-number pagination and `permissions.py` for reusable permission logic. Those are infrastructure-level concerns that likely apply across the DRF views, along with built-in throttling and CORS support configured in settings.

9. Administrative editing is supported through Django admin registrations in each app’s `admin.py`. This means the system has two management surfaces: the public API for clients and the Django admin backend for internal operators.

10. API documentation is part of the runtime surface. The readme indicates Swagger and ReDoc endpoints, implying the project uses schema generation tooling (`drf-yasg`) so the API can be explored and tested without external docs. This is useful when diagramming the integration boundary with front-end or third-party consumers.

11. The deployment shape is container-friendly: Gunicorn serves the Django app, MySQL runs as a separate container/service, and Nginx sits in front to serve static/media assets and proxy requests to Gunicorn. Media persistence is treated as a distinct volume boundary, which matters because the CMS stores uploaded images as part of normal content operations.

12. In diagram terms, the system’s key boundaries are: external API clients, Django auth/token issuance, the per-domain CRUD apps, the shared relational database, and the file/media store. The most important internal data flow is that content objects are the anchor records, while SEO/testimonial/FAQ entries can attach polymorphically to those anchors through generic relations.

Main entry points: [`cms/urls.py`](https://github.com/suyog123-hub/cms-project/blob/main/cms/urls.py) (Router), [`app_content/models.py`](https://github.com/suyog123-hub/cms-project/blob/main/app_content/models.py) (Content model), [`app_content/urls.py`](https://github.com/suyog123-hub/cms-project/blob/main/app_content/urls.py) (Content API), [`app_seo/models.py`](https://github.com/suyog123-hub/cms-project/blob/main/app_seo/models.py) (SEO model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients"]
  node_external_api_clients(("API clients<br/>consumer"))
  node_django_admin["Admin<br/>operator UI<br/>[admin.py]"]
end

subgraph group_backend["Backend"]
  node_cms_urls["Router<br/>django routing<br/>[urls.py]"]
  node_cms_settings["Settings<br/>django config<br/>[settings.py]"]
  node_pagination["Pagination<br/>DRF infra<br/>[pagination.py]"]
  node_permissions["Permissions<br/>DRF infra<br/>[permissions.py]"]
end

subgraph group_apps["Domain apps"]
  node_app_user_api["User API<br/>auth boundary<br/>[urls.py]"]
  node_app_content_api["Content API<br/>content boundary<br/>[urls.py]"]
  node_app_services_api["Services API<br/>service boundary<br/>[urls.py]"]
  node_app_portfolio_api["Portfolio API<br/>portfolio boundary<br/>[urls.py]"]
  node_app_seo_api["SEO API<br/>metadata boundary<br/>[urls.py]"]
  node_app_testimonials_api["Testimonials API<br/>social proof boundary<br/>[urls.py]"]
  node_app_faq_api["FAQ API<br/>knowledge boundary<br/>[urls.py]"]
  node_user_models["User model<br/>auth model<br/>[models.py]"]
  node_content_models["Content model<br/>[models.py]"]
  node_service_models["Service model<br/>[models.py]"]
  node_portfolio_models["Portfolio model<br/>[models.py]"]
  node_seo_models["SEO model<br/>generic metadata<br/>[models.py]"]
  node_testimonial_models["Testimonial model<br/>generic relation<br/>[models.py]"]
  node_faq_models["FAQ model<br/>generic relation<br/>[models.py]"]
end

subgraph group_storage["Storage"]
  node_mysql_db[("MySQL<br/>relational db")]
  node_media_store[("Media store<br/>file storage")]
end

node_external_api_clients -->|"REST requests"| node_cms_urls
node_django_admin -->|"manage"| node_content_models
node_django_admin -->|"manage"| node_user_models
node_cms_urls -->|"mounts"| node_app_user_api
node_cms_urls -->|"mounts"| node_app_content_api
node_cms_urls -->|"mounts"| node_app_services_api
node_cms_urls -->|"mounts"| node_app_portfolio_api
node_cms_urls -->|"mounts"| node_app_seo_api
node_cms_urls -->|"mounts"| node_app_testimonials_api
node_cms_urls -->|"mounts"| node_app_faq_api
node_app_user_api -->|"reads/writes"| node_user_models
node_app_content_api -->|"reads/writes"| node_content_models
node_app_services_api -->|"reads/writes"| node_service_models
node_app_portfolio_api -->|"reads/writes"| node_portfolio_models
node_app_seo_api -->|"reads/writes"| node_seo_models
node_app_testimonials_api -->|"reads/writes"| node_testimonial_models
node_app_faq_api -->|"reads/writes"| node_faq_models
node_content_models -->|"persists"| node_mysql_db
node_user_models -->|"persists"| node_mysql_db
node_service_models -->|"persists"| node_mysql_db
node_portfolio_models -->|"persists"| node_mysql_db
node_seo_models -->|"persists"| node_mysql_db
node_testimonial_models -->|"persists"| node_mysql_db
node_faq_models -->|"persists"| node_mysql_db
node_app_content_api -->|"uploads"| node_media_store
node_cms_settings -->|"configures"| node_mysql_db
node_cms_settings -->|"configures"| node_media_store
node_permissions -->|"protects"| node_app_content_api
node_permissions -->|"protects"| node_app_services_api
node_permissions -->|"protects"| node_app_portfolio_api
node_permissions -->|"protects"| node_app_seo_api
node_pagination -->|"pages"| node_app_content_api
node_pagination -->|"pages"| node_app_services_api
node_pagination -->|"pages"| node_app_portfolio_api
node_content_models -->|"generic parent"| node_seo_models
node_content_models -->|"generic parent"| node_testimonial_models
node_content_models -->|"generic parent"| node_faq_models
node_service_models -->|"generic parent"| node_seo_models
node_portfolio_models -->|"generic parent"| node_seo_models

click node_django_admin "https://github.com/suyog123-hub/cms-project/blob/main/app_user/admin.py"
click node_cms_urls "https://github.com/suyog123-hub/cms-project/blob/main/cms/urls.py"
click node_cms_settings "https://github.com/suyog123-hub/cms-project/blob/main/cms/settings.py"
click node_pagination "https://github.com/suyog123-hub/cms-project/blob/main/pagination.py"
click node_permissions "https://github.com/suyog123-hub/cms-project/blob/main/permissions.py"
click node_app_user_api "https://github.com/suyog123-hub/cms-project/blob/main/app_user/urls.py"
click node_app_content_api "https://github.com/suyog123-hub/cms-project/blob/main/app_content/urls.py"
click node_app_services_api "https://github.com/suyog123-hub/cms-project/blob/main/app_services/urls.py"
click node_app_portfolio_api "https://github.com/suyog123-hub/cms-project/blob/main/app_portfolio/urls.py"
click node_app_seo_api "https://github.com/suyog123-hub/cms-project/blob/main/app_seo/urls.py"
click node_app_testimonials_api "https://github.com/suyog123-hub/cms-project/blob/main/app_testimonials/urls.py"
click node_app_faq_api "https://github.com/suyog123-hub/cms-project/blob/main/app_faq/urls.py"
click node_user_models "https://github.com/suyog123-hub/cms-project/blob/main/app_user/models.py"
click node_content_models "https://github.com/suyog123-hub/cms-project/blob/main/app_content/models.py"
click node_service_models "https://github.com/suyog123-hub/cms-project/blob/main/app_services/models.py"
click node_portfolio_models "https://github.com/suyog123-hub/cms-project/blob/main/app_portfolio/models.py"
click node_seo_models "https://github.com/suyog123-hub/cms-project/blob/main/app_seo/models.py"
click node_testimonial_models "https://github.com/suyog123-hub/cms-project/blob/main/app_testimonials/models.py"
click node_faq_models "https://github.com/suyog123-hub/cms-project/blob/main/app_faq/models.py"
click node_media_store "https://github.com/suyog123-hub/cms-project/tree/main/media"

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_external_api_clients,node_django_admin toneBlue
class node_cms_urls,node_cms_settings,node_pagination,node_permissions toneAmber
class node_app_user_api,node_app_content_api,node_app_services_api,node_app_portfolio_api,node_app_seo_api,node_app_testimonials_api,node_app_faq_api,node_user_models,node_content_models,node_service_models,node_portfolio_models,node_seo_models,node_testimonial_models,node_faq_models toneMint
class node_mysql_db,node_media_store toneRose
```

## Components

### Clients

External callers and operator surfaces

- **API clients**: consumer · Frontends and third-party consumers calling the REST API
- [Admin](https://github.com/suyog123-hub/cms-project/blob/main/app_user/admin.py): operator UI · Internal management surface via Django admin registrations · `app_user/admin.py`

### Backend

Django project and shared DRF infrastructure

- [Router](https://github.com/suyog123-hub/cms-project/blob/main/cms/urls.py): django routing · Project-level URL dispatcher that mounts app APIs and auth endpoints · `cms/urls.py`
- [Settings](https://github.com/suyog123-hub/cms-project/blob/main/cms/settings.py): django config · Central runtime configuration for auth, CORS, throttling, database, and media · `cms/settings.py`
- [Pagination](https://github.com/suyog123-hub/cms-project/blob/main/pagination.py): DRF infra · Reusable page-number pagination shared across API views · `pagination.py`
- [Permissions](https://github.com/suyog123-hub/cms-project/blob/main/permissions.py): DRF infra · Reusable permission logic shared across protected endpoints · `permissions.py`

### Domain apps

Modular business boundaries inside the monolith

- [User API](https://github.com/suyog123-hub/cms-project/blob/main/app_user/urls.py): auth boundary · Registration, login, and token issuance for stateless JWT access · `app_user/urls.py`
- [Content API](https://github.com/suyog123-hub/cms-project/blob/main/app_content/urls.py): content boundary · Articles and core content CRUD with categories, tags, status, and media · `app_content/urls.py`
- [Services API](https://github.com/suyog123-hub/cms-project/blob/main/app_services/urls.py): service boundary · Service-page content modeled separately from articles and portfolio · `app_services/urls.py`
- [Portfolio API](https://github.com/suyog123-hub/cms-project/blob/main/app_portfolio/urls.py): portfolio boundary · Project and portfolio entries with their own taxonomy and workflow · `app_portfolio/urls.py`
- [SEO API](https://github.com/suyog123-hub/cms-project/blob/main/app_seo/urls.py): metadata boundary · Reusable SEO metadata attached polymorphically to content objects · `app_seo/urls.py`
- [Testimonials API](https://github.com/suyog123-hub/cms-project/blob/main/app_testimonials/urls.py): social proof boundary · Testimonials linked to different parent models through generic relations · `app_testimonials/urls.py`
- [FAQ API](https://github.com/suyog123-hub/cms-project/blob/main/app_faq/urls.py): knowledge boundary · FAQ entries that can attach to multiple content domains · `app_faq/urls.py`
- [User model](https://github.com/suyog123-hub/cms-project/blob/main/app_user/models.py): auth model · User persistence and account-related records · `app_user/models.py`
- [Content model](https://github.com/suyog123-hub/cms-project/blob/main/app_content/models.py): content model · Primary article/content records and related taxonomy · `app_content/models.py`
- [Service model](https://github.com/suyog123-hub/cms-project/blob/main/app_services/models.py): service model · Service-page records and taxonomy · `app_services/models.py`
- [Portfolio model](https://github.com/suyog123-hub/cms-project/blob/main/app_portfolio/models.py): portfolio model · Portfolio/project records and taxonomy · `app_portfolio/models.py`
- [SEO model](https://github.com/suyog123-hub/cms-project/blob/main/app_seo/models.py): generic metadata · Polymorphic SEO metadata via generic relations · `app_seo/models.py`
- [Testimonial model](https://github.com/suyog123-hub/cms-project/blob/main/app_testimonials/models.py): generic relation · Testimonials linked to anchors across the content domains · `app_testimonials/models.py`
- [FAQ model](https://github.com/suyog123-hub/cms-project/blob/main/app_faq/models.py): generic relation · FAQ entries linked to multiple parent object types · `app_faq/models.py`

### Storage

Database and file persistence

- **MySQL**: relational db · Shared relational persistence for all Django apps
- [Media store](https://github.com/suyog123-hub/cms-project/tree/main/media): file storage · Uploaded content images, post thumbnails, and featured images · `media`

## Connections

- API clients → Router: REST requests · Clients enter the API through the project URL router
- Admin → Content model: manage · Operators edit records through Django admin registrations
- Admin → User model: manage · Operators manage user-related records and permissions
- Router → User API: mounts · Project routing exposes auth and token endpoints
- Router → Content API: mounts · Project routing exposes content endpoints
- Router → Services API: mounts · Project routing exposes service endpoints
- Router → Portfolio API: mounts · Project routing exposes portfolio endpoints
- Router → SEO API: mounts · Project routing exposes SEO endpoints
- Router → Testimonials API: mounts · Project routing exposes testimonial endpoints
- Router → FAQ API: mounts · Project routing exposes FAQ endpoints
- User API → User model: reads/writes · Auth endpoints persist account records through the ORM
- Content API → Content model: reads/writes · Content endpoints validate and persist article records
- Services API → Service model: reads/writes · Service endpoints manage service-page records
- Portfolio API → Portfolio model: reads/writes · Portfolio endpoints manage project records
- SEO API → SEO model: reads/writes · SEO endpoints store metadata and attachment records
- Testimonials API → Testimonial model: reads/writes · Testimonial endpoints persist generic-relational entries
- FAQ API → FAQ model: reads/writes · FAQ endpoints persist generic-relational entries
- Content model → MySQL: persists · ORM-backed content data is stored in the shared MySQL database
- User model → MySQL: persists · User and auth data are stored in the shared MySQL database
- Service model → MySQL: persists · Service records are stored in the shared MySQL database
- Portfolio model → MySQL: persists · Portfolio records are stored in the shared MySQL database
- SEO model → MySQL: persists · SEO metadata is stored in the shared MySQL database
- Testimonial model → MySQL: persists · Testimonial records are stored in the shared MySQL database
- FAQ model → MySQL: persists · FAQ records are stored in the shared MySQL database
- Content API → Media store: uploads · Content pages and articles store images in the media volume
- Settings → MySQL: configures · Database connection settings are loaded from environment configuration
- Settings → Media store: configures · Media root and static/media handling are configured centrally
- Permissions → Content API: protects · Reusable permissions govern protected content endpoints
- Permissions → Services API: protects · Reusable permissions govern protected service endpoints
- Permissions → Portfolio API: protects · Reusable permissions govern protected portfolio endpoints
- Permissions → SEO API: protects · Reusable permissions govern protected metadata endpoints
- Pagination → Content API: pages · Shared pagination is applied to list responses
- Pagination → Services API: pages · Shared pagination is applied to list responses
- Pagination → Portfolio API: pages · Shared pagination is applied to list responses
- Content model → SEO model: generic parent · SEO metadata can attach to content objects through generic relations
- Content model → Testimonial model: generic parent · Testimonials can attach to content anchors through generic relations
- Content model → FAQ model: generic parent · FAQ entries can attach to content anchors through generic relations
- Service model → SEO model: generic parent · SEO metadata can attach to service objects through generic relations
- Portfolio model → SEO model: generic parent · SEO metadata can attach to portfolio objects through generic relations
