# tahsin2155/zipline architecture

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

- Interactive diagram: https://gitdiagram.com/tahsin2155/zipline
- Repository: https://github.com/tahsin2155/zipline

## Overview

Zipline is a self-hosted Flask mini-drive and scratchpad. The main workflow is login, then browse/search nested folders, upload or manage files, and preview or download them; users can also create and autosave independent notes. Per-user SQLite databases and upload directories isolate persistent data. The README documents retention cleanup and account administration as separate operational capabilities. Some file-route implementation is excerpted, so links for its documented features are limited to the route and helper modules rather than inferred internal call chains.

Main entry points: [`app/blueprints/files/routes.py`](https://github.com/tahsin2155/zipline/blob/main/app/blueprints/files/routes.py) (Drive routes), [`app/__init__.py`](https://github.com/tahsin2155/zipline/blob/main/app/__init__.py) (Flask app), [`app/blueprints/notes/routes.py`](https://github.com/tahsin2155/zipline/blob/main/app/blueprints/notes/routes.py) (Notes routes), [`app/blueprints/auth/routes.py`](https://github.com/tahsin2155/zipline/blob/main/app/blueprints/auth/routes.py) (Login routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Flask app<br/>[__init__.py]"]
  node_notes_routes["Notes routes<br/>[routes.py]"]
  node_notes_ui["Notes interface<br/>[notes.html]"]
  node_editor_ui["Note editor<br/>[note_editor.html]"]
end

subgraph group_files["File drive"]
  node_file_routes["Drive routes<br/>[routes.py]"]
  node_file_helpers["File helpers<br/>[helpers.py]"]
  node_dashboard_ui["Drive interface<br/>[dashboard.html]"]
end

subgraph group_identity["Identity and security"]
  node_auth["Login routes<br/>[routes.py]"]
  node_users["User records<br/>[users.py]"]
  node_csrf["CSRF protection<br/>[csrf.py]"]
  node_user_store[("Account store")]
end

subgraph group_data["Per-user data"]
  node_db_helpers["Database access<br/>[db.py]"]
  node_sqlite[("User databases")]
  node_uploads[("Upload storage")]
end

subgraph group_ops["Administration"]
  node_user_admin["Account manager<br/>[manage_users.py]"]
  node_cleanup["Retention cleanup<br/>[cleanup_task.py]"]
end

node_visitor(("User"))
node_scheduler(("Scheduler"))

node_visitor -->|"sends requests"| node_flask
node_flask -->|"dispatches"| node_auth
node_flask -->|"dispatches"| node_file_routes
node_flask -->|"dispatches"| node_notes_routes
node_flask -->|"enforces"| node_csrf
node_auth -->|"checks credentials"| node_users
node_users -->|"reads/writes"| node_user_store
node_user_admin -->|"manages accounts"| node_user_store
node_auth -->|"redirects after login"| node_file_routes
node_file_routes -->|"queries and updates"| node_db_helpers
node_notes_routes -->|"queries and updates"| node_db_helpers
node_db_helpers -->|"reads/writes"| node_sqlite
node_file_routes -->|"uses utilities"| node_file_helpers
node_file_routes -->|"stores and serves files"| node_uploads
node_file_routes -->|"renders"| node_dashboard_ui
node_notes_routes -->|"renders list"| node_notes_ui
node_notes_routes -->|"renders editor"| node_editor_ui
node_scheduler -.->|"runs periodically"| node_cleanup
node_cleanup -->|"finds expired records"| node_sqlite
node_cleanup -->|"removes expired files"| node_uploads

click node_flask "https://github.com/tahsin2155/zipline/blob/main/app/__init__.py"
click node_auth "https://github.com/tahsin2155/zipline/blob/main/app/blueprints/auth/routes.py"
click node_users "https://github.com/tahsin2155/zipline/blob/main/app/users.py"
click node_csrf "https://github.com/tahsin2155/zipline/blob/main/app/csrf.py"
click node_file_routes "https://github.com/tahsin2155/zipline/blob/main/app/blueprints/files/routes.py"
click node_file_helpers "https://github.com/tahsin2155/zipline/blob/main/app/blueprints/files/helpers.py"
click node_dashboard_ui "https://github.com/tahsin2155/zipline/blob/main/app/templates/files/dashboard.html"
click node_notes_routes "https://github.com/tahsin2155/zipline/blob/main/app/blueprints/notes/routes.py"
click node_notes_ui "https://github.com/tahsin2155/zipline/blob/main/app/templates/notes/notes.html"
click node_editor_ui "https://github.com/tahsin2155/zipline/blob/main/app/templates/notes/note_editor.html"
click node_db_helpers "https://github.com/tahsin2155/zipline/blob/main/app/db.py"
click node_user_admin "https://github.com/tahsin2155/zipline/blob/main/manage_users.py"
click node_cleanup "https://github.com/tahsin2155/zipline/blob/main/cleanup_task.py"

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_flask,node_notes_routes,node_notes_ui,node_editor_ui,node_visitor toneBlue
class node_file_routes,node_file_helpers,node_dashboard_ui toneAmber
class node_auth,node_users,node_csrf,node_user_store toneMint
class node_db_helpers,node_sqlite,node_uploads,node_scheduler toneRose
class node_user_admin,node_cleanup toneIndigo
```

## Components

### Web application

- [Flask app](https://github.com/tahsin2155/zipline/blob/main/app/__init__.py): `app/__init__.py`
- [Notes routes](https://github.com/tahsin2155/zipline/blob/main/app/blueprints/notes/routes.py): `app/blueprints/notes/routes.py`
- [Notes interface](https://github.com/tahsin2155/zipline/blob/main/app/templates/notes/notes.html): `app/templates/notes/notes.html`
- [Note editor](https://github.com/tahsin2155/zipline/blob/main/app/templates/notes/note_editor.html): `app/templates/notes/note_editor.html`

### File drive

- [Drive routes](https://github.com/tahsin2155/zipline/blob/main/app/blueprints/files/routes.py): `app/blueprints/files/routes.py`
- [File helpers](https://github.com/tahsin2155/zipline/blob/main/app/blueprints/files/helpers.py): `app/blueprints/files/helpers.py`
- [Drive interface](https://github.com/tahsin2155/zipline/blob/main/app/templates/files/dashboard.html): `app/templates/files/dashboard.html`

### Identity and security

- [Login routes](https://github.com/tahsin2155/zipline/blob/main/app/blueprints/auth/routes.py): `app/blueprints/auth/routes.py`
- [User records](https://github.com/tahsin2155/zipline/blob/main/app/users.py): `app/users.py`
- [CSRF protection](https://github.com/tahsin2155/zipline/blob/main/app/csrf.py): `app/csrf.py`
- **Account store**

### Per-user data

- [Database access](https://github.com/tahsin2155/zipline/blob/main/app/db.py): `app/db.py`
- **User databases**
- **Upload storage**

### Administration

- [Account manager](https://github.com/tahsin2155/zipline/blob/main/manage_users.py): `manage_users.py`
- [Retention cleanup](https://github.com/tahsin2155/zipline/blob/main/cleanup_task.py): `cleanup_task.py`

### Other components

- **User**
- **Scheduler**

## Connections

- User → Flask app: sends requests
- Flask app → Login routes: dispatches
- Flask app → Drive routes: dispatches
- Flask app → Notes routes: dispatches
- Flask app → CSRF protection: enforces
- Login routes → User records: checks credentials
- User records → Account store: reads/writes
- Account manager → Account store: manages accounts
- Login routes → Drive routes: redirects after login
- Drive routes → Database access: queries and updates
- Notes routes → Database access: queries and updates
- Database access → User databases: reads/writes
- Drive routes → File helpers: uses utilities
- Drive routes → Upload storage: stores and serves files
- Drive routes → Drive interface: renders
- Notes routes → Notes interface: renders list
- Notes routes → Note editor: renders editor
- Scheduler → Retention cleanup: runs periodically
- Retention cleanup → User databases: finds expired records
- Retention cleanup → Upload storage: removes expired files
