-- Made by Diplomats --
A Chrome extension that audits legal documents and terms of service using Google's Gemini AI. Get instant safety scores, red flags, and actionable advice in your preferred language.
- 🔍 Instant Policy Analysis – Paste or upload policy text for real-time audit
- 🚩 Safety Scoring – 0-100 score with AI-identified red flags and green flags
- 🌐 Multi-Language Support – Audit results translated to Japanese, Chinese, Korean, Spanish, and more
- ⚡ Fast Feedback – Powered by Gemini 2.5 Flash for quick responses
- 🛡️ Secure – API key stored server-side; no credentials in frontend
- Frontend: React + TypeScript (Chrome Extension)
- Backend: FastAPI (Python)
- AI: Google Gemini 2.5 Flash
- Build: Vite, npm
- Node.js 18+ (for frontend)
- Python 3.10+ (for backend)
- Google Gemini API Key – Get one free
- Chrome browser
- Encourages informed consent
- Makes legal documents accessible to non-experts
- Supports multilingual users
- Helps users avoid harmful or unfair terms
- Promotes transparency in digital agreements
- Manual text / file upload for blocked sites
- PDF support for downloaded policies
- Streaming or background AI analysis
- User risk preference settings
- Export/shareable summaries
- Accessibility improvements
- More language support
git clone https://github.com/your-username/extension-final.git
cd extension-finalcd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
cp .env.example .env
# Edit .env and add your Gemini API key:
# GEMINI_API_KEY=your_key_herecd ../frontend
# Install dependencies
npm install
# Build the extension
npm run buildcd backend
source venv/bin/activate # Activate virtual env
uvicorn main:app --reload --port 8000The API will be available at http://localhost:8000
- Open Chrome and go to
chrome://extensions/ - Enable Developer mode (top right)
- Click Load unpacked
- Select the
frontend/dist/folder - The extension is now installed and ready to use
- Open a policy or Terms of Service (or paste text anywhere on the web)
- Click the PolicyPulse extension icon
- Paste or select policy text
- Choose your preferred language (optional)
- Click Analyze to get instant audit results
Results include:
- Document Type – What kind of policy this is
- Safety Score – 0-100 rating
- Red/Green Flags – Key concerns or positives
- Summary – Witty one-liner vibe check
- Advice – Actionable next steps
Create a .env file in the backend/ directory:
GEMINI_API_KEY=your_gemini_api_key_here
Never commit .env to version control!
extension-final/
├── backend/
│ ├── main.py # FastAPI app & /analyze endpoint
│ ├── translator.py # Translation logic using Gemini
│ ├── requirements.txt # Python dependencies
│ └── .env.example # Template for environment variables
└── frontend/
├── src/
│ ├── App.tsx # Main component
│ ├── background.ts # Extension background script
│ ├── content.ts # Page content injection
│ └── helpers/ # Utility functions
├── public/manifest.json # Extension manifest
├── package.json # npm dependencies
└── vite.config.ts # Vite build config
Analyze a policy and return audit results.
Request:
{
"text": "policy text here",
"language": "english"
}Response:
{
"doc_type": "Terms of Service",
"safety_score": 65,
"flags": ["🚩 Tracking clauses", "🚩 Forced arbitration"],
"brief_summary": "Pretty standard terms, some sketchy tracking.",
"advice": "Consider disabling cookies and reviewing data sharing clauses."
}Translate audit results to another language.
Request:
{
"audit": {
/* audit object from /analyze */
},
"language": "japanese"
}Response: Translated audit object
- Ensure
.envexists with your Gemini API key - Check Python version:
python --version(must be 3.10+) - Reinstall deps:
pip install --upgrade -r requirements.txt
- Verify
frontend/dist/exists (runnpm run buildif missing) - Hard refresh Chrome extensions page (Ctrl+Shift+Delete)
- Check Chrome console for errors (DevTools → Extensions)
- Confirm backend is running on
localhost:8000 - Check backend logs for error messages
- Verify
.envhas a valid Gemini API key
Contributions welcome! Please:
- Fork the repo
- Create a feature branch
- Submit a pull request
- 📧 Email: nlathi@fandm.edu hlinhtet@fandm.edu mkwon@fandm.edu
- 🐛 Issues: GitHub Issues
Made with ❤️ by Diplomats