A public advocacy platform designed to help citizens of Tamil Nadu voice their opposition to Rule 288-A, a proposed amendment to the Tamilnadu Motor Vehicle Rules, 1989.
SaveTheBus enables citizens to easily generate formal objection letters against Rule 288-A, which threatens public ownership of transportation infrastructure. The application uses AI to generate personalized, well-structured objection letters in both English and Tamil.
- AI-Powered Letter Generation: Uses advanced AI models to generate personalized objection letters
- Bilingual Support: Full support for English and Tamil languages
- Dual Generation Modes:
- Auto-Draft Mode: AI generates letters from scratch based on selected concerns
- Manual Mode: Users provide text, AI optimizes and polishes it
- Multiple AI Providers: Support for both Google Gemini and OpenRouter APIs
- Fallback System: Pre-written templates ensure the application always works
- Countdown Timer: Tracks the January 7, 2026 deadline for objections
- Email Integration: One-click copy and mailto links for easy submission
- Responsive Design: Works seamlessly on desktop and mobile devices
- Frontend: React 19.2.3 with TypeScript 5.8.2
- Build Tool: Vite 6.2.0
- Styling: Tailwind CSS
- AI Integration:
- Google Gemini API (direct)
- OpenRouter API (via Edge Function proxy)
- Deployment: Vercel (Edge Runtime)
- Node.js (v18 or higher)
- npm or yarn package manager
- Clone the repository:
git clone https://github.com/yourusername/savethebus.git
cd savethebus- Install dependencies:
npm install- Create a
.envfile based on.env.example:
cp .env.example .env-
Configure your environment variables (see Configuration)
-
Start the development server:
npm run devThe application will be available at http://localhost:3000
The application supports two AI providers. Choose one based on your needs:
AI_PROVIDER=openrouter
OPENROUTER_API_KEY=your_openrouter_api_key_here
OPENROUTER_MODEL=google/gemini-2.0-flash-exp:freeAI_PROVIDER=gemini
GEMINI_API_KEY=your_gemini_api_key_hereOpenRouter:
- Visit OpenRouter.ai
- Sign up and create an API key
- Add to your
.envfile
Google Gemini:
- Visit Google AI Studio
- Create a new API key
- Add to your
.envfile
For detailed setup instructions, see docs/OPENROUTER_SETUP.md.
savethebus/
├── api/ # Edge Functions
│ ├── proxy.ts # OpenRouter proxy (Edge Function)
│ └── types.ts # Type definitions for API
├── components/ # React components
│ ├── ObjectionForm.tsx # Form for user input
│ └── EmailResult.tsx # Display generated letter
├── services/ # Business logic
│ ├── aiService.ts # Main AI service (router)
│ ├── geminiService.ts # Direct Gemini API integration
│ └── openrouterService.ts # OpenRouter client integration
├── docs/ # Documentation
│ └── OPENROUTER_SETUP.md # OpenRouter setup guide
├── App.tsx # Main application component
├── constants.ts # Translations and configuration
├── types.ts # TypeScript type definitions
├── backupTemplates.ts # Fallback letter templates
├── vite.config.ts # Vite configuration
├── vercel.json # Vercel deployment config
└── package.json # Dependencies
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Type checking
npm run type-checkThe application uses a flexible AI service architecture that supports multiple providers:
┌─────────────────────────────────────────────────────────────┐
│ Browser │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ React App │ │
│ │ ┌──────────────────┐ ┌────────────────────────────┐ │ │
│ │ │ aiService.ts │ │ openrouterService.ts │ │ │
│ │ │ (Router) │ │ (Client Integration) │ │ │
│ │ └────────┬─────────┘ └────────────┬───────────────┘ │ │
│ │ │ │ │ │
│ └───────────┼─────────────────────────┼───────────────────┘ │
└──────────────┼─────────────────────────┼─────────────────────┘
│ │
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ Direct Gemini API │ │ /api/proxy (Edge) │
│ (Client-side) │ │ (Server-side) │
└──────────────────────┘ └──────────┬───────────┘
│
▼
┌─────────────────────┐
│ OpenRouter API │
│ (Multiple Models) │
└─────────────────────┘
-
Push your code to a Git repository (GitHub, GitLab, or Bitbucket)
-
Import your project in Vercel
-
Configure environment variables in Vercel dashboard:
AI_PROVIDER(optional, defaults toopenrouter)OPENROUTER_API_KEY(if using OpenRouter)GEMINI_API_KEY(if using Gemini)
-
Deploy
The Edge Function (api/proxy.ts) will be automatically deployed with the application.
Set the following in Vercel dashboard:
For OpenRouter:
OPENROUTER_API_KEY(required)OPENROUTER_MODEL(optional, defaults togoogle/gemini-2.0-flash-exp:free)OPENROUTER_SITE_URL(optional)OPENROUTER_APP_NAME(optional)
For Gemini:
GEMINI_API_KEY(required)
The application supports multiple models through OpenRouter:
Free Models:
google/gemini-2.0-flash-exp:free- Fast, efficient (recommended)google/gemini-2.0-flash-thinking-exp:free- Enhanced reasoningmeta-llama/llama-3.1-8b-instruct:free- Open sourcemistralai/mistral-7b-instruct:free- Efficient
Paid Models:
google/gemini-pro- Balanced performanceanthropic/claude-3-haiku- Fast for simple tasksanthropic/claude-3.5-sonnet- High quality
See docs/OPENROUTER_SETUP.md for complete model list and recommendations.
import { testAIConnection } from './services/aiService';
const result = await testAIConnection();
console.log(result);
// Output: { success: true, message: 'OpenRouter connection successful', provider: 'openrouter', model: 'google/gemini-2.0-flash-exp:free' }# Get API info
curl https://your-domain.com/api/proxy
# Test chat completion
curl -X POST https://your-domain.com/api/proxy/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.0-flash-exp:free",
"messages": [
{"role": "user", "content": "Say hello"}
],
"max_tokens": 10
}'Issue: "OPENROUTER_API_KEY environment variable is not configured"
Solution: Add OPENROUTER_API_KEY to your environment variables.
Issue: "API error: 401 Unauthorized"
Solution: Verify your API key is valid and has sufficient credits.
Issue: "Network error: Unable to connect to the API"
Solution: Check your internet connection and verify Edge Function deployment.
For more troubleshooting tips, see docs/OPENROUTER_SETUP.md.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for the public transit advocacy campaign in Tamil Nadu
- Powered by Google Gemini AI and OpenRouter
- Deployed on Vercel Edge Functions
For questions or support, please open an issue on GitHub.
Public Transit is Public Property - பொதுப் போக்குவரத்து மக்கள் சொத்து