# mexrojxon/my_portfolio architecture

> Architecture diagram of the GitHub repository mexrojxon/my_portfolio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mexrojxon/my_portfolio
- Repository: https://github.com/mexrojxon/my_portfolio

## Overview

##### Project type and purpose
- This is a monolithic full‑stack web application built on Django (Python).
- It serves as a personal portfolio site with two main sections: an “About” app (resume, education, experience, contact, social links, portfolio items) and a “Blog” app (posts, comments).
- It uses Django’s MTV (Model‑Template‑View) architecture, with static/asset pipelines for CSS, JS, images, and an integrated rich‑text editor (CKEditor).

##### File‑structure analysis
- Top‑level: ─ manage.py (Django CLI), requirements.txt, config/ (project settings & routing), about/ and blog/ apps (models, views, forms, URL conf, migrations).
- Static assets: two parallel trees—“assets/” (project‑specific CSS/JS/fonts/images/files) and “static/” (Django‑collected static, admin assets, CKEditor).
- Templates for each app and a shared base.html in templates/.
- No microservices; all code runs in a single Django process (WSGI/ASGI).

##### Key README insight
- Minimal README (“My_portfolio”), but file names and structure reveal Django conventions and third‑party integrations (CKEditor, hitcount).

a. Client/browser
- Renders HTML/CSS/JS; downloads assets (CSS, JS, images, fonts).
b. Web server & application server
- Nginx (or Apache) to serve static files and proxy to Django.
- Gunicorn/Uvicorn/Daphne running Django (WSGI/ASGI).
c. Django project
- config/ (settings, URL router, WSGI/ASGI entrypoint)
- Apps: about/ and blog/ handling HTTP endpoints.
- Middleware (security, sessions, CSRF, hit‑count tracker).
- Forms (contact form posting).
- Admin site (configurable via config/settings.py + static/admin).
d. Database
- Relational DB (SQLite, Postgres, MySQL) storing models: ResumeModel, EducationModel, ExperienceModel, PortfolioModel, ContactModel, SocialMediaModel, BlogPostModel, CommentModel, HitCount.
e. External services
- SMTP or third‑party email service for contact form.
- CDN or object storage (optional) for serving static/media.
f. Third‑party libraries
- CKEditor for rich text editing in admin/blog forms.
- jQuery plugins (smoothscroll, pagepiling).
- Django‑hitcount for tracking blog views.

##### Relationships and data flow
- Browser → HTTP request → Nginx → Django entrypoint (WSGI/ASGI).
- URL router → Middleware → App view → (a) Query ORM → Database → return Model instances; (b) Validate Form → send email or save ContactModel.
- View → Render template with context → HTML → back through Nginx → Browser.
- Static requests → Nginx serves from /static/ or /assets/.
- Admin user → login → Django admin app → CRUD models.
- CKEditor assets loaded in admin forms via static/ckeditor/.

##### Architectural patterns and principles
- MTV (Model‑Template‑View)
- Separation of concerns:
- Models hold data schema
- Views (and forms) handle business logic and validation
- Templates handle presentation
- Layered architecture:
- Presentation (Browser + templates)
- Application (Django apps)
- Data (Database)
- Reuse and modularity: discrete apps (about, blog), reusable static/asset bundles.

