# maxkunev/dailydo architecture

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

- Interactive diagram: https://gitdiagram.com/maxkunev/dailydo
- Repository: https://github.com/maxkunev/dailydo

## Overview

#### Purpose and system shape
DailyDO is a Telegram-native personal task manager. It combines a Telegram bot, a Telegram Mini App UI, a Django REST backend, and an independent reminder scheduler. Docker Compose runs these as separate processes with PostgreSQL.

Core deployment definitions: `docker-compose.yaml`, `Dockerfile`, `frontend/Dockerfile`, `docker/backend/entrypoint.sh`.

#### Backend API and application boundary
Django is the authoritative application backend and exposes routing through `dailydo/urls.py`. It hosts two domain apps: user/authentication management and user-owned task CRUD. Django/DRF settings and ASGI/WSGI process entry points reside in `dailydo/settings.py`, `dailydo/asgi.py`, and `dailydo/wsgi.py`.

The API is the integration boundary for the Mini App and likely any bot-driven task operations; persistence remains behind Django models and authenticated query scoping.

#### Identity and authorization
The `users` app owns account representation, serialization, authentication, and endpoint routing: `users/models.py`, `users/authentication.py`, `users/views.py`, `users/urls.py`.

Telegram Mini App authentication establishes backend identity. Downstream task access must be tied to the authenticated user, enforcing isolation so a caller cannot read or mutate another user’s tasks.

#### Task domain and REST operations
The `tasks` app owns task persistence and API behavior: `tasks/models.py`, `tasks/serialaziers.py`, `tasks/views.py`, `tasks/urls.py`.

Primary request flow is: Mini App authenticates → client calls authenticated task endpoints → DRF validates task data and applies user-scoped CRUD → PostgreSQL stores task state. Task completion and task date/status data also feed the scheduler’s unfinished-task selection.

#### Telegram bot interaction layer
The aiogram bot is a separate long-running Telegram update consumer, entered through `bot/main.py`. Message/control handling is concentrated in `bot/handlers/handlers.py`; Telegram/Gemini-facing service behavior is split across `bot/services.py` and `bot/gemini.py`.

The bot supplies conversational interaction and reminder delivery context. It uses keyboards, FSM states, and locale middleware as supporting interaction layers: `bot/keyboards.py`, `bot/states.py`, `bot/middlewares/i18n.py`.

#### Mini App frontend
The React/Vite client is the primary task-management interface launched inside Telegram. Its runtime entry and root application are `frontend/src/main.jsx` and `frontend/src/App.jsx`; Telegram/client localization setup is in `frontend/src/i18n.js`.

Its control flow is browser/Telegram WebView → Mini App auth context → Django API → task rendering and mutations. The frontend is independently containerized and communicates with the backend through configured API URLs.

#### Reminder scheduler and delivery
The scheduler is an independent async service with its process entry at `scheduler/main.py`. Cron-style morning/evening orchestration is defined in `scheduler/jobs.py`, while Telegram message dispatch is isolated in `scheduler/sender.py`.

It queries persisted tasks, selects unfinished tasks for the current date, groups them by Telegram chat, localizes reminder content, and sends messages through Telegram. Timezone behavior is configured externally and applied by the scheduler runtime.

#### Infrastructure and external dependencies
Material runtimes are Python/Django/DRF, aiogram, APScheduler, React/Vite, PostgreSQL, and Docker Compose. Telegram is both the user platform and outbound notification service; Gemini integration is represented by `bot/gemini.py`. Environment-provided bot tokens, database settings, API URL, and scheduler timezone form key operational boundaries (`.env.example`, `dailydo/settings.py`, `docker-compose.yaml`).

