DEV Community

Cover image for TermsLens: Instantly Grade Privacy Policies Before You Sign Up
arjav patni
arjav patni

Posted on

TermsLens: Instantly Grade Privacy Policies Before You Sign Up

This is a submission for the MLH x DEV Writing Challenge

What I Built
TermsLens is an open-source, local-first browser extension that analyzes complex Terms of Service (ToS) and Privacy Policies in real time, translating thousands of words of legalese into an instant visual safety scorecard before you click "I Agree."

We’ve all scrolled through endless legal jargon, ticked "I accept," and blindly surrendered our personal data. When signing up for new services, it is difficult to know which platforms quietly claim rights to user content or sell data to third parties. TermsLens empowers everyday internet users and developers to understand their digital rights in seconds without leaving the webpage.

How It Works
Automated Content Scraper: A background script automatically detects when a user navigates to a page containing legal agreements.

Local NLP Parsing: Using Transformers.js running directly in the browser's WebAssembly thread, the extension extracts key clauses concerning data retention, liability waivers, arbitration mandates, and third-party sharing.

Risk Scoring Engine: The extracted clauses are scored against an open-source risk taxonomy, assigning a clean Privacy Score from A (Highly Privacy-Friendly) to F (Severe Privacy Risks).

Interactive Overlay: An unobtrusive drawer slides onto the page highlighting red-flag clauses and green-flag commitments, complete with short, plain-English summaries.

Demo
Watch the Demo Video:


If the embed doesn't load, you can watch the video on Loom here.

GitHub Repository:


Key Features Shown in the Demo
Automatic Detection: As soon as you open a legal page (like the GitHub Terms of Service), TermsLens displays a floating shield icon in the bottom-right corner showing the calculated grade (e.g., Grade A).

1-Click Breakdown: Clicking the shield expands a breakdown divided into categories like Account Control, Data Privacy, and Legal Rights.

Direct Excerpts: The extension pulls exact, italicized excerpts directly from the page so you can see exactly what you are agreeing to.

Partner Technologies
We leveraged MongoDB Atlas to make TermsLens fast and efficient.

MongoDB Atlas
Usage: We utilized MongoDB Atlas as our cloud database via the Atlas Data API to store pre-computed risk metrics and vector embeddings of known standardized privacy templates.

Experience: Running heavy NLP models locally in a browser can be resource-intensive. MongoDB Atlas allowed us to quickly fetch baseline risk metrics when a user visits popular, highly trafficked sites, drastically reducing the need to run local inference every single time. By interacting with the database using standard HTTP fetch() requests directly from our Chrome Extension's background service worker, we bypassed the need for a dedicated backend server entirely.

Hackathon Experience
Building TermsLens during the MLH Hackathon was an incredible exercise in bridging the gap between full-stack architecture and legal compliance.

The Atmosphere: The energy was unmatched. The community channels were filled with hackers exchanging fast feedback on WebExtension APIs and database schemas, which kept the momentum high throughout the build.

The Challenges: Navigating the strict security policies of Chrome Extension Manifest V3 was tough. We quickly learned that we couldn't use standard Node.js database drivers in a browser environment, which led us to successfully pivot to using the MongoDB Atlas Data API.

Favorite Memory: The "aha!" moment when the content script successfully passed the scraped page text to our local risk taxonomy engine, and the floating UI badge correctly calculated its first 90/100 Privacy Score on a live website.

Top comments (0)