# sungbinlee/django-blog-service architecture

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

- Interactive diagram: https://gitdiagram.com/sungbinlee/django-blog-service
- Repository: https://github.com/sungbinlee/django-blog-service

## Overview

1. **Overall shape**
   - This is a single Django project named `blogservice` with two main domain apps: `blog` and `user`.
   - The app is server-rendered: views return HTML templates rather than exposing a separate API layer.

2. **Request entry points**
   - `blogservice/urls.py` is the top-level router and delegates to app-specific URL modules.
   - `manage.py` is the local execution entry for migrations and development startup.
   - `wsgi.py` and `asgi.py` are present, but the README indicates production runs through **Gunicorn behind Nginx**.

3. **Core domain split**
   - `user` owns account lifecycle: registration, login, profile update, email verification, and activation state.
   - `blog` owns content lifecycle: posts, tags, images, comments, replies, likes, search, and view counts.
   - This split is the main architectural boundary in the repository.

4. **Data model layer**
   - Each app has its own `models.py` and migrations, so schema changes are app-scoped.
   - `user` includes a custom user model with fields such as profile picture and active/inactive status.
   - `blog` contains the post/comment/reply model family and related features like likes, tags, and image attachment.
   - `admin.py` in both apps exposes those models to Django admin for back-office management.

5. **Authentication and onboarding flow**
   - Registration starts in `user/forms.py` and `user/views.py`.
   - After signup, the system sends an email verification link using Django email utilities and a tokenized URL.
   - Verification toggles the user’s `is_active` state; only activated users can proceed to normal login.
   - The README implies SMTP is used for outbound email, configured through environment-based settings.

6. **Blog content flow**
   - Blog CRUD is handled in `blog/views.py` with forms in `blog/forms.py`.
   - Users can create, update, delete, and view posts; posts support tags, search, images, and view counts.
   - Detail pages also serve as the hub for comment and reply actions, so most interaction flows converge on post detail.

7. **Interaction features**
   - Comments and nested replies are first-class entities, each with create/edit/delete paths.
   - Likes are supported for both posts and comments, implying separate relationship/state updates on those models.
   - Search is exposed as a blog function, and the README indicates search by **title and tag**.

8. **Presentation layer**
   - Templates are organized by app: `blog/templates/blog/*` and `user/templates/user/*`.
   - Shared site chrome lives in `templates/base.html`, with a custom `404.html` and an `index.html` landing page.
   - `context_processors.py` suggests some global template context is injected across pages.

9. **Shared project utilities**
   - `blogservice/views.py` and `blogservice/utils.py` likely provide project-level pages/helpers that are not owned by a specific domain app.
   - `settings.py` is responsible for environment-driven configuration, including secret keys and email settings.
   - This is where runtime concerns like installed apps, authentication configuration, media/static behavior, and deployment settings are centralized.

10. **Operational boundaries**
   - The repository assumes a classic Django deployment stack: browser → Nginx → Gunicorn → Django app → database.
   - Email verification adds an external dependency on an SMTP provider.
   - Image uploads imply a separate file/media storage boundary from the relational database.
   - Because the app is template-driven, the backend and frontend are tightly coupled through Django’s server-side rendering path.

Main entry points: [`blogservice/blogservice/settings.py`](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/settings.py) (settings), [`blogservice/blog/views.py`](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/views.py) (blog views), [`blogservice/user/views.py`](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/views.py) (user views), [`blogservice/blogservice/urls.py`](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/urls.py) (root urls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_project["Project core"]
  node_manage_py["manage.py<br/>entrypoint<br/>[manage.py]"]
  node_project_settings["settings<br/>config<br/>[settings.py]"]
  node_project_urls["root urls<br/>router<br/>[urls.py]"]
  node_project_views["site views<br/>web views<br/>[views.py]"]
  node_project_utils["utils<br/>helpers<br/>[utils.py]"]
  node_wsgi_asgi["wsgi/asgi<br/>runtime entrypoints<br/>[wsgi.py]"]
end

subgraph group_blog["Blog app"]
  node_blog_urls["blog urls<br/>router<br/>[urls.py]"]
  node_blog_views["blog views<br/>web views<br/>[views.py]"]
  node_blog_forms["blog forms<br/>[forms.py]"]
  node_blog_models[("blog models<br/>domain models<br/>[models.py]")]
  node_blog_admin["blog admin<br/>[admin.py]"]
end

subgraph group_user["User app"]
  node_user_urls["user urls<br/>router<br/>[urls.py]"]
  node_user_views["user views<br/>web views<br/>[views.py]"]
  node_user_forms["user forms<br/>[forms.py]"]
  node_user_models[("user models<br/>domain models<br/>[models.py]")]
  node_user_admin["user admin<br/>[admin.py]"]
end

subgraph group_presentation["Presentation"]
  node_base_templates["base templates<br/>shared templates<br/>[base.html]"]
  node_blog_templates["blog templates<br/>[post_detail.html]"]
  node_user_templates["user templates<br/>[login.html]"]
end

node_manage_py -->|"loads settings"| node_project_settings
node_project_urls -->|"routes to"| node_blog_urls
node_project_urls -->|"routes to"| node_user_urls
node_project_urls -->|"serves"| node_project_views
node_project_views -->|"renders"| node_base_templates
node_blog_urls -->|"dispatches"| node_blog_views
node_blog_views -->|"uses"| node_blog_forms
node_blog_views -->|"reads/writes"| node_blog_models
node_blog_views -->|"renders"| node_blog_templates
node_blog_models -->|"registered in"| node_blog_admin
node_user_urls -->|"dispatches"| node_user_views
node_user_views -->|"uses"| node_user_forms
node_user_views -->|"reads/writes"| node_user_models
node_user_views -->|"renders"| node_user_templates
node_user_models -->|"registered in"| node_user_admin
node_blog_templates -->|"extends"| node_base_templates
node_user_templates -->|"extends"| node_base_templates
node_project_settings -->|"configures"| node_project_urls
node_project_settings -->|"configures"| node_blog_models
node_project_settings -->|"configures"| node_user_models
node_project_settings -->|"serves"| node_wsgi_asgi
node_blog_views -->|"uses"| node_project_utils
node_user_views -->|"uses"| node_project_utils

click node_manage_py "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/manage.py"
click node_project_settings "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/settings.py"
click node_project_urls "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/urls.py"
click node_project_views "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/views.py"
click node_project_utils "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/utils.py"
click node_wsgi_asgi "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/wsgi.py"
click node_blog_urls "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/urls.py"
click node_blog_views "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/views.py"
click node_blog_forms "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/forms.py"
click node_blog_models "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/models.py"
click node_blog_admin "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/admin.py"
click node_user_urls "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/urls.py"
click node_user_views "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/views.py"
click node_user_forms "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/forms.py"
click node_user_models "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/models.py"
click node_user_admin "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/admin.py"
click node_base_templates "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/templates/base.html"
click node_blog_templates "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/templates/blog/post_detail.html"
click node_user_templates "https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/templates/user/login.html"

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_manage_py,node_project_settings,node_project_urls,node_project_views,node_project_utils,node_wsgi_asgi toneBlue
class node_blog_urls,node_blog_views,node_blog_forms,node_blog_models,node_blog_admin toneAmber
class node_user_urls,node_user_views,node_user_forms,node_user_models,node_user_admin toneMint
class node_base_templates,node_blog_templates,node_user_templates toneRose
```

## Components

### Project core

Django project configuration and entrypoints

- [manage.py](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/manage.py): entrypoint · Local command runner for Django management tasks · `blogservice/manage.py`
- [settings](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/settings.py): config · Central Django settings and environment wiring · `blogservice/blogservice/settings.py`
- [root urls](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/urls.py): router · Top-level URL dispatcher delegating to app routers · `blogservice/blogservice/urls.py`
- [site views](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/views.py): web views · Project-level pages such as landing and error handling · `blogservice/blogservice/views.py`
- [utils](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/utils.py): helpers · Shared project helpers used across the Django site · `blogservice/blogservice/utils.py`
- [wsgi/asgi](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blogservice/wsgi.py): runtime entrypoints · Deployment interfaces for sync and async servers · `blogservice/blogservice/wsgi.py`

### Blog app

Content, discussion, and search domain

- [blog urls](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/urls.py): router · Blog app route definitions · `blogservice/blog/urls.py`
- [blog views](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/views.py): web views · Post lifecycle, interaction, and search handlers · `blogservice/blog/views.py`
- [blog forms](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/forms.py): forms · Validation and submission forms for blog actions · `blogservice/blog/forms.py`
- [blog models](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/models.py): domain models · Posts, comments, replies, likes, tags, and images · `blogservice/blog/models.py`
- [blog admin](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/admin.py): admin · Django admin registration for blog models · `blogservice/blog/admin.py`

### User app

Accounts, onboarding, and profile domain

- [user urls](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/urls.py): router · Account and onboarding route definitions · `blogservice/user/urls.py`
- [user views](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/views.py): web views · Registration, login, verification, and profile handlers · `blogservice/user/views.py`
- [user forms](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/forms.py): forms · Validation and submission forms for account flows · `blogservice/user/forms.py`
- [user models](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/models.py): domain models · Custom user model and activation/profile fields · `blogservice/user/models.py`
- [user admin](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/admin.py): admin · Django admin registration for user models · `blogservice/user/admin.py`

### Presentation

Shared and app-specific templates

- [base templates](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/templates/base.html): shared templates · Shared site chrome, landing page, and 404 page · `blogservice/templates/base.html`
- [blog templates](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/blog/templates/blog/post_detail.html): templates · Post list, detail, CRUD, and search pages · `blogservice/blog/templates/blog/post_detail.html`
- [user templates](https://github.com/sungbinlee/django-blog-service/blob/main/blogservice/user/templates/user/login.html): templates · Login, registration, verification, and profile pages · `blogservice/user/templates/user/login.html`

## Connections

- manage.py → settings: loads settings · Management commands bootstrap the Django project configuration
- root urls → blog urls: routes to · Root router delegates blog requests to the blog app
- root urls → user urls: routes to · Root router delegates account requests to the user app
- root urls → site views: serves · Root project routes also expose shared site pages
- site views → base templates: renders · Project pages use the shared site shell
- blog urls → blog views: dispatches · Blog routes are implemented by blog view handlers
- blog views → blog forms: uses · Blog actions rely on forms for validation and submission
- blog views → blog models: reads/writes · Content operations persist to blog domain models
- blog views → blog templates: renders · Blog handlers return server-rendered templates
- blog models → blog admin: registered in · Blog models are exposed through Django admin
- user urls → user views: dispatches · Account routes are implemented by user view handlers
- user views → user forms: uses · Registration and profile flows rely on forms
- user views → user models: reads/writes · Authentication and verification update the custom user model
- user views → user templates: renders · Account flows return server-rendered templates
- user models → user admin: registered in · User models are exposed through Django admin
- blog templates → base templates: extends · Blog pages share the common base layout
- user templates → base templates: extends · User pages share the common base layout
- settings → root urls: configures · Settings wire the URL configuration and runtime behavior
- settings → blog models: configures · Settings provide app configuration and persistence context
- settings → user models: configures · Settings provide app configuration and persistence context
- settings → wsgi/asgi: serves · Deployment entrypoints load the configured Django project
- blog views → utils: uses · Blog behavior can rely on shared project helpers
- user views → utils: uses · Account flows can rely on shared project helpers
