YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
NyaySetu RTI Application Generator
Flask-based PDF generator for RTI (Right to Information) applications with professional formatting.
Features
- Generate formatted RTI application PDFs
- Support for all standard RTI form fields
- BPL (Below Poverty Line) status handling
- PDF overlay on official templates
- REST API for integration
Local Development
Setup
# Navigate to the RTI Generator directory
cd temp/RTI_Generator
# Create a virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
Run Locally
python app.py
The service will be available at http://localhost:5001
Test the API
Health check:
curl http://localhost:5001/
Generate RTI PDF:
curl -X POST http://localhost:5001/api/generate-rti \
-H "Content-Type: application/json" \
-d '{
"applicant_name": "John Doe",
"guardian_name": "Jane Doe",
"address": "123 Main Street, Mumbai",
"phone": "022-12345678",
"mobile": "9876543210",
"fee_amount": "10",
"payment_mode": "Cash",
"payment_date": "29/12/2025",
"favoring": "Public Information Officer",
"photocopy_amount": "2",
"num_pages": "5",
"cd_amount": "",
"bpl_status": "No",
"bpl_certificate": "",
"date": "29/12/2025"
}' \
--output test_rti.pdf
Deployment to Render
Prerequisites
- A GitHub account
- A Render account (free tier available)
Steps
Initialize Git Repository (if not already done):
cd temp/RTI_Generator git init git add . git commit -m "Initial RTI generator setup"Create GitHub Repository:
- Go to GitHub and create a new repository (e.g.,
nyaysetu-rti-generator) - Push your code:
git remote add origin https://github.com/YOUR_USERNAME/nyaysetu-rti-generator.git git branch -M main git push -u origin main
- Go to GitHub and create a new repository (e.g.,
Deploy on Render:
- Go to Render Dashboard
- Click New β Web Service
- Connect your GitHub repository
- Render will auto-detect the
render.yamlconfiguration - Click Create Web Service
- Wait for deployment to complete
Get Your Service URL:
- Once deployed, you'll get a URL like:
https://nyaysetu-rti-generator.onrender.com - Copy this URL for configuring your frontend
- Once deployed, you'll get a URL like:
API Endpoints
GET /
Health check endpoint.
Response:
{
"status": "healthy",
"service": "RTI Application Generator",
"version": "1.0.0"
}
POST /api/generate-rti
Generate RTI application PDF.
Request Body:
{
"applicant_name": "string (required)",
"guardian_name": "string (required)",
"address": "string (required)",
"phone": "string",
"mobile": "string (required)",
"fee_amount": "string",
"payment_mode": "string",
"payment_date": "string",
"favoring": "string",
"photocopy_amount": "string",
"num_pages": "string",
"cd_amount": "string",
"bpl_status": "string",
"bpl_certificate": "string",
"date": "string"
}
Response:
- Content-Type:
application/pdf - The generated RTI application PDF
Integration with Next.js Frontend
After deploying to Render, update your Next.js .env.local:
RTI_API_URL=https://nyaysetu-rti-generator.onrender.com
Project Structure
RTI_Generator/
βββ app.py # Flask application with API endpoints
βββ generate_rti.py # PDF generation logic
βββ requirements.txt # Python dependencies
βββ render.yaml # Render deployment configuration
βββ .gitignore # Git ignore rules
βββ README.md # This file
βββ pdf_templates/ # PDF template files
β βββ rti_background.pdf
βββ output/ # Generated PDFs (gitignored)
Dependencies
- Flask 3.0.0: Web framework
- flask-cors 4.0.0: CORS support for API
- reportlab 4.0.7: PDF generation
- PyPDF2 3.0.1: PDF manipulation
- gunicorn 21.2.0: Production WSGI server
Troubleshooting
PDF Generation Fails
- Ensure
pdf_templates/rti_background.pdfexists - Check file permissions on the output directory
- Verify all required fields are provided
CORS Issues
- The backend has CORS enabled for all origins
- If issues persist, check Render logs
Cold Starts
- Free tier Render services sleep after inactivity
- First request may take 30-60 seconds
- Consider upgrading to paid tier for always-on service
License
Part of the NyaySetu legal assistance platform. # rti-generation-backend
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support