Main entry points: [`docker-compose.yaml`](https://github.com/maxkunev/dailydo/blob/develop/docker-compose.yaml) (Docker Compose), [`dailydo/urls.py`](https://github.com/maxkunev/dailydo/blob/develop/dailydo/urls.py) (Django REST API), [`frontend/src/App.jsx`](https://github.com/maxkunev/dailydo/blob/develop/frontend/src/App.jsx) (React Mini App), [`scheduler/jobs.py`](https://github.com/maxkunev/dailydo/blob/develop/scheduler/jobs.py) (Reminder Jobs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_telegram["Telegram Surface"]
  node_telegram{{"Telegram Platform<br/>external platform"}}
  node_mini_app["React Mini App<br/>React/Vite client<br/>[App.jsx]"]
  node_mini_entry["Client Bootstrap &amp; i18n<br/>frontend entry<br/>[main.jsx]"]
end

subgraph group_application["Application Services"]
  node_bot["Telegram Bot<br/>aiogram service<br/>[main.py]"]
  node_bot_handlers["Bot Handlers<br/>interaction layer<br/>[handlers.py]"]
  node_gemini["Gemini Integration<br/>AI service adapter<br/>[gemini.py]"]
  node_scheduler["Reminder Scheduler<br/>async service<br/>[main.py]"]
  node_scheduler_jobs["Reminder Jobs<br/>APScheduler orchestration<br/>[jobs.py]"]
  node_scheduler_sender["Telegram Sender<br/>notification adapter<br/>[sender.py]"]
end

subgraph group_backend["Django Backend"]
  node_api["Django REST API<br/>Django/DRF boundary<br/>[urls.py]"]
  node_identity["Identity &amp; Authentication<br/>users domain<br/>[authentication.py]"]
  node_users["User Accounts<br/>Django models &amp; endpoints<br/>[models.py]"]
  node_tasks["Task CRUD<br/>tasks domain<br/>[views.py]"]
  node_task_models["Task Models<br/>Django persistence model<br/>[models.py]"]
end

subgraph group_data["Data &amp; External Services"]
  node_postgres[("PostgreSQL<br/>database")]
  node_gemini_api{{"Gemini<br/>external AI API"}}
  node_compose["Docker Compose<br/>deployment orchestration"]
end

node_telegram -->|"launches"| node_mini_app
node_mini_entry -->|"mounts"| node_mini_app
node_mini_app -->|"authenticated task API calls"| node_api
node_telegram -->|"delivers updates"| node_bot
node_bot -->|"routes updates"| node_bot_handlers
node_bot_handlers -->|"uses AI behavior"| node_gemini
node_gemini -->|"AI requests"| node_gemini_api
node_api -->|"authenticates requests"| node_identity
node_identity -->|"resolves account"| node_users
node_api -->|"routes task endpoints"| node_tasks
node_tasks -->|"CRUD and owner scoping"| node_task_models
node_users -->|"persists accounts"| node_postgres
node_task_models -->|"persists tasks"| node_postgres
node_scheduler -->|"runs cron jobs"| node_scheduler_jobs
node_scheduler_jobs -->|"queries unfinished tasks"| node_postgres
node_scheduler_jobs -->|"builds reminder deliveries"| node_scheduler_sender
node_scheduler_sender -->|"sends localized reminders"| node_telegram
node_compose -.->|"runs"| node_api
node_compose -.->|"runs"| node_mini_app
node_compose -.->|"runs"| node_bot
node_compose -.->|"runs"| node_scheduler
node_compose -.->|"runs"| node_postgres

click node_mini_app "https://github.com/maxkunev/dailydo/blob/develop/frontend/src/App.jsx"
click node_mini_entry "https://github.com/maxkunev/dailydo/blob/develop/frontend/src/main.jsx"
click node_bot "https://github.com/maxkunev/dailydo/blob/develop/bot/main.py"
click node_bot_handlers "https://github.com/maxkunev/dailydo/blob/develop/bot/handlers/handlers.py"
click node_gemini "https://github.com/maxkunev/dailydo/blob/develop/bot/gemini.py"
click node_scheduler "https://github.com/maxkunev/dailydo/blob/develop/scheduler/main.py"
click node_scheduler_jobs "https://github.com/maxkunev/dailydo/blob/develop/scheduler/jobs.py"
click node_scheduler_sender "https://github.com/maxkunev/dailydo/blob/develop/scheduler/sender.py"
click node_api "https://github.com/maxkunev/dailydo/blob/develop/dailydo/urls.py"
click node_identity "https://github.com/maxkunev/dailydo/blob/develop/users/authentication.py"
click node_users "https://github.com/maxkunev/dailydo/blob/develop/users/models.py"
click node_tasks "https://github.com/maxkunev/dailydo/blob/develop/tasks/views.py"
click node_task_models "https://github.com/maxkunev/dailydo/blob/develop/tasks/models.py"
click node_compose "https://github.com/maxkunev/dailydo/blob/develop/docker-compose.yaml"

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_telegram,node_mini_app,node_mini_entry toneBlue
class node_bot,node_bot_handlers,node_gemini,node_scheduler,node_scheduler_jobs,node_scheduler_sender toneAmber
class node_api,node_identity,node_users,node_tasks,node_task_models toneMint
class node_postgres,node_gemini_api,node_compose toneRose
```

## Components

### Telegram Surface

- **Telegram Platform**: external platform · Hosts the bot and Mini App WebView.
- [React Mini App](https://github.com/maxkunev/dailydo/blob/develop/frontend/src/App.jsx): React/Vite client · Primary task-management interface inside Telegram. · `frontend/src/App.jsx`
- [Client Bootstrap & i18n](https://github.com/maxkunev/dailydo/blob/develop/frontend/src/main.jsx): frontend entry · `frontend/src/main.jsx`

### Application Services

- [Telegram Bot](https://github.com/maxkunev/dailydo/blob/develop/bot/main.py): aiogram service · Long-running Telegram update consumer. · `bot/main.py`
- [Bot Handlers](https://github.com/maxkunev/dailydo/blob/develop/bot/handlers/handlers.py): interaction layer · Processes messages and controls conversational flow. · `bot/handlers/handlers.py`
- [Gemini Integration](https://github.com/maxkunev/dailydo/blob/develop/bot/gemini.py): AI service adapter · `bot/gemini.py`
- [Reminder Scheduler](https://github.com/maxkunev/dailydo/blob/develop/scheduler/main.py): async service · Runs scheduled unfinished-task reminder workflows. · `scheduler/main.py`
- [Reminder Jobs](https://github.com/maxkunev/dailydo/blob/develop/scheduler/jobs.py): APScheduler orchestration · Selects current-date unfinished tasks and groups them by chat. · `scheduler/jobs.py`
- [Telegram Sender](https://github.com/maxkunev/dailydo/blob/develop/scheduler/sender.py): notification adapter · `scheduler/sender.py`

### Django Backend

- [Django REST API](https://github.com/maxkunev/dailydo/blob/develop/dailydo/urls.py): Django/DRF boundary · Authoritative authenticated application API. · `dailydo/urls.py`
- [Identity & Authentication](https://github.com/maxkunev/dailydo/blob/develop/users/authentication.py): users domain · Establishes Telegram Mini App identity and account access. · `users/authentication.py`
- [User Accounts](https://github.com/maxkunev/dailydo/blob/develop/users/models.py): Django models & endpoints · `users/models.py`
- [Task CRUD](https://github.com/maxkunev/dailydo/blob/develop/tasks/views.py): tasks domain · Validates and applies user-scoped task operations. · `tasks/views.py`
- [Task Models](https://github.com/maxkunev/dailydo/blob/develop/tasks/models.py): Django persistence model · Stores task date, status, completion, and ownership. · `tasks/models.py`

### Data & External Services

- **PostgreSQL**: database · Persistent authoritative task and account state.
- **Gemini**: external AI API
- [Docker Compose](https://github.com/maxkunev/dailydo/blob/develop/docker-compose.yaml): deployment orchestration · Runs backend, frontend, bot, scheduler, and PostgreSQL as separate processes. · `docker-compose.yaml`

## Connections

- Telegram Platform → React Mini App: launches
- Client Bootstrap & i18n → React Mini App: mounts
- React Mini App → Django REST API: authenticated task API calls
- Telegram Platform → Telegram Bot: delivers updates
- Telegram Bot → Bot Handlers: routes updates
- Bot Handlers → Gemini Integration: uses AI behavior
- Gemini Integration → Gemini: AI requests
- Django REST API → Identity & Authentication: authenticates requests
- Identity & Authentication → User Accounts: resolves account
- Django REST API → Task CRUD: routes task endpoints
- Task CRUD → Task Models: CRUD and owner scoping
- User Accounts → PostgreSQL: persists accounts
- Task Models → PostgreSQL: persists tasks
- Reminder Scheduler → Reminder Jobs: runs cron jobs
- Reminder Jobs → PostgreSQL: queries unfinished tasks
- Reminder Jobs → Telegram Sender: builds reminder deliveries
- Telegram Sender → Telegram Platform: sends localized reminders
- Docker Compose → Django REST API: runs
- Docker Compose → React Mini App: runs
- Docker Compose → Telegram Bot: runs
- Docker Compose → Reminder Scheduler: runs
- Docker Compose → PostgreSQL: runs
