# dogukanurker/flaskblog architecture

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

- Interactive diagram: https://gitdiagram.com/dogukanurker/flaskblog
- Repository: https://github.com/dogukanurker/flaskblog

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Web Application Layer:
- Flask Application Server (app.py as the entry point)
- Route Controllers (routes/ directory)
- Template Engine (Jinja2)
- Static Assets (static/tailwindUI/)

b) Database Layer:
- SQLite3 Databases (db/):
- users.db
- posts.db
- comments.db

c) Authentication & Security:
- Google reCAPTCHA v3
- Password Management System
- User Verification System

d) External Services:
- Time Zone Service
- Mail Service (for password reset)

##### Component Relationships

**[Client Browser] ←→ [Flask Application Server]**
- ↑
- [Route Controllers]
- [Template Engine]
- [Static Assets]
- ↓
**[External Services] ←→ [Authentication Layer] ←→ [Database Layer]**

##### Detailed Component Breakdown

Frontend Components (Purple):
- Theme System (Dark/Light)
- Summer Note Editor
- TailwindCSS Styling
- JavaScript Modules

Backend Components (Blue):
- Route Handlers
- Form Processing
- User Management
- Post Management
- Comment System
- Multi-language Support

Security Layer (Red):
- CSRF Protection
- reCAPTCHA Integration
- Password Hashing
- User Verification

Utility Services (Yellow):
- Logging System
- Debug Messages
- Database Checker
- Time Zone Handler

##### Data Flow Indicators

- User request flow
- Database operations
- Authentication processes
- Content delivery
- API interactions

##### Additional Elements

- Docker container boundary
- Testing environment (Playwright)
- Development tools
- Caching layer

For this specific Flask blog application, emphasize:
##### The theme switching mechanism

This will create a comprehensive yet understandable representation of the FlaskBlog system architecture.

## Diagram (Mermaid)

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

    subgraph Application["Application Layer"]
        Flask["Flask Server"]:::server
        click Flask "https://github.com/DogukanUrker/flaskBlog/blob/main/app.py"
        
        subgraph Routes["Route Controllers"]
            UserRoutes["User Management"]:::route
            click UserRoutes "https://github.com/DogukanUrker/flaskBlog/tree/main/routes/"
            PostRoutes["Post Management"]:::route
            click PostRoutes "https://github.com/DogukanUrker/flaskBlog/blob/main/routes/createPost.py"
            AdminRoutes["Admin Panel"]:::route
            click AdminRoutes "https://github.com/DogukanUrker/flaskBlog/blob/main/routes/adminPanel.py"
            SearchRoutes["Search System"]:::route
            click SearchRoutes "https://github.com/DogukanUrker/flaskBlog/blob/main/routes/search.py"
        end

        subgraph Frontend["Frontend Components"]
            Templates["Template Engine"]:::ui
            click Templates "https://github.com/DogukanUrker/flaskBlog/tree/main/templates/tailwindUI/"
            StaticAssets["Static Assets"]:::ui
            click StaticAssets "https://github.com/DogukanUrker/flaskBlog/tree/main/static/tailwindUI/"
            ThemeSystem["Theme System"]:::ui
            click ThemeSystem "https://github.com/DogukanUrker/flaskBlog/blob/main/static/tailwindUI/js/changeTheme.js"
        end
    end

    subgraph Security["Security Layer"]
        Auth["Authentication"]:::security
        Recaptcha["reCAPTCHA"]:::security
        click Recaptcha "https://github.com/DogukanUrker/flaskBlog/blob/main/static/tailwindUI/js/recaptcha.js"
        UserVerify["User Verification"]:::security
        click UserVerify "https://github.com/DogukanUrker/flaskBlog/blob/main/routes/verifyUser.py"
        Forms["Form Validation"]:::security
        click Forms "https://github.com/DogukanUrker/flaskBlog/blob/main/utils/forms/FormInputStyle.py"
    end

    subgraph Database["Database Layer"]
        UsersDB[("Users DB")]:::database
        PostsDB[("Posts DB")]:::database
        CommentsDB[("Comments DB")]:::database
        click UsersDB "https://github.com/DogukanUrker/flaskBlog/tree/main/db/"
        click PostsDB "https://github.com/DogukanUrker/flaskBlog/tree/main/db/"
        click CommentsDB "https://github.com/DogukanUrker/flaskBlog/tree/main/db/"
    end

    subgraph Utils["Utility Services"]
        Logger["Logging System"]:::util
        click Logger "https://github.com/DogukanUrker/flaskBlog/blob/main/utils/log.py"
        TimeHandler["Time Handler"]:::util
        click TimeHandler "https://github.com/DogukanUrker/flaskBlog/blob/main/utils/time.py"
        DBChecker["Database Checker"]:::util
        click DBChecker "https://github.com/DogukanUrker/flaskBlog/blob/main/utils/dbChecker.py"
        Translation["Translation System"]:::util
        click Translation "https://github.com/DogukanUrker/flaskBlog/tree/main/translations/"
        ErrorHandler["Error Handling"]:::util
        click ErrorHandler "https://github.com/DogukanUrker/flaskBlog/tree/main/utils/errorHandlers/"
    end

    Browser <--> Flask
    Flask --> Routes
    Routes --> Frontend
    Frontend --> Browser
    Routes <--> Security
    Security <--> Database
    Routes <--> Utils
    Utils <--> Database

    classDef client fill:#9ca3af
    classDef server fill:#3b82f6
    classDef route fill:#60a5fa
    classDef ui fill:#a78bfa
    classDef security fill:#ef4444
    classDef database fill:#10b981
    classDef util fill:#f59e0b

    %% Legend
    subgraph Legend
        Client_["Client"]:::client
        Server_["Server Components"]:::server
        Route_["Routes"]:::route
        UI_["UI Components"]:::ui
        Security_["Security"]:::security
        Database_["Database"]:::database
        Util_["Utilities"]:::util
    end
```
