# kaykow07/flask-todo-app-modular architecture

> Architecture diagram of the GitHub repository kaykow07/flask-todo-app-modular, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kaykow07/flask-todo-app-modular
- Repository: https://github.com/kaykow07/flask-todo-app-modular

## Overview

##### Project Type and Purpose
- This is a monolithic, server-rendered web application built with Flask using a modular, Blueprint-based structure.
- It provides user authentication (Flask-Login), task CRUD operations, and dynamic configuration for SQLite (dev) vs. PostgreSQL (prod).

##### File Structure
- Top level:
- app.py – entry point that calls crear_app() and starts the server
- aplicacion/
– __init__.py – factory function (crear_app), configuration, DB (SQLAlchemy) init, Blueprint registration, login manager
– rutas_tareas.py – task-related routes, Blueprint definition, view functions for CRUD
- templates/ – Jinja2 HTML templates for login, registration, task list, update, base layout, welcome
- requirements.txt – Flask, Flask-Login, SQLAlchemy, psycopg2, Gunicorn, etc.
- No separate “frontend” SPA: views and controllers live in Flask Blueprints.
- Deployment files: none beyond requirements; production uses Gunicorn (gunicorn app:app) on Render with environment variables for DB URL.

##### Key README Insights
- Modular Flask with Blueprints
- Dual-environment (SQLite vs. PostgreSQL) via dynamic config in factory
- Uses Gunicorn on Render for CI/CD deployment

a. Main Components
1. Client Browser
2. Load Balancer / Render Router (optional)
3. Gunicorn WSGI Server
4. Flask Application (crear_app factory)
– Auth Blueprint (Flask-Login)
– Task Blueprint (rutas_tareas.py)
– Configuration Module (dev vs. prod)
– ORM Layer (SQLAlchemy models and session)
5. Database
– SQLite file (development)
– PostgreSQL instance (production on Render)
6. Templates / Static Assets (Jinja2 templates)
b. Relationships & Data Flows
- Within Flask: request → appropriate Blueprint route → service logic → DB (ORM) → returns model/data → template renderer → HTTP response → Browser
c. Architectural Patterns
- Application Factory pattern
- Blueprint modularization (separation of concerns for auth vs. task management)
- Layered MVC-like approach:
- Controllers (rutas_tareas, auth routes)
- Models (SQLAlchemy entities)
- Views (templates)
- Config abstraction for environment switching
d. Technologies & Frameworks
- Flask + Blueprints
- Flask-Login for session management
- SQLAlchemy ORM
- PostgreSQL (prod) / SQLite (dev)
- Gunicorn (WSGI server)
- Jinja2 (templating)

## Diagram (Mermaid)

```mermaid
flowchart TB
    Client["Client Browser"]:::external
    RenderLB["Render Load Balancer"]:::infra
    Gunicorn["Gunicorn WSGI Server"]:::infra
    subgraph "Flask Application (crear_app)" 
        direction TB
        Config["Configuration Module\n(env-based DB switch)"]:::appmod
        AuthBP["Auth Blueprint\n(Flask-Login)"]:::appmod
        TaskBP["Task Blueprint\n(rutas_tareas.py)"]:::appmod
        ORM["SQLAlchemy ORM"]:::appmod
        Templates["Jinja2 Templates"]:::views
        Config -.-> AuthBP
        Config -.-> TaskBP
        AuthBP -->|uses ORM| ORM
        TaskBP -->|uses ORM| ORM
        AuthBP -->|renders views| Templates
        TaskBP -->|renders views| Templates
    end
    DB["PostgreSQL / SQLite"]:::db

    Client -->|"HTTP Request"| RenderLB
    RenderLB -->|"forwards request"| Gunicorn
    Gunicorn -->|"calls app:app"| Config
    Config -->|"dispatch request"| AuthBP & TaskBP
    ORM -->|"executes queries"| DB
    Templates -->|"HTML Response"| Client

    classDef external fill:#AED6F1,stroke:#2980B9,color:#1B2631;
    classDef infra fill:#A9DFBF,stroke:#27AE60,color:#145A32;
    classDef appmod fill:#F9E79F,stroke:#B7950B,color:#7D6608;
    classDef views fill:#D2B4DE,stroke:#8E44AD,color:#4A235A;
    classDef db fill:#E5E7E9,stroke:#ABB2B9,color:#1C2833;

    click app.py "https://github.com/kaykow07/flask-todo-app-modular/blob/main/app.py"
    click Config "https://github.com/kaykow07/flask-todo-app-modular/blob/main/aplicacion/__init__.py"
    click AuthBP "https://github.com/kaykow07/flask-todo-app-modular/blob/main/aplicacion/__init__.py"
    click TaskBP "https://github.com/kaykow07/flask-todo-app-modular/blob/main/aplicacion/rutas_tareas.py"
    click Templates "https://github.com/kaykow07/flask-todo-app-modular/tree/main/templates/"
    click requirements.txt "https://github.com/kaykow07/flask-todo-app-modular/blob/main/requirements.txt"
    click Templates "https://github.com/kaykow07/flask-todo-app-modular/blob/main/templates/base.html"
    click Templates "https://github.com/kaykow07/flask-todo-app-modular/blob/main/templates/login.html"
    click Templates "https://github.com/kaykow07/flask-todo-app-modular/blob/main/templates/registro.html"
    click Templates "https://github.com/kaykow07/flask-todo-app-modular/blob/main/templates/index_tareas.html"
    click Templates "https://github.com/kaykow07/flask-todo-app-modular/blob/main/templates/actualizar.html"
    click Templates "https://github.com/kaykow07/flask-todo-app-modular/blob/main/templates/bienvenida.html"
```
