# jainik15/flaskblog architecture

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

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

## Overview

##### Project type and purpose
- This is a monolithic, full-stack web application built with Flask (Python) that provides CRUD functionality for a simple blog.
- The README calls out features (Create, Read, Update, Delete posts), tech stack (Flask, Flask-SQLAlchemy, SQLite, Jinja2), and use cases (learning back-end fundamentals).

##### File structure
- Top level:
– app.py: the Flask application entry point, defines routes, controllers, and ORM setup
– blog.db: SQLite database file used by SQLAlchemy
– requirements.txt (implied by README): dependency list
– tempCodeRunnerFile.py: scratch code, can be ignored in the architecture
– __pycache__: Python bytecode caches, not part of logical architecture
- templates/: Jinja2-based HTML views
– base.html: main layout template
– index.html, add_post.html, edit_post.html: feature-specific views

##### README for additional insights
- Confirms that app.py sets up Flask and SQLAlchemy, handles HTTP routes for CRUD operations, and uses flash messages for user feedback.
- No external services or microservices—everything runs in a single Flask process.

a. Main components
1. Client (Web Browser)
2. Flask Application Server (app.py)
– Routing Layer (Flask @app.route handlers)
– Controller / Business Logic (CRUD operation functions)
– ORM Layer (Flask-SQLAlchemy)
– Templating Engine (Jinja2)
3. Database (SQLite – blog.db file)
b. Relationships & interactions
- Browser ↔ HTTP ↔ Flask Server
- Flask Server → SQLAlchemy ORM → SQLite
- Flask Server → Jinja2 templates → HTML responses → Browser
c. Architectural patterns & principles
- MVC-style separation:
– Model: SQLAlchemy ORM classes (defined in app.py)
– View: Jinja2 templates under templates/
– Controller: Flask route handlers in app.py
- Single-process monolith—no external microservices
d. Key technologies & frameworks
- Python 3.x, Flask, Flask-SQLAlchemy (ORM), SQLite, Jinja2, Custom CSS

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Tier
    subgraph "Client Tier"
        direction TB
        Browser["Web Browser"]:::external
    end

    %% Application Tier
    subgraph "Application Tier"
        direction TB
        Routing["Routing Layer\n(app.py)"]:::app
        Controller["Controller / Business Logic\n(app.py)"]:::app
        ORM["ORM Layer\n(app.py)"]:::app
        Templates["Templating Engine\n(templates/)"]:::app
    end

    %% Data Tier
    subgraph "Data Tier"
        direction TB
        DB["SQLite Database\n(blog.db)"]:::db
    end

    %% Connections
    Browser -->|"HTTP GET/POST"| Routing
    Routing -->|"invoke handlers"| Controller
    Controller -->|"ORM Queries"| ORM
    ORM -->|"SQL Queries"| DB
    Controller -->|"render templates"| Templates
    Templates -->|"HTML Response"| Browser

    %% Click Events
    click Routing "https://github.com/jainik15/flaskblog/blob/main/app.py"
    click Controller "https://github.com/jainik15/flaskblog/blob/main/app.py"
    click ORM "https://github.com/jainik15/flaskblog/blob/main/app.py"
    click Templates "https://github.com/jainik15/flaskblog/tree/main/templates/"
    click DB "https://github.com/jainik15/flaskblog/blob/main/blog.db"

    %% Styles
    classDef external fill:#ADD8E6,stroke:#000
    classDef app fill:#98FB98,stroke:#000
    classDef db fill:#FFA500,stroke:#000
```
