A browser extension that leverages azure to democratize privacy policy comprehension. The system analyzes privacy policies and presents them through an intuitive interface with actionable insights.
- Privacy Policy Analysis - AI-powered analysis of privacy policies
- Score - Easy-to-understand 0-100 privacy score
- Red Flags Detection - Highlights concerning privacy practices
- Action Items - Personalized recommendations with one-click email templates
- Smart Discovery - Automatically finds privacy policies on any website
- Caching - Results are cached for instant repeat visits
- API Key Pooling - Automatic key rotation for rate limit resilience
- Frontend: React-based Chrome extension (Manifest V3)
- Backend: Python FastAPI service (deployable as Azure Functions)
- AI: Groq LLM with multi-model fallback
- Storage: Local JSON cache (dev) / Azure Cosmos DB (production)
- Python 3.11+ - Download Python
- Node.js 18+ - Download Node.js
- Groq API Key - Get free API key
git clone git@github.com:pragnyanramtha/hercule.git
cd hercule-
Copy the example environment file:
cp .env.example backend/.env
-
Edit
backend/.envand add your Groq API key:GROQ_API_KEY=gsk_your_api_key_here
-
Get your API key from console.groq.com
Backend:
cd backend
pip install -r requirements.txtFrontend:
cd frontend
npm installYou need to run these commands in separate terminal windows:
Terminal 1 - Backend API:
cd backend
uvicorn main:app --reload --port 8000Terminal 2 - Extension Build:
cd frontend
npm run dev- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top-right corner)
- Click "Load unpacked"
- Select the
frontend/distdirectory - The extension icon should appear in your browser toolbar
hercule/
├── frontend/ # Chrome extension (React + TypeScript)
│ ├── src/
│ │ ├── content/ # Content scripts for page scraping
│ │ └── popup/ # Popup UI components
│ │ └── components/
│ │ ├── Settings.tsx # User settings modal
│ │ ├── TrafficLight.tsx
│ │ ├── Summary.tsx
│ │ ├── RedFlags.tsx
│ │ └── ActionItems.tsx
│ └── dist/ # Built extension (generated)
├── backend/ # FastAPI backend
│ ├── main.py # API endpoints
│ ├── service_llm.py # Groq LLM integration
│ ├── service_discovery.py # Privacy policy discovery
│ ├── api_key_manager.py # API key pooling & rotation
│ ├── cache.py # Cache manager (local/cosmos)
│ ├── cache_cosmos.py # Azure Cosmos DB cache
│ ├── models.py # Pydantic data models
│ ├── keys.json # API key pool storage
│ ├── cache.json # Local cache (generated)
│ ├── function_app.py # Azure Functions entry point
│ └── host.json # Azure Functions config
├── shared/ # Shared TypeScript types
└── .env.example # Environment template
- Visit any website (e.g., google.com, facebook.com)
- Click the Hercule extension icon
- The extension will:
- Detect privacy policy links on the page
- Extract and analyze the policy text
- Display a traffic-light score (Green/Yellow/Red)
- Show key concerns and recommended actions
- Click Settings (gear icon) to add your name and API key
Click the gear icon in the extension header to configure:
- Your Name: Used to personalize email templates (replaces
[Your Name]) - Groq API Key: Optional - use your own key for faster analysis
Your settings are stored locally in the browser and never sent to external servers (except the API key which is sent to Groq for authentication).
The backend runs on http://localhost:8000 with hot-reload enabled.
API Endpoints:
POST /analyze- Analyze privacy policy textGET /health- Health checkGET /discover_policy- Discover policy URL for a domain
Testing:
cd backend
pytest tests/ -vThe extension builds to frontend/dist/ with hot-reload.
Building for production:
cd frontend
npm run buildTesting:
cd frontend
npm testRun all tests:
cd frontend
npm run test:allCopy .env.example to backend/.env and configure:
# Groq API Configuration (REQUIRED)
GROQ_API_KEY=gsk_your_api_key_here
# Storage Configuration
STORAGE_MODE=local # local or cosmos
CACHE_TTL_DAYS=30 # Cache expiration in days
# Azure Cosmos DB (Production only)
COSMOS_CONNECTION_STRING=your-connection-string
COSMOS_DATABASE_NAME=privacy-analyzer
COSMOS_CONTAINER_NAME=analysis-cache
# Optional
GOOGLE_SEARCH_API=your_key # Fallback for policy discovery
ALLOWED_ORIGINS=* # CORS configuration
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERRORThe backend supports automatic API key rotation:
- User keys (from extension settings) are added to the pool
- Pool keys are stored in
backend/keys.json - On 429 rate limit errors, the system rotates to the next key
- Falls back to
.envGROQ_API_KEYonly if pool is empty
- Verify Python 3.11+ is installed:
python --version - Check that all dependencies are installed:
pip install -r backend/requirements.txt - Ensure
.envfile exists with valid Groq API key
- Verify Node.js 18+ is installed:
node --version - Check that dependencies are installed:
cd frontend && npm install - Ensure the extension is built:
npm run devornpm run build - Check Chrome console for errors
- Verify the backend is running on
http://localhost:8000 - Check backend logs for errors
- Verify Groq API key is correct
- Test the backend directly:
curl http://localhost:8000/health
- Add your own API key in extension settings
- Wait a few seconds and retry
- The system will automatically rotate to backup keys if available
- Check that
backend/cache.jsonis being created - Verify file permissions allow read/write
- Check backend logs for cache-related errors
-
Install Azure Functions Core Tools:
npm install -g azure-functions-core-tools@4
-
Install Azure dependencies:
pip install azure-functions azure-cosmos
-
Configure environment variables in Azure:
GROQ_API_KEYSTORAGE_MODE=cosmosCOSMOS_CONNECTION_STRINGCOSMOS_DATABASE_NAMECOSMOS_CONTAINER_NAME
-
Deploy backend:
cd backend func azure functionapp publish <your-function-app-name>
-
Update extension to use production API URL:
- Set
VITE_API_URLduring build
- Set
-
Build and package extension for Chrome Web Store:
cd frontend npm run build
This project was created for the Microsoft Imagine Cup. Contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions, please open an issue on GitHub.
- pragnyanramtha
Open a pull request and become a contributor!