How kaykow07/flask-todo-app-modular works
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)