How We Built a Hindi Voice Assistant in 48 Hours
Using Sarvam AI — HackHazards 2026
Who We Are
We are Team Victors — a 4-member team competing in
HackHazards 2026. This is the story of how we built
a fully working Hindi Voice Assistant mobile app in
under 48 hours, using Sarvam AI's Indian language APIs
and Expo React Native.
The Problem We Wanted to Solve
There are 528 million Hindi speakers in India.
Most of them can speak fluently but struggle with
English-first digital tools. A farmer who wants to
know about PM-KISAN schemes has no simple way to
just ask in Hindi and get a spoken answer back.
A student in a small town can't easily type English
queries into Google.
These people don't need translation. They need a voice.
So we built one.
What We Built
Hindi Voice Assistant — a mobile app where you:
- Press a mic button and speak in Hindi
- The app listens, understands, and generates a Hindi answer
- The answer is displayed as text AND spoken back to you in Hindi
No typing. No English. No barriers.
🎥 Watch the demo: https://youtube.com/shorts/Rt4l1aldhrg?feature=share
💻 GitHub: https://github.com/abhishek220205-hash/HackHazards-Voice-App
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | React Native + Expo SDK 54 |
| Backend | Node.js + Express |
| Deployment | Render (free tier) |
| Speech to Text | Sarvam Saarika v2.5 |
| AI Chat | Sarvam-30b |
| Text to Speech | Sarvam Bulbul v2 (speaker: vidya) |
How It Works — The 3-Step Pipeline
User speaks Hindi
↓
Sarvam STT (saarika:v2.5)
→ Converts Hindi audio to text transcript
↓
Sarvam Chat (sarvam-30b)
→ System prompt: "Answer in Hindi only, max 2-3 sentences"
→ Generates Hindi reply
↓
Strip markdown + truncate to 490 characters
↓
Sarvam TTS (Bulbul v2, speaker: vidya)
→ Converts Hindi text to audio
→ Returns base64 encoded WAV
↓
App plays audio automatically
All three API calls happen in one POST request to our
backend /process-voice endpoint. The entire round
trip takes 8-12 seconds.
The Challenges We Actually Faced
This is the part most hackathon posts skip. Here's
what actually broke and how we fixed it.
1. node-fetch v3 broke our backend
We installed node-fetch normally and got a cryptic
ES Module error. Turns out node-fetch v3 dropped
CommonJS support. Fix: downgrade to v2.
npm install node-fetch@2
Also had to add "type": "commonjs" to package.json.
2. TTS API rejected long responses
Sarvam's TTS API silently fails or errors when input
exceeds 500 characters. The Chat API sometimes returns
long markdown-formatted answers. Fix: strip markdown
characters and truncate to 490 chars before every
TTS call.
reply = reply
.replace(/[#*_\->`]/g, "")
.replace(/\n+/g, " ")
.trim();
if (reply.length > 490) {
reply = reply.substring(0, 490);
}
3. Render deployment needs process.env.PORT
Our server had const PORT = 3000 hardcoded. Render
assigns its own port via environment variable. Fix:
const PORT = process.env.PORT || 3000;
app.listen(PORT, "0.0.0.0", () => {
console.log(`Server running on port ${PORT}`);
});
4. Expo tunnel for remote testing
The default Expo QR code only works on the same WiFi
network. To test with our teammate on a different
network we used:
npx expo start --tunnel
The Moment It Worked
The first time a non-technical person used our app
and asked "भारत में कितने राज्य हैं?" and heard
the answer spoken back in Hindi — that was the moment
we knew this was worth building.
The app responded: "भारत में 28 राज्य हैं।
इसके अतिरिक्त, 8 केंद्र शासित प्रदेश भी हैं।"
Real answer. Real voice. Real Hindi.
What We Learned
- Sarvam AI is genuinely powerful for Indian languages. The STT accuracy for Hindi was impressive even with casual conversational speech.
- Expo makes mobile development fast. Going from zero to a working Android app in hours is remarkable.
- The real work is in the edge cases. Character limits, module systems, port configs — the actual coding challenge isn't the happy path, it's handling everything that breaks around it.
What's Next for This Project
- Support for 10+ Indian languages (Tamil, Telugu, Bengali)
- Offline mode for low-connectivity areas
- Domain-specific assistants for farming, health, education
- WhatsApp integration — no app install needed
Try It Yourself
🎥 Demo Video: https://youtube.com/shorts/Rt4l1aldhrg?feature=share
💻 GitHub: https://github.com/abhishek220205-hash/HackHazards-Voice-App
Built with ❤️ by Team Victors for HackHazards 2026.
Powered by Sarvam AI + Expo.
Top comments (0)