Work / Chitragupt / Architecture
Chitragupt architecture
An Indian tax-and-money app. A website on Cloud Run and an Android app talk to Firebase in Mumbai. About 190 functions read uploaded documents, with regex first and Claude Haiku only as a fallback. It has not launched and has no customers.
last verified 2026-10-30
Known cost a month
₹156
Google Cloud only, forecast ₹165 for October, against a ₹500 alert. Claude, Razorpay, RevenueCat and KYC are not read.
What makes cost grow
Documents the regex cannot read
Only those go to Claude Haiku. Ask AI is the other model call, capped at 5 questions a day on AI Self.
How it fits together
Pick something a user does to see its path and what it costs.
Not read
- The app asks for a code.
- The function stores a code and rate-limits by IP.
- It asks ZeptoMail to send it.
- No code arrives and the user cannot sign in.
Cost
Every number says where it came from.
| Service | Pays for | Today | Grows with | Basis |
|---|---|---|---|---|
| Android app and website | Expo app (iOS not shipped); the site is Next.js | $0 | Nothing | StatedCLAUDE.md; wiki/decisions/payments.md (iOS is out of scope) |
| chitragupt-web | Cloud Run · 1 GiB · 1 CPU · serves the site | ₹3.08: Hosting ₹2.91, Cloud Run ₹0.17 | Page requests | MeasuredCloud Billing report, Oct 1-30, read 2026-10-30 |
| Cloud Functions | 192 deployed · max 5 instances each · Node 24 · about 20 scheduled jobs | ₹0, after ₹284.90 of free tier | Uploads, calls and the 5-minute payment check | MeasuredCloud Billing report, Oct 1-30, read 2026-10-30 |
| Firestore, Storage, Auth | All user data, documents and sign-in | ₹9.61 Storage; no Firestore line | Stored documents (200 MB free, 5 GB paid per user) and reads | MeasuredCloud Billing report, Oct 1-30, read 2026-10-30 |
| Claude Haiku 4.5 | Reads odd documents; answers Ask AI | Not read | Documents that fail regex; Ask AI questions | Not known |
| Razorpay | Website unlock payments, refunds, CA payments | Not read | Payments taken | Not known |
| RevenueCat | Android unlocks through Play Billing | Not read | Revenue from app purchases | Not known |
| ZeptoMail (Zoho India) | Sign-in codes and all email | Not read | Emails sent | Not known |
| KYC vendor | PAN and Aadhaar check before hiring a CA | Not read | KYC checks | Not known |
| Sentry and PostHog | Errors from functions; anonymous events from the app | Not read | Events | Not known |
| Cloud Scheduler | Runs the timed jobs · the biggest line | ₹117.97, 76% of the bill | Number of scheduled jobs | MeasuredCloud Billing report, Oct 1-30, read 2026-10-30 |
What breaks when something fails
| If this fails | The user sees | Their data | Basis |
|---|---|---|---|
| chitragupt-web | The website is down. The phone app and the functions are separate. | Safe in Firestore and Storage | Assumed.github/workflows/deploy.yml deploys it on its own; no outage test named |
| Cloud Functions | Uploads stay unread, sign-in and payments fail. | Stored files are kept. Hourly sweep retries documents left in parse_pending. | In codeapps/functions/src/index.ts; triggers/scheduled/hourly-sweep-parse-pending.ts |
| Firestore, Storage, Auth | Nothing works. | Single region, no second copy recorded | Statedwiki/decisions/infrastructure.md (multi-region rejected) |
| Claude Haiku 4.5 | The document waits and is retried, or lands as needs_classification. Ask AI says it is unavailable and gives the question back. | Safe; the file stays in Storage | In codeparser/llm-fallback.ts (3 tries, 60 s each); ai/ask-ai.ts decrementAiQuota |
| Razorpay | Cannot pay on the web. A payment taken while we are down is found by a check every 5 minutes. | Safe | In codetriggers/scheduled/five-minutely-razorpay-reconciler.ts; firebase.json webhook rewrite |
| RevenueCat | Cannot buy in the app. The six per-AY products are not created yet, so there is nothing to buy today. | Safe | Stated.context/ops/release.yml (in_app_products: not_created); tasks.md T006 |
| ZeptoMail (Zoho India) | No sign-in code arrives. The screen still says it was sent. | Safe | In code |
| Sentry and PostHog | Nothing visible. | Safe | In code_lib/sentry.ts is a quiet no-op without a DSN |
Where the data goes
| Uploaded tax documents | Storage in Mumbai. Text-less PDFs and photos also go whole to Anthropic when regex fails. |
| Text of other documents | To Anthropic, with PAN, email and phone swapped for placeholders and Aadhaar dropped |
| Ask AI questions and parsed fields | To Anthropic, scrubbed of PAN, Aadhaar, email and phone patterns |
| Camera scans | Read on the phone with Google ML Kit; only text is uploaded |
| Firebase user ID and store receipts | RevenueCat, United States |
| Anonymous app events | PostHog, EU |
| Recipient email addresses | ZeptoMail, India data centre |
What we do not know yet
- Hosting is being migrated (owner, 2026-10-30), but the target is not written down yet: wiki/decisions/infrastructure.md still describes today. Costs here are before the move.
- Claude, Razorpay, RevenueCat, ZeptoMail, KYC, Sentry and PostHog bills are not read.
- Haiku cost per document and per question: no log or bill is recorded. The only figure is a code comment, $0.008 to $0.012 a document, not tested.
- wiki/synthesis/pricing.md and ops/release.yml are old (2026-08-10 and 2026-10-04). The deployed function count and Cloud Run revision may have moved.
- Razorpay fee per payment, Play developer fee and EAS cost are not recorded.
- No customers and no tag deploy have happened, so usage numbers do not exist; growth is left out on purpose.