# bohdan778/taskflow architecture

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

- Interactive diagram: https://gitdiagram.com/bohdan778/taskflow
- Repository: https://github.com/bohdan778/taskflow

## Overview

TaskFlow is a FastAPI backend for account access, task tracking, habit logging, scheduling, and a combined statistics overview. The main flow is a client request routed through the application to a domain router, which authenticates where required, uses request schemas and SQLAlchemy models, and accesses persisted data through the async session. Habit and overview statistics also use shared streak calculations. The README is empty; the graph follows the sampled source and SOURCE INDEX, so it does not infer additional product capabilities or integrations.

Main entry points: [`app/routers/stats.py`](https://github.com/bohdan778/taskflow/blob/main/app/routers/stats.py) (Stats routes), [`app/security.py`](https://github.com/bohdan778/taskflow/blob/main/app/security.py) (Token security), [`app/database.py`](https://github.com/bohdan778/taskflow/blob/main/app/database.py) (Async sessions), [`app/main.py`](https://github.com/bohdan778/taskflow/blob/main/app/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_application["FastAPI app<br/>[main.py]"]
end

subgraph group_identity["Identity"]
  node_auth["Account routes<br/>[auth.py]"]
  node_security["Token security<br/>[security.py]"]
end

subgraph group_domains["User features"]
  node_tasks["Task routes<br/>[tasks.py]"]
  node_habits["Habit routes<br/>[habits.py]"]
  node_schedule["Schedule routes<br/>[schedule.py]"]
  node_overview["Stats routes<br/>[stats.py]"]
end

subgraph group_data["Persistence"]
  node_database["Async sessions<br/>[database.py]"]
  node_user_model["User model<br/>[user.py]"]
  node_task_model["Task model<br/>[task.py]"]
  node_habit_model["Habit models<br/>[habit.py]"]
  node_schedule_model["Schedule model<br/>[schedule.py]"]
end

subgraph group_contracts["Schemas and metrics"]
  node_user_schema["User schemas<br/>[user.py]"]
  node_task_schema["Task schemas<br/>[task.py]"]
  node_habit_schema["Habit schemas<br/>[habit.py]"]
  node_schedule_schema["Schedule schemas<br/>[schedule.py]"]
  node_stats_schema["Stats schema<br/>[stats.py]"]
  node_streaks["Streak calculation<br/>[habit_stats.py]"]
end

node_client(("API client"))
node_sql_store[("SQL database")]

node_client -->|"sends requests"| node_application
node_application -->|"registers router"| node_auth
node_application -->|"registers router"| node_habits
node_application -->|"registers router"| node_tasks
node_application -->|"registers router"| node_schedule
node_application -->|"registers router"| node_overview
node_auth -->|"uses session"| node_database
node_auth -->|"queries and stores"| node_user_model
node_auth -->|"validates and returns"| node_user_schema
node_auth -->|"creates token"| node_security
node_security -->|"gets session"| node_database
node_security -->|"loads user"| node_user_model
node_tasks -->|"uses session"| node_database
node_tasks -->|"queries and mutates"| node_task_model
node_tasks -->|"validates and returns"| node_task_schema
node_tasks -->|"requires user"| node_security
node_habits -->|"uses session"| node_database
node_habits -->|"queries and mutates"| node_habit_model
node_habits -->|"validates and returns"| node_habit_schema
node_habits -->|"requires user"| node_security
node_habits -->|"calculates streaks"| node_streaks
node_schedule -->|"uses session"| node_database
node_schedule -->|"queries and mutates"| node_schedule_model
node_schedule -->|"validates and returns"| node_schedule_schema
node_schedule -->|"requires user"| node_security
node_overview -->|"uses session"| node_database
node_overview -->|"aggregates tasks"| node_task_model
node_overview -->|"reads habits and logs"| node_habit_model
node_overview -->|"counts upcoming events"| node_schedule_model
node_overview -->|"returns overview"| node_stats_schema
node_overview -->|"requires user"| node_security
node_overview -->|"calculates streaks"| node_streaks
node_database -->|"connects via URL"| node_sql_store

click node_application "https://github.com/bohdan778/taskflow/blob/main/app/main.py"
click node_auth "https://github.com/bohdan778/taskflow/blob/main/app/routers/auth.py"
click node_security "https://github.com/bohdan778/taskflow/blob/main/app/security.py"
click node_tasks "https://github.com/bohdan778/taskflow/blob/main/app/routers/tasks.py"
click node_habits "https://github.com/bohdan778/taskflow/blob/main/app/routers/habits.py"
click node_schedule "https://github.com/bohdan778/taskflow/blob/main/app/routers/schedule.py"
click node_overview "https://github.com/bohdan778/taskflow/blob/main/app/routers/stats.py"
click node_database "https://github.com/bohdan778/taskflow/blob/main/app/database.py"
click node_user_model "https://github.com/bohdan778/taskflow/blob/main/app/models/user.py"
click node_task_model "https://github.com/bohdan778/taskflow/blob/main/app/models/task.py"
click node_habit_model "https://github.com/bohdan778/taskflow/blob/main/app/models/habit.py"
click node_schedule_model "https://github.com/bohdan778/taskflow/blob/main/app/models/schedule.py"
click node_user_schema "https://github.com/bohdan778/taskflow/blob/main/app/schemas/user.py"
click node_task_schema "https://github.com/bohdan778/taskflow/blob/main/app/schemas/task.py"
click node_habit_schema "https://github.com/bohdan778/taskflow/blob/main/app/schemas/habit.py"
click node_schedule_schema "https://github.com/bohdan778/taskflow/blob/main/app/schemas/schedule.py"
click node_stats_schema "https://github.com/bohdan778/taskflow/blob/main/app/schemas/stats.py"
click node_streaks "https://github.com/bohdan778/taskflow/blob/main/app/services/habit_stats.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_application,node_client toneBlue
class node_auth,node_security,node_sql_store toneAmber
class node_tasks,node_habits,node_schedule,node_overview toneMint
class node_database,node_user_model,node_task_model,node_habit_model,node_schedule_model toneRose
class node_user_schema,node_task_schema,node_habit_schema,node_schedule_schema,node_stats_schema,node_streaks toneIndigo
```

## Components

### API entry

- [FastAPI app](https://github.com/bohdan778/taskflow/blob/main/app/main.py): `app/main.py`

### Identity

- [Account routes](https://github.com/bohdan778/taskflow/blob/main/app/routers/auth.py): `app/routers/auth.py`
- [Token security](https://github.com/bohdan778/taskflow/blob/main/app/security.py): `app/security.py`

### User features

- [Task routes](https://github.com/bohdan778/taskflow/blob/main/app/routers/tasks.py): `app/routers/tasks.py`
- [Habit routes](https://github.com/bohdan778/taskflow/blob/main/app/routers/habits.py): `app/routers/habits.py`
- [Schedule routes](https://github.com/bohdan778/taskflow/blob/main/app/routers/schedule.py): `app/routers/schedule.py`
- [Stats routes](https://github.com/bohdan778/taskflow/blob/main/app/routers/stats.py): `app/routers/stats.py`

### Persistence

- [Async sessions](https://github.com/bohdan778/taskflow/blob/main/app/database.py): `app/database.py`
- [User model](https://github.com/bohdan778/taskflow/blob/main/app/models/user.py): `app/models/user.py`
- [Task model](https://github.com/bohdan778/taskflow/blob/main/app/models/task.py): `app/models/task.py`
- [Habit models](https://github.com/bohdan778/taskflow/blob/main/app/models/habit.py): `app/models/habit.py`
- [Schedule model](https://github.com/bohdan778/taskflow/blob/main/app/models/schedule.py): `app/models/schedule.py`

### Schemas and metrics

- [User schemas](https://github.com/bohdan778/taskflow/blob/main/app/schemas/user.py): `app/schemas/user.py`
- [Task schemas](https://github.com/bohdan778/taskflow/blob/main/app/schemas/task.py): `app/schemas/task.py`
- [Habit schemas](https://github.com/bohdan778/taskflow/blob/main/app/schemas/habit.py): `app/schemas/habit.py`
- [Schedule schemas](https://github.com/bohdan778/taskflow/blob/main/app/schemas/schedule.py): `app/schemas/schedule.py`
- [Stats schema](https://github.com/bohdan778/taskflow/blob/main/app/schemas/stats.py): `app/schemas/stats.py`
- [Streak calculation](https://github.com/bohdan778/taskflow/blob/main/app/services/habit_stats.py): `app/services/habit_stats.py`

### Other components

- **API client**
- **SQL database**

## Connections

- API client → FastAPI app: sends requests (evidence: `app/main.py`)
- FastAPI app → Account routes: registers router (evidence: `app/main.py`)
- FastAPI app → Habit routes: registers router (evidence: `app/main.py`)
- FastAPI app → Task routes: registers router (evidence: `app/main.py`)
- FastAPI app → Schedule routes: registers router (evidence: `app/main.py`)
- FastAPI app → Stats routes: registers router (evidence: `app/main.py`)
- Account routes → Async sessions: uses session (evidence: `app/routers/auth.py`)
- Account routes → User model: queries and stores (evidence: `app/routers/auth.py`)
- Account routes → User schemas: validates and returns (evidence: `app/routers/auth.py`)
- Account routes → Token security: creates token (evidence: `app/routers/auth.py`)
- Token security → Async sessions: gets session (evidence: `app/security.py`)
- Token security → User model: loads user (evidence: `app/security.py`)
- Task routes → Async sessions: uses session (evidence: `app/routers/tasks.py`)
- Task routes → Task model: queries and mutates (evidence: `app/routers/tasks.py`)
- Task routes → Task schemas: validates and returns (evidence: `app/routers/tasks.py`)
- Task routes → Token security: requires user (evidence: `app/routers/tasks.py`)
- Habit routes → Async sessions: uses session (evidence: `app/routers/habits.py`)
- Habit routes → Habit models: queries and mutates (evidence: `app/routers/habits.py`)
- Habit routes → Habit schemas: validates and returns (evidence: `app/routers/habits.py`)
- Habit routes → Token security: requires user (evidence: `app/routers/habits.py`)
- Habit routes → Streak calculation: calculates streaks (evidence: `app/routers/habits.py`)
- Schedule routes → Async sessions: uses session (evidence: `app/routers/schedule.py`)
- Schedule routes → Schedule model: queries and mutates (evidence: `app/routers/schedule.py`)
- Schedule routes → Schedule schemas: validates and returns (evidence: `app/routers/schedule.py`)
- Schedule routes → Token security: requires user (evidence: `app/routers/schedule.py`)
- Stats routes → Async sessions: uses session (evidence: `app/routers/stats.py`)
- Stats routes → Task model: aggregates tasks (evidence: `app/routers/stats.py`)
- Stats routes → Habit models: reads habits and logs (evidence: `app/routers/stats.py`)
- Stats routes → Schedule model: counts upcoming events (evidence: `app/routers/stats.py`)
- Stats routes → Stats schema: returns overview (evidence: `app/routers/stats.py`)
- Stats routes → Token security: requires user (evidence: `app/routers/stats.py`)
- Stats routes → Streak calculation: calculates streaks (evidence: `app/routers/stats.py`)
- Async sessions → SQL database: connects via URL (evidence: `app/database.py`)
