# shubhajeet1207/writeabit architecture

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

- Interactive diagram: https://gitdiagram.com/shubhajeet1207/writeabit
- Repository: https://github.com/shubhajeet1207/writeabit

## Overview

##### Main Components

a) Frontend Layer:
- Templates directory structure (/blog/templates, /users/templates)
- Static assets (CSS, JavaScript, images)
- Client-side interactions

b) Backend Layer:
- Django Framework
- Two main Django apps: 'blog' and 'users'
- Authentication system
- File handling system (AWS S3 integration option)

c) Database Layer:
- Database models (Post, Profile)
- Migrations
- Relationships between models

**[Client Layer]**
- ↑↓
**[Application Layer]**
- ↑↓
**[Data Layer]**

##### Specific Component Details

Client Layer:
- Template hierarchy (base.html extending to other templates)
- Static file management
- User interface components (login, register, blog posts, profile)

Application Layer:
- URL routing (/blog/urls.py, django_project/urls.py)
- View controllers (blog/views.py, users/views.py)
- Forms processing (users/forms.py)
- Authentication middleware
- File storage handler (AWS S3 connector)

Data Layer:
- Database models (Post, Profile)
- Media storage (profile pictures)
- Static file storage

##### Important Relationships to Highlight

- User authentication flow
- Blog post CRUD operations
- Profile management
- Static/Media file handling
- Database relationships between User, Profile, and Post models

##### Specific Features

- Password reset flow
- Profile picture upload mechanism
- Blog post management
- User registration and authentication
- Static file serving

- Use rectangles for components

**User → Authentication → Blog Actions**
**User → Profile Management → File Storage**
**Blog Posts → Database → Template Rendering**

This system design should help developers understand both the high-level architecture and the specific implementation details of the writeABit-BlogSite project.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]:::frontend
    end

    subgraph "Web Server"
        Heroku["Heroku Server"]:::server
        WSGI["WSGI Application"]:::server
        click WSGI "https://github.com/shubhajeet1207/writeabit/blob/main/django_project/wsgi.py"
    end

    subgraph "Django Application"
        Settings["Project Settings"]:::config
        click Settings "https://github.com/shubhajeet1207/writeabit/blob/main/django_project/settings.py"
        
        URLConf["URL Configuration"]:::router
        click URLConf "https://github.com/shubhajeet1207/writeabit/blob/main/django_project/urls.py"

        subgraph "Blog Module"
            BlogURLs["Blog URLs"]:::router
            click BlogURLs "https://github.com/shubhajeet1207/writeabit/blob/main/blog/urls.py"
            
            BlogViews["Blog Views"]:::controller
            click BlogViews "https://github.com/shubhajeet1207/writeabit/blob/main/blog/views.py"
            
            BlogModels["Blog Models"]:::model
            click BlogModels "https://github.com/shubhajeet1207/writeabit/blob/main/blog/models.py"
            
            BlogTemplates["Blog Templates"]:::view
            click BlogTemplates "https://github.com/shubhajeet1207/writeabit/tree/main/blog/templates/blog/"
            
            BlogStatic["Blog Static Files"]:::static
            click BlogStatic "https://github.com/shubhajeet1207/writeabit/tree/main/blog/static/blog/"
            
            BlogCSS["Blog CSS"]:::static
            click BlogCSS "https://github.com/shubhajeet1207/writeabit/blob/main/blog/static/blog/main.css"
            
            BlogJS["Blog JavaScript"]:::static
            click BlogJS "https://github.com/shubhajeet1207/writeabit/blob/main/blog/static/blog/script.js"
            
            BlogMigrations["Blog Migrations"]:::data
            click BlogMigrations "https://github.com/shubhajeet1207/writeabit/tree/main/blog/migrations/"
        end

        subgraph "Users Module"
            UserViews["User Views"]:::controller
            click UserViews "https://github.com/shubhajeet1207/writeabit/blob/main/users/views.py"
            
            UserModels["User Models"]:::model
            click UserModels "https://github.com/shubhajeet1207/writeabit/blob/main/users/models.py"
            
            UserForms["User Forms"]:::controller
            click UserForms "https://github.com/shubhajeet1207/writeabit/blob/main/users/forms.py"
            
            UserTemplates["User Templates"]:::view
            click UserTemplates "https://github.com/shubhajeet1207/writeabit/tree/main/users/templates/users/"
            
            PasswordReset["Password Reset Templates"]:::view
            click PasswordReset "https://github.com/shubhajeet1207/writeabit/blob/main/users/templates/users/password_reset.html"
            
            ProfileTemplate["Profile Template"]:::view
            click ProfileTemplate "https://github.com/shubhajeet1207/writeabit/blob/main/users/templates/users/profile.html"
            
            UserSignals["User Signals"]:::controller
            click UserSignals "https://github.com/shubhajeet1207/writeabit/blob/main/users/signals.py"
            
            UserMigrations["User Migrations"]:::data
            click UserMigrations "https://github.com/shubhajeet1207/writeabit/tree/main/users/migrations/"
        end

        subgraph "Static Files"
            StaticRoot["Collected Static Files"]:::static
            click StaticRoot "https://github.com/shubhajeet1207/writeabit/tree/main/staticfiles/"
            
            AdminStatic["Admin Static Files"]:::static
            click AdminStatic "https://github.com/shubhajeet1207/writeabit/tree/main/staticfiles/admin/"
            
            CollectedBlogStatic["Collected Blog Static"]:::static
            click CollectedBlogStatic "https://github.com/shubhajeet1207/writeabit/tree/main/staticfiles/blog/"
        end
    end

    subgraph "External Services"
        AWS["AWS S3 Storage"]:::external
        Database[(Database)]:::database
    end

    %% Connections
    Browser --> Heroku
    Heroku --> WSGI
    WSGI --> Settings
    Settings --> URLConf
    URLConf --> BlogURLs
    URLConf --> UserViews
    
    BlogURLs --> BlogViews
    BlogViews --> BlogModels
    BlogViews --> BlogTemplates
    BlogModels --> Database
    
    UserViews --> UserModels
    UserViews --> UserTemplates
    UserViews --> UserForms
    UserModels --> Database
    UserSignals --> UserModels
    
    BlogStatic --> StaticRoot
    AdminStatic --> StaticRoot
    CollectedBlogStatic --> StaticRoot
    
    BlogModels -.-> AWS
    UserModels -.-> AWS

    %% Styles
    classDef frontend fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef server fill:#90EE90,stroke:#333,stroke-width:2px
    classDef controller fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef model fill:#FFD700,stroke:#333,stroke-width:2px
    classDef view fill:#98FB98,stroke:#333,stroke-width:2px
    classDef static fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef router fill:#F0E68C,stroke:#333,stroke-width:2px
    classDef config fill:#E6E6FA,stroke:#333,stroke-width:2px
    classDef external fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef database fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef data fill:#FFA500,stroke:#333,stroke-width:2px
```
