AWS Builder Center
Building PadhAI: An AI Study Companion for Indian Students, on AWS

Building PadhAI: An AI Study Companion for Indian Students, on AWS

We built PadhAI (ExamSaathi) to remove exactly that friction. Point your phone at a textbook page or a page of handwritten notes — or just paste a question — and get back a plain-language explanation, a handful of practice questions with answers, and one concrete thing to revise next. In Hindi or English, whichever you actually study in.

Software Dev Web3 Builder Founder Tech Writer

The problem we set out to fix

Ask any Indian student preparing for board exams, JEE, or NEET what actually slows them down, and it's rarely "I don't have enough material." It's that the material they do have is dense, poorly explained, or — for a huge number of Hindi-medium and bilingual students — written in English that doesn't match how they actually think about the subject. Handwritten notes are worse: useful in the moment, nearly useless a month later when it's time to revise.
We built PadhAI (ExamSaathi) to remove exactly that friction. Point your phone at a textbook page or a page of handwritten notes — or just paste a question — and get back a plain-language explanation, a handful of practice questions with answers, and one concrete thing to revise next. In Hindi or English, whichever you actually study in.
The whole thing had to be one loop: upload → explanation + practice → save to a personal "Weak Topics" list → come back later and review. Nothing else. No subject selection, no streaks, no social features — just the core loop, done well, running live on AWS.

Architecture

Next.js 15 (Amplify Hosting) → API Gateway (HTTP API) → 3 Lambda functions
├─ analyze → S3 + Bedrock
├─ save-history → DynamoDB
└─ get-history → DynamoDB
Cognito Identity Pool (unauthenticated) → issues session identity

Three single-purpose Lambda functions, each with its own tightly scoped IAM role. The  analyze  function can write to S3 and call Bedrock, but has zero DynamoDB access. The two history functions can read/write DynamoDB, but have zero S3 or Bedrock permissions. Splitting it this way wasn't just tidiness — it meant a bug in the analyze path could never accidentally leak into someone else's saved history, and vice versa.
Everything scales to zero. No VPC (nothing needs to reach a private resource), no provisioned DynamoDB capacity, no idle compute anywhere. The whole backend is one AWS SAM template, deployed with  sam build && sam deploy .

Where AWS actually did the work

Amazon Bedrock is the core of the product. The  analyze  Lambda calls Bedrock's Converse API with a tutoring system prompt, either an image block (the uploaded photo) or a text block (the pasted question), plus a language instruction, and gets back a structured JSON payload: explanation, 3–5 practice questions, one revision suggestion. We use Claude Sonnet 4.5. One API shape handles both the vision and text-only paths, which kept the integration code simple.
API Gateway (HTTP API) + Lambda route three endpoints —  /analyze ,  POST /history ,  GET /history  — with no server ever idling between requests.
S3 holds uploaded images just long enough to analyze them. Fully private, Block Public Access on, and — beyond the 1-day lifecycle rule — the Lambda itself explicitly deletes each image right after processing finishes, success or failure. Most uploads are gone within seconds.
DynamoDB, on-demand billing, stores the "Weak Topics" history: partition key  sessionId , sort key an ISO timestamp + id, so a query for someone's history comes back newest-first with no secondary indexes needed.
Amazon Cognito gives each browser a real, anonymous, AWS-issued identity ( GetId  on an unauthenticated Identity Pool) instead of a purely client-invented UUID — a small, deliberate step up in how session identity is established, without building actual sign-in.
Amplify Hosting serves the Next.js frontend from a public HTTPS URL, connected straight to our GitHub repo.

What actually fought back

Three things, and each one taught us something we wouldn't have learned from a tutorial.
Bedrock's inference-profile requirement. Our first pass called Claude by its bare foundation-model id — the way most getting-started guides show it. Live, that returned a  ValidationException  telling us to use an inference profile instead. It turns out current-generation Anthropic models on Bedrock require invocation through a system-defined inference profile, even for a plain single-region on-demand call with no cross-region routing need. We found the right profile by running  aws bedrock list-inference-profiles  against our own account, and then discovered a second wrinkle: IAM requires granting the underlying foundation-model ARN in every region the profile can route to, not just the inference-profile ARN itself. Granting only the profile ARN fails silently. This is the kind of thing you only find by testing against a real account and reading the actual error text.
A mobile bug a toy test would never catch. Once live, some phones started returning a generic "analysis failed" intermittently. CloudWatch logs told the real story:  ValidationException: The image was specified using the image/jpeg media type, but the image appears to be a image/webp image . Some Android photo pickers report an inaccurate file type — real WebP bytes labeled as JPEG — and Bedrock validates the declared type against the actual bytes, so it hard-rejects the mismatch. We fixed it at the source instead of patching around it: the browser now decodes every selected image through an off-screen canvas and always re-encodes it as a genuine JPEG before upload, so what we declare always matches what we send, no matter what the source file claims. We verified the fix by deliberately reproducing the exact bug against the live API and confirming the app itself could no longer produce it.
A timeout budget that was only tested against toy inputs. Our first tuning pass (Lambda timeout 20s, Bedrock  read_timeout=15s ) was validated against short text prompts that completed in 1–10 seconds — comfortably fast, and misleadingly so. A real handwritten-notes photo in production consistently took 15–17 seconds, tripping that 15-second ceiling and surfacing a bare 504 to an actual student. Digging in, we learned that API Gateway's HTTP APIs hard-cap integration timeouts at 30 seconds, with no service-quota path to raise it (that increase path exists only for REST APIs). That set the real ceiling for the fix: Lambda timeout to 29s, Bedrock read timeout to 24s, and a trimmed token budget to reduce generation latency. We verified the fix against the exact photo that had failed — 14.4 seconds, well inside budget, after the change.

Cost-aware, on purpose

DynamoDB on-demand billing so idle cost is zero. No VPC, so no NAT gateway cost and faster cold starts. Three separate Lambdas so IAM stays scoped instead of one do-everything function with broad permissions. An S3 lifecycle rule as a backstop, and an explicit delete right after use as the real cleanup mechanism. None of this was incidental — a hackathon judged partly on cost-aware architecture is a good forcing function to actually think about it instead of defaulting to "provision generously and worry later."

What we'd do differently

Automated tests. Every one of the three bugs above got caught by deliberately testing against the live, deployed stack with real inputs — which worked, but doesn't scale as a habit. A small  pytest  suite around the Lambda handlers' pure validation and parsing logic would have caught at least the timeout regression earlier, before it reached a real student.


Built for the WeMakeDevs × AWS First Commit hackathon, Ship It track.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article