How t-cordoba/turnos-cuidado-mama works
Project type and purpose
• This is a monolithic full-stack web application built with Python and Flask.
• Purpose: allow family members to view a calendar on their phones, reserve and cancel day/night care shifts for their grandmother—no logins required.
File structure
• Entry point: run.py (invokes Flask app, likely via Gunicorn in production).
• config.py: reads environment variables (e.g., DATABASE_URL for NeonDB).
• Procfile: declares web process for PaaS (Heroku or similar).
• app/
• __init__.py: creates Flask app instance
• db.py: sets up SQLAlchemy engine/connection to PostgreSQL
• models.py: defines ORM models (shifts, users?)
• routes.py: defines HTTP endpoints (list calendar, reserve, cancel)
• static/: CSS, JS served as client assets
• templates/: Jinja2 HTML views (index.html, error.html)
• requirements.txt: Flask, SQLAlchemy, psycopg2-binary, etc.
README for additional insights
• Database: PostgreSQL hosted on NeonDB
• Mobile-optimized UI
• No authentication layer—simple CRUD over HTTP
• Intended for personal/family use, deployed as a small PaaS app
Main components & their interactions
a. Client (Mobile Web Browser)
• Sends HTTP GET/POST to reserve or cancel shifts
• Renders HTML + CSS + JavaScript
b. Web Server / App Layer (Flask Monolith)
• WSGI entrypoint (run.py + Gunicorn via Procfile)
• routes.py: controllers handling requests
• models.py & db.py: business logic and data access via SQLAlchemy
c. Data Layer (PostgreSQL on NeonDB)
• Persists shift data
d. Hosting Infrastructure
• PaaS (Heroku/Neon) with environment-driven config
Flow:
Client → (HTTP) → Flask routes → SQLAlchemy → PostgreSQL
Flask → renders Jinja2 templates + serves static files → Client
Architectural patterns & design principles
• MVC-style separation:
• Model = models.py + db.py
• View = Jinja2 templates + static assets
• Controller = routes.py
• Monolith: single deployable unit
• Twelve-factor principles: config via env vars, Procfile, dependencies in requirements.txt