##### Essential elements to capture
- Entry points: manage.py (dev), WSGI/ASGI (prod)
- URL dispatcher
- Middleware chain (CSRF, sessions, hit‑count)
- App modules (about, blog) with their models/views/forms
- Database schema simplified to main entities
- Static asset pipeline (assets → collectstatic → static/)
- External SMTP/CDN if used
- Admin interface as a separate flow

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        Browser["Browser"]:::frontend
        Assets["Project Assets (assets/)"]:::static
        StaticFiles["Collected Static (static/)"]:::static
    end

    Browser -->|HTTP GET/POST| Nginx["Nginx/Apache"]:::server
    Assets -->|collectstatic→| StaticFiles
    StaticFiles -->|served| Nginx

    %% Web Server Layer
    subgraph "Web Server Layer"
        Nginx -->|Proxy HTTP| AppServer["Gunicorn/Uvicorn (WSGI/ASGI)"]:::server
    end

    %% Application Layer
    subgraph "Application Layer"
        manage["manage.py"]:::app
        configSettings["config/settings.py"]:::app
        configUrls["config/urls.py"]:::app
        configWSGI["config/wsgi.py"]:::app
        configASGI["config/asgi.py"]:::app
        middleware["Middleware (CSRF, Sessions, HitCount)"]:::app
        router["URL Dispatcher"]:::app
        adminSite["Django Admin"]:::app

        AppServer --> configWSGI
        AppServer --> configASGI
        manage --> configSettings
        configSettings --> configUrls
        configUrls --> middleware
        middleware --> router
        router --> aboutApp
        router --> blogApp
        router --> adminSite

        subgraph "About App"
            aboutModels["about/models.py"]:::app
            aboutViews["about/views.py"]:::app
            aboutForms["about/form.py"]:::app
            aboutUrls["about/urls.py"]:::app
            aboutAdmin["about/admin.py"]:::app
            aboutMigrations["about/migrations/"]:::app
        end

        subgraph "Blog App"
            blogModels["blog/models.py"]:::app
            blogViews["blog/views.py"]:::app
            blogForms["blog/form.py"]:::app
            blogUrls["blog/urls.py"]:::app
            blogAdmin["blog/admin.py"]:::app
            blogMigrations["blog/migrations/"]:::app
        end

        router --> aboutUrls
        aboutUrls --> aboutViews
        aboutViews --> aboutModels
        aboutViews --> aboutForms
        aboutViews --> sendEmail
        aboutViews --> renderAbout

        router --> blogUrls
        blogUrls --> blogViews
        blogViews --> blogModels
        blogViews --> blogForms
        blogViews --> renderBlog

        adminSite --> aboutAdmin
        adminSite --> blogAdmin
        adminSite --> StaticAdmin
        adminSite --> CKEditorAssets
        adminSite --> HitcountJS

        renderAbout --> Browser
        renderBlog --> Browser

    end

    %% Template Rendering
    subgraph "Templates"
        baseTemplate["templates/base.html"]:::static
        aboutIndex["templates/about/index.html"]:::static
        aboutError["templates/about/error.html"]:::static
        blogList["templates/blog/blog.html"]:::static
        blogDetail["templates/blog/blog-detail.html"]:::static
    end

    aboutViews --> baseTemplate
    aboutViews --> aboutIndex
    aboutViews --> aboutError
    blogViews --> baseTemplate
    blogViews --> blogList
    blogViews --> blogDetail

    %% Data Layer
    subgraph "Data Layer"
        DB["Relational Database"]:::db
    end

    aboutModels --> DB
    blogModels --> DB
    aboutMigrations --> DB
    blogMigrations --> DB

    %% External Services
    subgraph "External Services"
        sendEmail["SMTP/Email Service"]:::external
        CDN["CDN/Object Storage"]:::external
    end

    aboutForms --> sendEmail
    Assets --> CDN
    StaticFiles --> CDN

    %% Static Admin & Plugins
    StaticAdmin["static/admin/"]:::static
    CKEditorAssets["static/ckeditor/"]:::static
    HitcountJS["static/hitcount/hitcount-jquery.js & jquery.postcsrf.js"]:::static

    %% Requirements
    reqs["requirements.txt"]:::doc

    %% Click Events
    click manage "https://github.com/mexrojxon/my_portfolio/blob/main/manage.py"
    click configSettings "https://github.com/mexrojxon/my_portfolio/blob/main/config/settings.py"
    click configUrls "https://github.com/mexrojxon/my_portfolio/blob/main/config/urls.py"
    click configWSGI "https://github.com/mexrojxon/my_portfolio/blob/main/config/wsgi.py"
    click configASGI "https://github.com/mexrojxon/my_portfolio/blob/main/config/asgi.py"
    click aboutModels "https://github.com/mexrojxon/my_portfolio/blob/main/about/models.py"
    click aboutViews "https://github.com/mexrojxon/my_portfolio/blob/main/about/views.py"
    click aboutForms "https://github.com/mexrojxon/my_portfolio/blob/main/about/form.py"
    click aboutUrls "https://github.com/mexrojxon/my_portfolio/blob/main/about/urls.py"
    click aboutAdmin "https://github.com/mexrojxon/my_portfolio/blob/main/about/admin.py"
    click aboutMigrations "https://github.com/mexrojxon/my_portfolio/tree/main/about/migrations/"
    click blogModels "https://github.com/mexrojxon/my_portfolio/blob/main/blog/models.py"
    click blogViews "https://github.com/mexrojxon/my_portfolio/blob/main/blog/views.py"
    click blogForms "https://github.com/mexrojxon/my_portfolio/blob/main/blog/form.py"
    click blogUrls "https://github.com/mexrojxon/my_portfolio/blob/main/blog/urls.py"
    click blogAdmin "https://github.com/mexrojxon/my_portfolio/blob/main/blog/admin.py"
    click blogMigrations "https://github.com/mexrojxon/my_portfolio/tree/main/blog/migrations/"
    click baseTemplate "https://github.com/mexrojxon/my_portfolio/blob/main/templates/base.html"
    click aboutIndex "https://github.com/mexrojxon/my_portfolio/blob/main/templates/about/index.html"
    click aboutError "https://github.com/mexrojxon/my_portfolio/blob/main/templates/about/error.html"
    click blogList "https://github.com/mexrojxon/my_portfolio/blob/main/templates/blog/blog.html"
    click blogDetail "https://github.com/mexrojxon/my_portfolio/blob/main/templates/blog/blog-detail.html"
    click Assets "https://github.com/mexrojxon/my_portfolio/tree/main/assets/"
    click StaticAdmin "https://github.com/mexrojxon/my_portfolio/tree/main/static/admin/"
    click CKEditorAssets "https://github.com/mexrojxon/my_portfolio/tree/main/static/ckeditor/"
    click HitcountJS "https://github.com/mexrojxon/my_portfolio/blob/main/static/hitcount/hitcount-jquery.js"
    click reqs "https://github.com/mexrojxon/my_portfolio/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#f9f,stroke:#333,stroke-width:1px
    classDef server fill:#bbf,stroke:#333,stroke-width:1px
    classDef app fill:#bfb,stroke:#333,stroke-width:1px
    classDef db fill:#fbf,stroke:#333,stroke-width:1px
    classDef external fill:#ffb,stroke:#333,stroke-width:1px
    classDef static fill:#ffe,stroke:#333,stroke-width:1px
    classDef doc fill:#ddd,stroke:#333,stroke-width:1px
```
