How suyog123-hub/cms-project works
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 Router · app_content/models.py Content model · app_content/urls.py Content API · app_seo/models.py SEO model
Components 22
Clients
External callers and operator surfaces
- API clients · Frontends and third-party consumers calling the REST API
- Admin · Internal management surface via Django admin registrations
app_user/admin.py
Backend
Django project and shared DRF infrastructure
- Router · Project-level URL dispatcher that mounts app APIs and auth endpoints
cms/urls.py - Settings · Central runtime configuration for auth, CORS, throttling, database, and media
cms/settings.py - Pagination · Reusable page-number pagination shared across API views
pagination.py - Permissions · Reusable permission logic shared across protected endpoints
permissions.py
Domain apps
Modular business boundaries inside the monolith
- User API · Registration, login, and token issuance for stateless JWT access
app_user/urls.py - Content API · Articles and core content CRUD with categories, tags, status, and media
app_content/urls.py - Services API · Service-page content modeled separately from articles and portfolio
app_services/urls.py - Portfolio API · Project and portfolio entries with their own taxonomy and workflow
app_portfolio/urls.py - SEO API · Reusable SEO metadata attached polymorphically to content objects
app_seo/urls.py - Testimonials API · Testimonials linked to different parent models through generic relations
app_testimonials/urls.py - FAQ API · FAQ entries that can attach to multiple content domains
app_faq/urls.py - User model · User persistence and account-related records
app_user/models.py - Content model · Primary article/content records and related taxonomy
app_content/models.py - Service model · Service-page records and taxonomy
app_services/models.py - Portfolio model · Portfolio/project records and taxonomy
app_portfolio/models.py - SEO model · Polymorphic SEO metadata via generic relations
app_seo/models.py - Testimonial model · Testimonials linked to anchors across the content domains
app_testimonials/models.py - FAQ model · FAQ entries linked to multiple parent object types
app_faq/models.py
Storage
Database and file persistence
- MySQL · Shared relational persistence for all Django apps
- Media store · Uploaded content images, post thumbnails, and featured images
media
Connections 39
- 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