🌍 What Inspired MediReach

The inspiration wasn't a trend or a tutorial. It was a question:

What does a poor farmer in rural Bihar do when his child has a fever at midnight and the nearest clinic is 40 kilometers away?

He guesses. He hopes. Sometimes he loses.

4.5 billion people worldwide lack access to basic healthcare. Not because medicine doesn't exist — but because the bridge between people and knowledge doesn't exist. MediReach is that bridge.


🛠️ How I Built It

MediReach was built using an AI-native development workflow from the ground up:

  • Frontend: React + Vite, deployed on Netlify
  • AI: Google Gemini 3.1 Flash Lite via a secure Next.js backend
  • Backend: Next.js API routes on Vercel with CORS origin verification, IP-based rate limiting, and server-side API key storage

The system prompt was engineered to force Gemini to:

  1. Respond in the user's selected language — every time
  2. Use simple, friendly language (10-year-old reading level)
  3. Output a structured triage label (HOME CARE, SEE A DOCTOR, or EMERGENCY) on its own line after every response

The frontend detects these labels from the raw API response before stripping them from the displayed text — ensuring badges trigger correctly without showing the label text to the user.


💡 What I Learned

Technical

  • How to architect a secure AI backend with CORS and rate limiting
  • The difference between raw and cleaned API responses and why it matters
  • How Gemini's system_instruction works differently from inline prompting
  • Why API keys in frontend code is never acceptable, even for demos

Human

The biggest lesson wasn't technical. It was moral.

I almost deployed a broken version. The badge system wasn't working correctly — emergency situations weren't being detected in Hindi. I knew nobody would probably use it. But I couldn't ship it.

"If this takes a life, it is better for it to not exist."

So I kept debugging. For two days. Until it was right.

That taught me that the best developers aren't the fastest — they're the ones who care enough to get it right.


🧩 Challenges I Faced

1. The Multilingual Badge Problem

The hardest technical challenge was making the urgency badge system work across 12 languages. My first approach used regex keyword matching in Hindi, Bengali, Arabic and other languages. It failed constantly — Hindi has too many ways to say "go to hospital."

Solution: Force Gemini to always output the triage label in English on its own line, regardless of response language. Then detect from the raw response before cleaning.

2. Hinglish and Benglish

I realized that most Hindi and Bengali speakers don't type in native script — they write phonetically in English letters:

"Mere sir me dard ho raha hai" = "I have a headache" in Hindi

No health app I found handled this. MediReach does — by teaching Gemini to recognize and respond to Romanized regional languages.

3. The API Key Problem

Direct Gemini calls from the frontend expose the API key in DevTools. For a health app targeting vulnerable users, this was unacceptable. I built a separate Next.js backend with CORS origin verification and rate limiting — repurposed from another project — to keep all keys server-side.

4. Tone vs Safety

Making the AI sound like a warm friend while still being medically responsible was a constant balancing act. Too clinical and users wouldn't trust it. Too casual and it might downplay real emergencies.

The solution was layered prompt engineering — separate rules for tone, language simplicity, escalation logic, and mandatory output formatting.


🔢 The Math of the Problem

The urgency system uses a simple rank comparison to ensure badges never downgrade:

$$ \text{Update badge} \iff \text{rank}(\text{new}) > \text{rank}(\text{current}) $$

Where:

$$ \text{rank}(\text{badge}) \in {1,\ 2,\ 3} $$

Where \(1 =\) HOME CARE, \(2 =\) SEE A DOCTOR, \(3 =\) EMERGENCY.

Once \(\text{rank} = 3\) (EMERGENCY), no subsequent response can lower it — keeping users safe even if they say "I feel better now."


🏁 This Is Month 3

MediReach is part of a personal commitment — 12 months, 12 hackathons. Not to win. To learn. To build things that matter.

This is the project I'm most proud of — not because of the code, but because of the decision to keep fixing it until it was right.


Built With

  • claude
  • google-ai-studio
  • google-gemini-api
  • netlify
  • next.js
  • node.js
  • react
  • vercel
  • vite
Share this project:

Updates