An AI-powered adaptive task planning system that breaks tasks into microtasks, distributes them across your calendar, and replans automatically when life gets in the way.
DueIt uses three Gemma 4 models with intentional role separation, Notion integration for workspace generation, and TinyFish for web resource scraping and Excalidraw workflow diagrams.
.
├─ due_it/ # Flutter frontend
│ ├─ lib/
│ │ ├─ models/ # Task, AiSchedule, DueTask data models
│ │ ├─ providers/ # State management (Provider)
│ │ ├─ screens/ # Home, Calendar, Dashboard, Tasks, Auth, Settings, Profile
│ │ ├─ services/ # API calls, Firestore, Notion
│ │ ├─ theme/ # Colors, spacing, typography
│ │ └─ widgets/ # Reusable UI components
│ ├─ test/ # Unit tests
│ └─ pubspec.yaml
├─ due_it_backend/ # FastAPI backend
│ ├─ main.py # API gateway, planning logic, scheduling algorithms
│ ├─ notion/ # Notion integration package
│ │ ├─ __init__.py
│ │ ├─ pages.py # Page creation and launchpad generation
│ │ ├─ databases.py # Progress tracker database schemas
│ │ ├─ formatting.py # Rich text block formatting
│ │ ├─ oauth.py # OAuth flow handling
│ │ └─ sync.py # Task status syncing
│ ├─ tinyfish_service.py # Web scraping and Excalidraw automation
│ ├─ requirements.txt
│ ├─ Dockerfile
│ └─ cloudbuild.yaml
└─ README.md
- User signs in with Firebase Auth.
- User creates a task with title, category, deadline, and description.
- Frontend calls
/plan-taskon the backend. - Gemma 4 31B Dense estimates duration, generates a day-wise schedule with phases and microtasks, and calculates pressure/risk metrics.
- Backend validates the AI response and stores the plan in Firestore.
- If Notion is connected, backend syncs the task and generates a launchpad workspace page.
- TinyFish scrapes curated web resources and generates an Excalidraw workflow diagram.
- Frontend reflects all updates from Firestore in real time.
- When the user misses a day, the adaptive replanning engine redistributes remaining tasks across remaining days.
graph TB
subgraph "Gemma 4 Model Split"
A["Gemma 4 31B Dense<br/>Deep Reasoning"] -->|"Task planning"| D["/plan-task"]
A -->|"Notion doc generation"| E["/generate-doc"]
B["Gemma 4 2B<br/>Fast Operations"] -->|"Morning replan"| F["Schedule adjustment"]
C["Gemma 4 26B MoE<br/>Multi-domain Synthesis"] -->|"Excalidraw diagrams"| G["/create-excalidraw-workflow"]
C -->|"Daily briefing"| H["Meter calculations"]
end
| Model | Role | Why this model |
|---|---|---|
| Gemma 4 31B Dense | Task planning, Notion docs | Deep reasoning for structured JSON output, time estimation, schedule generation |
| Gemma 4 2B | Morning replan, quick adjustments | Speed — under 2 seconds for daily schedule tweaks |
| Gemma 4 26B MoE | Excalidraw diagrams, briefings, meters | Multi-domain synthesis across study/work/personal categories |
graph TD
subgraph "Client"
FL["Flutter App<br/>Provider State Management"]
end
subgraph "Auth"
FA["Firebase Auth<br/>Email/Password"]
end
subgraph "API Gateway"
API["FastAPI<br/>Cloud Run"]
end
subgraph "AI Layer"
G31["Gemma 4 31B Dense"]
G2["Gemma 4 2B"]
G26["Gemma 4 26B MoE"]
end
subgraph "Integrations"
NT["Notion API<br/>Workspace Generation"]
TF["TinyFish API<br/>Web Scraping + Excalidraw"]
end
subgraph "Data"
FS["Cloud Firestore<br/>Tasks, Users, Schedules"]
end
FL -->|"HTTPS + Bearer Token"| API
FL -->|"Auth"| FA
API -->|"Planning"| G31
API -->|"Replan"| G2
API -->|"Diagrams"| G26
API -->|"Sync"| NT
API -->|"Scrape"| TF
API -->|"Read/Write"| FS
FL -->|"Real-time Sync"| FS
sequenceDiagram
participant U as User
participant FL as Flutter App
participant API as FastAPI
participant G31 as Gemma 31B
participant G26 as Gemma 26B MoE
participant FS as Firestore
participant NT as Notion
participant TF as TinyFish
U->>FL: Create task
FL->>API: POST /plan-task
API->>G31: Generate plan (phases, microtasks, estimates)
G31-->>API: Structured JSON plan
API->>API: Validate AI response
API->>FS: Store plan
FS-->>FL: Real-time update
par Notion Sync
API->>NT: Create launchpad page
API->>NT: Create progress tracker DB
and Resource Scraping
API->>TF: Scrape web resources
TF-->>API: Curated links
API->>NT: Update resources section
and Workflow Generation
API->>G26: Generate Mermaid flowchart
G26-->>API: Mermaid code
API->>TF: Create Excalidraw diagram
TF-->>API: Collaboration URL
API->>NT: Update workflow section
end
Note over FL: Next morning
U->>FL: Open app
FL->>API: Check completions
API->>API: Redistribute missed tasks
API->>FS: Update schedule
FS-->>FL: Updated calendar
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check |
| POST | /plan-task?taskId=... |
AI planning + Firestore update + optional Notion sync |
| POST | /generate-doc |
Create Notion launchpad with TinyFish enrichment |
| POST | /scrape-resources |
TinyFish resource scraping |
| GET | /init-notion |
Initialize Notion connection |
| GET | /notion-auth-url?uid=... |
Get Notion OAuth URL |
| GET | /notion-callback |
Notion OAuth redirect handler |
| DELETE | /disconnect-notion |
Clear Notion connection |
| POST | /sync-task-complete?taskId=... |
Update task completion in Notion |
| POST | /create-excalidraw-workflow |
Generate Excalidraw workflow diagram |
| Layer | Technology |
|---|---|
| Frontend | Flutter (Dart), Provider, Firebase SDK |
| Backend | FastAPI (Python), HTTPX |
| Database | Cloud Firestore |
| Auth | Firebase Authentication |
| AI Models | Gemma 4 31B Dense, Gemma 4 2B, Gemma 4 26B MoE via OpenRouter |
| Integrations | Notion API, TinyFish API, Excalidraw |
| Deployment | Cloud Run (backend), Vercel (web frontend) |
| Variable | Required | Description |
|---|---|---|
OPENROUTER_API_KEY |
Yes | Gemma 4 model access via OpenRouter |
TINYFISH_API_KEY |
Yes | Web scraping and Excalidraw automation |
NOTION_OAUTH_CLIENT_ID |
Yes | Notion OAuth app client ID |
NOTION_OAUTH_CLIENT_SECRET |
Yes | Notion OAuth app client secret |
NOTION_REDIRECT_URI |
Yes | OAuth redirect URI registered with Notion |
GOOGLE_APPLICATION_CREDENTIALS |
Yes | Firebase Admin SDK service account path |
NOTION_PARENT_PAGE_ID |
No | Fallback parent page for Notion workspace |
NOTION_DATABASE_ID |
No | Fallback bootstrap database ID |
Keep secrets out of git. Use Cloud Run secret manager or local
.envtooling.
cd due_it_backend
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
pip install -r requirements.txt
export OPENROUTER_API_KEY=your_key_here
export TINYFISH_API_KEY=your_key_here
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/serviceAccount.json
uvicorn main:app --reload --host 0.0.0.0 --port 8080Backend will be available at http://localhost:8080.
Both service files read the backend URL from a build-time constant via String.fromEnvironment('API_BASE_URL'). Pass it at run time with --dart-define:
flutter run --dart-define=API_BASE_URL=http://localhost:8080Common values by target:
- Web / desktop:
http://localhost:8080 - Android emulator:
http://10.0.2.2:8080 - Physical device:
http://<your-LAN-IP>:8080
cd due_it
flutter pub get
flutter run --dart-define=API_BASE_URL=http://localhost:8080MIT License