MSME Mitr is an AI-powered multilingual advisory system designed to help Micro, Small, and Medium Enterprises (MSMEs) in India discover and apply for government schemes. Built with a mobile-first approach, it provides personalized recommendations through an intelligent chatbot interface supporting 12 Indian languages.
- AI-First Chatbot - Intelligent conversational interface powered by OpenRouter (Claude, GPT-4, Llama)
- Voice Input - Deepgram-powered speech-to-text in multiple Indian languages
- Offline Mode - Works without internet using cached scheme data
- Multi-Language Support - 12 Indian languages including Hindi, Tamil, Telugu, Bengali
- Real-time Streaming - Smooth streaming responses for better UX
- Smart Recommendations - Personalized scheme suggestions based on business profile
- Mobile-First Design - Optimized for rural users with poor connectivity
- Node.js 18+ and npm
- API Keys (optional but recommended):
- OpenRouter API Key - For AI responses
- Deepgram API Key - For voice transcription
- Clone the repository
git clone https://github.com/yourusername/msme-mitr.git
cd msme-mitr- Install dependencies
npm install- Set up environment variables
cp .env.local.example .env.localEdit .env.local and add your API keys:
# OpenRouter API Configuration
OPENROUTER_API_KEY=your_openrouter_api_key_here
# Deepgram API Configuration (for voice recording)
DEEPGRAM_API_KEY=your_deepgram_api_key_here
# Model Selection (choose one)
OPENROUTER_MODEL=anthropic/claude-3-haiku # Fast & affordable
# OPENROUTER_MODEL=anthropic/claude-3-sonnet
# OPENROUTER_MODEL=openai/gpt-3.5-turbo
# OPENROUTER_MODEL=meta-llama/llama-3-70b-instruct
# Rate Limiting
MAX_REQUESTS_PER_MINUTE=20
MAX_REQUESTS_PER_DAY=500- Run the development server
npm run dev- Open in browser
http://localhost:3000
- Frontend: Next.js 14 (App Router), TypeScript, Tailwind CSS
- UI Components: shadcn/ui, Radix UI
- AI Integration: OpenRouter API (multi-model support)
- Voice: Deepgram STT
- State Management: React Hooks, Context API
- Streaming: Vercel AI SDK
msme-mitr/
โโโ app/
โ โโโ api/
โ โ โโโ chat/ # Chat endpoints
โ โ โโโ voice/ # Voice transcription
โ โ โโโ health/ # Health check
โ โโโ page.tsx # Home page
โ โโโ layout.tsx # Root layout
โโโ components/
โ โโโ mobile/ # Mobile-optimized components
โ โ โโโ ChatInterfaceStream.tsx
โ โโโ ui/ # Reusable UI components
โ โโโ layouts/ # Layout components
โโโ services/
โ โโโ ai/ # AI services
โ โ โโโ openRouterService.ts
โ โ โโโ contextBuilder.ts
โ โโโ chat/ # Chat management
โ โ โโโ conversationManager.ts
โ โโโ schemes/ # Scheme data service
โ โ โโโ schemeDataService.ts
โ โโโ voice/ # Voice services
โ โ โโโ deepgramService.ts
โ โโโ language/ # Multi-language support
โ โ โโโ languageService.ts
โ โโโ offline/ # Offline mode
โ โโโ offlineService.ts
โโโ hooks/ # Custom React hooks
โโโ types/ # TypeScript definitions
โโโ data/ # Static data
โ โโโ schemes.json # Government schemes database
โโโ public/ # Static assets
The chat interface uses streaming responses for a smooth experience:
- Multiple AI Models: Choose between Claude, GPT-4, Llama, and more
- Context-Aware: Maintains conversation history and user profile
- Token Optimization: Intelligent context management for cost efficiency
- Fallback Mode: Works without API keys using cached responses
Advanced voice recording features:
- Multi-Language STT: Supports 12 Indian languages
- Auto-Detection: Automatically detects spoken language
- Noise Cancellation: Built-in echo cancellation and noise suppression
- Visual Feedback: Real-time recording indicator with duration
Comprehensive offline functionality:
- Automatic Detection: Detects network status changes
- Cached Responses: Pre-generated answers for common questions
- LocalStorage: Persists scheme data for offline access
- Sync on Reconnect: Auto-syncs when back online
Complete localization for Indian users:
Supported Languages:
- English (en)
- เคนเคฟเคจเฅเคฆเฅ (hi)
- เฎคเฎฎเฎฟเฎดเฏ (ta)
- เฐคเฑเฐฒเฑเฐเฑ (te)
- เฆฌเฆพเฆเฆฒเฆพ (bn)
- เคฎเคฐเคพเค เฅ (mr)
- เชเซเชเชฐเชพเชคเซ (gu)
- เฒเฒจเณเฒจเฒก (kn)
- เดฎเดฒเดฏเดพเดณเด (ml)
- เจชเฉฐเจเจพเจฌเฉ (pa)
- เฌเฌกเฌผเฌฟเฌ (or)
- เฆ
เฆธเฆฎเงเฆฏเฆผเฆพ (as)Intelligent scheme recommendation system:
- 11 Government Schemes: Curated database of MSME schemes
- Smart Filtering: Based on business type, location, and eligibility
- Token Budget: Optimizes context for API limits
- Personalization: Learns from user profile and conversation
Designed for rural Indian users:
- Large Touch Targets: 48px minimum for easy interaction
- Safe Area Padding: Accounts for device notches and home indicators
- Responsive Design: Adapts to all screen sizes
- Low Bandwidth: Optimized for 2G/3G networks
- Progressive Enhancement: Core features work without JavaScript
| Variable | Description | Required | Default |
|---|---|---|---|
OPENROUTER_API_KEY |
OpenRouter API key for AI responses | No | - |
DEEPGRAM_API_KEY |
Deepgram API key for voice transcription | No | - |
OPENROUTER_MODEL |
AI model to use | No | anthropic/claude-3-haiku |
MAX_REQUESTS_PER_MINUTE |
Rate limit per minute | No | 20 |
MAX_REQUESTS_PER_DAY |
Rate limit per day | No | 500 |
ENABLE_DEBUG_LOGS |
Enable debug logging | No | false |
Available models through OpenRouter:
| Model | Speed | Cost | Best For |
|---|---|---|---|
anthropic/claude-3-haiku |
Fast | Low | General queries |
anthropic/claude-3-sonnet |
Medium | Medium | Complex tasks |
anthropic/claude-3-opus |
Slow | High | Advanced reasoning |
openai/gpt-3.5-turbo |
Fast | Low | Quick responses |
openai/gpt-4-turbo |
Medium | High | Complex analysis |
meta-llama/llama-3-70b |
Medium | Low | Open-source option |
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linting
npm run lint
# Type checking
npm run type-checkThe system includes 11 government schemes:
- PMEGP - Prime Minister's Employment Generation Programme
- CGTMSE - Credit Guarantee Fund Trust for MSEs
- MUDRA - Micro Units Development & Refinance Agency
- Stand Up India - Loans for SC/ST and Women entrepreneurs
- 59 Minute Loan - Quick MSME loans
- Udyam Registration - Official MSME registration
- GeM - Government e-Marketplace
- MSME Samadhaan - Delayed payment resolution
- Digital MSME - Digital adoption scheme
- SFURTI - Cluster development scheme
- ZED - Zero Defect Zero Effect certification
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Use meaningful variable and function names
- Add comments for complex logic
- Ensure mobile responsiveness
- Test offline functionality
- Optimize for low bandwidth
- API keys are never exposed to the client
- Rate limiting prevents abuse
- Input sanitization for all user inputs
- Secure headers with Next.js
- CORS properly configured
Optimizations implemented:
- Edge Runtime: For streaming endpoints
- Token Optimization: Smart context management
- Lazy Loading: Components loaded as needed
- Image Optimization: Next.js Image component
- Code Splitting: Automatic with Next.js
- Caching: LocalStorage for offline mode
- CDN Ready: Static assets optimized
- WhatsApp Integration
- SMS-based queries
- Document upload and OCR
- Application tracking
- Video tutorials
- Regional language voice output
- Analytics dashboard
- Admin panel
- Scheme updates via CMS
- Push notifications
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenRouter for multi-model AI access
- Deepgram for speech-to-text
- Vercel for hosting and AI SDK
- shadcn/ui for beautiful components
- Government of India for MSME scheme information
For support, please:
- Open an issue on GitHub
- Contact the development team
- Check the documentation
Made with โค๏ธ for Indian MSMEs
Empowering 6.3 Crore MSMEs across India