How swappy514/flask-todo-app works
Purpose and Entry Point
This is a server-rendered Flask task-management application. It provides user registration/login, per-user task CRUD, and profile management through HTML pages rather than a separate API. run.py is the executable startup entry point; application setup resides in app/__init__.py.
Application Composition
The Flask application factory/configuration layer initializes the web application, database integration, and modular route registration. Route modules are organized as feature-focused Blueprints:
• App initialization: app/__init__.py
• Route package: app/routes/__init__.py
• Process startup: run.py
Persistence Model
SQLAlchemy ORM models define the core persisted domain: authenticated users and their task records. The committed SQLite database indicates a local, file-backed default runtime datastore.
• Domain/ORM definitions: app/models.py
• Local database instance: instance/todo.db
The primary ownership boundary is user-scoped data: authentication establishes the current user, and task/profile operations should operate on that user’s records rather than global task data.
Authentication and Identity Flow
Authentication routes handle registration and login, establish user identity/session state, and gate private workspace functionality. They render or redirect into the task and profile flows after successful authentication.
• Authentication Blueprint: app/routes/auth.py
• Login view: app/templates/login.html
• Registration view: app/templates/register.html
Task Management Flow
The tasks Blueprint is the central product workflow: authenticated users view their workspace and create, read, update, or delete task records through HTTP form interactions. It bridges request handling, ORM persistence, and task-page rendering.
• Task routes: app/routes/tasks.py
• Task workspace template: app/templates/tasks.html
• Data entities: app/models.py
Profile Flow
Profile routes expose user-account details and profile updates separately from task operations, maintaining an account-management boundary within the authenticated area.
• Profile routes: app/routes/profile.py
• Profile page: app/templates/profile.html
• Shared user model: app/models.py
Presentation and Runtime Boundary
Flask/Jinja2 renders page-specific templates into a shared layout, while browser-side CSS and JavaScript provide presentation and interaction behavior. The browser communicates with Flask through conventional routed requests; persistence remains server-side through SQLAlchemy and SQLite.
• Shared layout: app/templates/base.html
• Static styling: app/static/CSS/style.css
• Client script: app/static/js/script.js
Material runtime dependencies are Python, Flask, Jinja2, SQLAlchemy, HTML/CSS/JavaScript, and likely Bootstrap as referenced by the README. The deployment boundary is a standard Flask WSGI application, suitable for local execution or a Python hosting platform; no separate service, queue, or API infrastructure is represented in the repository.
Main entry points: auth.py Authentication · __init__.py Route registration · tasks.py Task CRUD · profile.py Profile management
Components 14
Browser Presentation
- Browser · Uses server-rendered pages and form requests.
- Shared layout
app/templates/base.html - Login and registration
app/templates/login.html - Task workspace
app/templates/tasks.html - Profile page
app/templates/profile.html - Styles and client script
app/static/CSS/style.css
Flask Application
- Process startup
run.py - App factory and setup · Initializes Flask, database integration, and route registration.
app/__init__.py - Route registration
app/routes/__init__.py - Authentication · Registers users, logs in, and establishes session identity.
app/routes/auth.py - Task CRUD · Authenticated per-user task operations.
app/routes/tasks.py - Profile management · Authenticated account detail and update flow.
app/routes/profile.py
Persistence
- Users and tasks · Defines user ownership of task records.
app/models.py - Local task database
instance/todo.db
Connections 19
- Browser → App factory and setup: HTTP requests
- Browser → Styles and client script: loads assets
- Process startup → App factory and setup: starts
- App factory and setup → Route registration: registers
- Route registration → Authentication: includes
- Route registration → Task CRUD: includes
- Route registration → Profile management: includes
- Authentication → Users and tasks: user lookup and creation
- Task CRUD → Users and tasks: user-scoped task CRUD
- Profile management → Users and tasks: user updates
- Users and tasks → Local task database: persists through ORM
- Authentication → Login and registration: renders
- Task CRUD → Task workspace: renders
- Profile management → Profile page: renders
- Login and registration → Shared layout: extends
- Task workspace → Shared layout: extends
- Profile page → Shared layout: extends
- Authentication → Task CRUD: authenticated redirect
- Authentication → Profile management: authenticated access