How hahahagi/artha works
Artha records expenses through Telegram or its authenticated web dashboard, then stores and presents transactions alongside budgets and recurring subscriptions. Telegram input supports text, voice transcription, wallet/split-bill parsing, and interactive corrections; the web path adds receipt OCR, analytics, management, and export. Scheduled endpoints send subscription reminders and weekly digests. The README documents Google Sheets sync and PWA support; their runtime links are shown where the tree supports a component path. Some action and integration wiring is unsampled, so uncertain calls are omitted.
Main entry points: prisma.ts Prisma Client · route.ts Telegram Webhook · bot.ts Bot Messaging · server.ts Supabase Auth Client
Components 32
User Entry
- Login & Registration
app/(auth)/login/page.tsx - Auth Actions
app/(auth)/actions.ts - OAuth Callback
app/(auth)/callback/route.ts
Telegram Capture
- Telegram Webhook
app/api/telegram/webhook/route.ts - Expense Parser
lib/parser/expense-parser.ts - Wallet Detection
lib/parser/wallet-detector.ts - Voice Transcription
lib/telegram/voice.ts - Bot Messaging
lib/telegram/bot.ts
Web Dashboard
- Overview & Analytics
app/(dashboard)/page.tsx - Expense Management
app/(dashboard)/expenses/page.tsx - Expense Actions
app/(dashboard)/expenses/actions.ts - Receipt Scanner
components/dashboard/receipt-scanner.tsx - Receipt Parser
lib/parser/receipt-parser.ts - Budget Management
app/(dashboard)/budgets/page.tsx - Budget Actions
app/(dashboard)/budgets/actions.ts - Subscription Management
app/(dashboard)/subscriptions/page.tsx - Subscription Actions
app/(dashboard)/subscriptions/actions.ts - Account Settings
app/(dashboard)/settings/actions.ts - Offline Service Worker
public/sw.js
Automation & Sync
- Expense CSV Export
app/api/export/expenses/route.ts - Billing Reminders
app/api/cron/reminders/route.ts - Weekly Digest
app/api/cron/digest/route.ts - Google Sheets Sync
lib/sheets/google-sheets.ts
Identity & Storage
- Supabase Auth Client
lib/supabase/server.ts - Prisma Client
lib/prisma.ts - PostgreSQL Database
Other components
- User
- Telegram User
- Web Browser
- Telegram Bot API
- Wit.ai
- Scheduled Caller
Connections 46
- User → Telegram User: sends message
- Telegram User → Telegram Bot API: sends input
- Telegram Bot API → Telegram Webhook: delivers updates
- Telegram Webhook → Expense Parser: parses text
- Expense Parser → Wallet Detection: detects wallet
- Telegram Webhook → Voice Transcription: transcribes voice
- Voice Transcription → Wit.ai: requests transcript
- Telegram Webhook → Prisma Client: reads and writes
- Telegram Webhook → Bot Messaging: sends replies
- Bot Messaging → Telegram Bot API: sends messages
- User → Web Browser: uses dashboard
- Web Browser → Login & Registration: opens account
- Login & Registration → Auth Actions: submits credentials
- Auth Actions → Supabase Auth Client: authenticates
- OAuth Callback → Supabase Auth Client: exchanges code
- OAuth Callback → Prisma Client: upserts user
- Web Browser → Overview & Analytics: views analytics
- Overview & Analytics → Supabase Auth Client: checks session
- Overview & Analytics → Prisma Client: reads dashboard data
- Web Browser → Expense Management: manages expenses
- Expense Management → Expense Actions: submits changes
- Expense Actions → Prisma Client: reads and writes
- Web Browser → Receipt Scanner: scans receipt
- Receipt Scanner → Receipt Parser: parses OCR text
- Web Browser → Budget Management: manages budgets
- Budget Management → Budget Actions: submits changes
- Budget Actions → Prisma Client: reads and writes
- Web Browser → Subscription Management: manages subscriptions
- Subscription Management → Subscription Actions: submits changes
- Subscription Actions → Prisma Client: reads and writes
- Web Browser → Account Settings: updates settings
- Account Settings → Prisma Client: updates account data
- Web Browser → Expense CSV Export: requests CSV
- Expense CSV Export → Supabase Auth Client: checks session
- Expense CSV Export → Prisma Client: reads expenses
- Scheduled Caller → Billing Reminders: triggers schedule
- Billing Reminders → Prisma Client: reads and updates
- Billing Reminders → Bot Messaging: sends reminders
- Scheduled Caller → Weekly Digest: triggers schedule
- Weekly Digest → Prisma Client: reads expense data
- Weekly Digest → Bot Messaging: sends digest
- Prisma Client → PostgreSQL Database: queries
- Account Settings → Google Sheets Sync: configures sync
- Expense Actions → Google Sheets Sync: syncs transactions
- Telegram Webhook → Google Sheets Sync: syncs transactions
- Web Browser → Offline Service Worker: caches offline