# swappy514/flask-todo-app architecture

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

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

## Overview

#### 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: [`app/routes/auth.py`](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/auth.py) (Authentication), [`app/routes/__init__.py`](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/__init__.py) (Route registration), [`app/routes/tasks.py`](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/tasks.py) (Task CRUD), [`app/routes/profile.py`](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/profile.py) (Profile management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Browser Presentation"]
  node_browser(("Browser<br/>client"))
  node_base_template["Shared layout<br/>Jinja template<br/>[base.html]"]
  node_login_templates["Login and registration<br/>Jinja templates<br/>[login.html]"]
  node_tasks_template["Task workspace<br/>Jinja template<br/>[tasks.html]"]
  node_profile_template["Profile page<br/>Jinja template<br/>[profile.html]"]
  node_static_assets["Styles and client script<br/>static assets<br/>[style.css]"]
end

subgraph group_application["Flask Application"]
  node_startup{{"Process startup<br/>Python entry point<br/>[run.py]"}}
  node_app_factory["App factory and setup<br/>Flask configuration<br/>[__init__.py]"]
  node_route_package["Route registration<br/>Blueprint package<br/>[__init__.py]"]
  node_auth_routes["Authentication<br/>Auth Blueprint<br/>[auth.py]"]
  node_task_routes["Task CRUD<br/>Tasks Blueprint<br/>[tasks.py]"]
  node_profile_routes["Profile management<br/>Profile Blueprint<br/>[profile.py]"]
end

subgraph group_persistence["Persistence"]
  node_models["Users and tasks<br/>SQLAlchemy ORM models<br/>[models.py]"]
  node_sqlite[("Local task database<br/>SQLite database<br/>[todo.db]")]
end

node_browser -->|"HTTP requests"| node_app_factory
node_browser -->|"loads assets"| node_static_assets
node_startup -->|"starts"| node_app_factory
node_app_factory -->|"registers"| node_route_package
node_route_package -->|"includes"| node_auth_routes
node_route_package -->|"includes"| node_task_routes
node_route_package -->|"includes"| node_profile_routes
node_auth_routes -->|"user lookup and creation"| node_models
node_task_routes -->|"user-scoped task CRUD"| node_models
node_profile_routes -->|"user updates"| node_models
node_models -->|"persists through ORM"| node_sqlite
node_auth_routes -->|"renders"| node_login_templates
node_task_routes -->|"renders"| node_tasks_template
node_profile_routes -->|"renders"| node_profile_template
node_login_templates -.->|"extends"| node_base_template
node_tasks_template -.->|"extends"| node_base_template
node_profile_template -.->|"extends"| node_base_template
node_auth_routes -.->|"authenticated redirect"| node_task_routes
node_auth_routes -.->|"authenticated access"| node_profile_routes

click node_base_template "https://github.com/swappy514/flask-todo-app/blob/main/app/templates/base.html"
click node_login_templates "https://github.com/swappy514/flask-todo-app/blob/main/app/templates/login.html"
click node_tasks_template "https://github.com/swappy514/flask-todo-app/blob/main/app/templates/tasks.html"
click node_profile_template "https://github.com/swappy514/flask-todo-app/blob/main/app/templates/profile.html"
click node_static_assets "https://github.com/swappy514/flask-todo-app/blob/main/app/static/CSS/style.css"
click node_startup "https://github.com/swappy514/flask-todo-app/blob/main/run.py"
click node_app_factory "https://github.com/swappy514/flask-todo-app/blob/main/app/__init__.py"
click node_route_package "https://github.com/swappy514/flask-todo-app/blob/main/app/routes/__init__.py"
click node_auth_routes "https://github.com/swappy514/flask-todo-app/blob/main/app/routes/auth.py"
click node_task_routes "https://github.com/swappy514/flask-todo-app/blob/main/app/routes/tasks.py"
click node_profile_routes "https://github.com/swappy514/flask-todo-app/blob/main/app/routes/profile.py"
click node_models "https://github.com/swappy514/flask-todo-app/blob/main/app/models.py"
click node_sqlite "https://github.com/swappy514/flask-todo-app/blob/main/instance/todo.db"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_base_template,node_login_templates,node_tasks_template,node_profile_template,node_static_assets toneBlue
class node_startup,node_app_factory,node_route_package,node_auth_routes,node_task_routes,node_profile_routes toneAmber
class node_models,node_sqlite toneMint
```

## Components

### Browser Presentation

- **Browser**: client · Uses server-rendered pages and form requests.
- [Shared layout](https://github.com/swappy514/flask-todo-app/blob/main/app/templates/base.html): Jinja template · `app/templates/base.html`
- [Login and registration](https://github.com/swappy514/flask-todo-app/blob/main/app/templates/login.html): Jinja templates · `app/templates/login.html`
- [Task workspace](https://github.com/swappy514/flask-todo-app/blob/main/app/templates/tasks.html): Jinja template · `app/templates/tasks.html`
- [Profile page](https://github.com/swappy514/flask-todo-app/blob/main/app/templates/profile.html): Jinja template · `app/templates/profile.html`
- [Styles and client script](https://github.com/swappy514/flask-todo-app/blob/main/app/static/CSS/style.css): static assets · `app/static/CSS/style.css`

### Flask Application

- [Process startup](https://github.com/swappy514/flask-todo-app/blob/main/run.py): Python entry point · `run.py`
- [App factory and setup](https://github.com/swappy514/flask-todo-app/blob/main/app/__init__.py): Flask configuration · Initializes Flask, database integration, and route registration. · `app/__init__.py`
- [Route registration](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/__init__.py): Blueprint package · `app/routes/__init__.py`
- [Authentication](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/auth.py): Auth Blueprint · Registers users, logs in, and establishes session identity. · `app/routes/auth.py`
- [Task CRUD](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/tasks.py): Tasks Blueprint · Authenticated per-user task operations. · `app/routes/tasks.py`
- [Profile management](https://github.com/swappy514/flask-todo-app/blob/main/app/routes/profile.py): Profile Blueprint · Authenticated account detail and update flow. · `app/routes/profile.py`

### Persistence

- [Users and tasks](https://github.com/swappy514/flask-todo-app/blob/main/app/models.py): SQLAlchemy ORM models · Defines user ownership of task records. · `app/models.py`
- [Local task database](https://github.com/swappy514/flask-todo-app/blob/main/instance/todo.db): SQLite database · `instance/todo.db`

## Connections

- 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
