Skip to content

siddham-jain/msme-mitr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

61 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ MSME Mitr - AI-First MSME Advisory System

Next.js TypeScript Tailwind CSS License

๐ŸŒŸ Overview

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.

๐ŸŽฏ Key Features

  • 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

๐Ÿš€ Quick Start

Prerequisites

Installation

  1. Clone the repository
git clone https://github.com/yourusername/msme-mitr.git
cd msme-mitr
  1. Install dependencies
npm install
  1. Set up environment variables
cp .env.local.example .env.local

Edit .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
  1. Run the development server
npm run dev
  1. Open in browser
http://localhost:3000

๐Ÿ—๏ธ Architecture

Tech Stack

  • 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

Project Structure

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

๐ŸŽจ Features in Detail

1. AI-Powered Chat Interface

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

2. Voice Input with Deepgram

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

3. Offline Mode

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

4. Multi-Language Support

Complete localization for Indian users:

Supported Languages:
- English (en)
- เคนเคฟเคจเฅเคฆเฅ€ (hi)
- เฎคเฎฎเฎฟเฎดเฏ (ta)
- เฐคเฑ†เฐฒเฑเฐ—เฑ (te)
- เฆฌเฆพเฆ‚เฆฒเฆพ (bn)
- เคฎเคฐเคพเค เฅ€ (mr)
- เช—เซเชœเชฐเชพเชคเซ€ (gu)
- เฒ•เฒจเณเฒจเฒก (kn)
- เดฎเดฒเดฏเดพเดณเด‚ (ml)
- เจชเฉฐเจœเจพเจฌเฉ€ (pa)
- เฌ“เฌกเฌผเฌฟเฌ† (or)
- เฆ…เฆธเฆฎเง€เฆฏเฆผเฆพ (as)

5. Scheme Management

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

๐Ÿ“ฑ Mobile Optimization

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

๐Ÿ”ง Configuration

Environment Variables

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

Model Selection

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

๐Ÿงช Testing

# 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-check

๐Ÿ“Š Scheme Database

The system includes 11 government schemes:

  1. PMEGP - Prime Minister's Employment Generation Programme
  2. CGTMSE - Credit Guarantee Fund Trust for MSEs
  3. MUDRA - Micro Units Development & Refinance Agency
  4. Stand Up India - Loans for SC/ST and Women entrepreneurs
  5. 59 Minute Loan - Quick MSME loans
  6. Udyam Registration - Official MSME registration
  7. GeM - Government e-Marketplace
  8. MSME Samadhaan - Delayed payment resolution
  9. Digital MSME - Digital adoption scheme
  10. SFURTI - Cluster development scheme
  11. ZED - Zero Defect Zero Effect certification

๐Ÿค Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • 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

๐Ÿ”’ Security

  • 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

๐Ÿ“ˆ Performance

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

๐ŸŽฏ Roadmap

  • 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

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • 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

๐Ÿ’ฌ Support

For support, please:

  • Open an issue on GitHub
  • Contact the development team
  • Check the documentation

๐ŸŒ Links


Made with โค๏ธ for Indian MSMEs

Empowering 6.3 Crore MSMEs across India

About

ai powered app for MSMEs in India (govt. scheme recommendation engine, ai chatbot)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages