Expose the Fine Print β An intelligent document analyzer that detects predatory clauses, hidden fees, and dark patterns in financial contracts using AI and OCR.
Fin-Logic is an AI-powered tool designed to protect users from predatory financial clauses hidden in contracts, loan agreements, and terms of service. It uses a dual-layer analysis engine combining regex pattern matching with Large Language Models (Groq AI) to identify risks like:
- π¨ Hidden Fees (Processing charges, late payment penalties)
- π Auto-Renewal Traps (Subscription lock-ins)
- π Variable Interest Rates (APR changes without notice)
- π Forced Arbitration (Waiving legal rights)
- π΅οΈ Data Privacy Violations (Selling personal data)
Most users sign financial documents without understanding the risks. Fin-Logic acts as a personal digital lawyer, translating complex legalese into simple English, estimating potential financial loss, and suggesting safer alternatives.
- π Universal Document Parsing: Supports PDF uploads, image uploads (OCR via Tesseract.js), and direct text paste
- π§ Hybrid Risk Detection:
- Regex Heuristics: Instant flagging of known predatory patterns
- LLM Analysis (Groq): Deep contextual understanding and safer rewrites
- π° Financial Loss Estimator: Calculates potential monetary cost of vague terms
- βοΈ Simplify & Rewrite: Explains clauses in plain English and generates "Safer Versions"
- π Smart History Vault: Securely stores past analyses using Cloud Firestore
- π Secure Authentication: Google Sign-In integration via Firebase Auth
- π¨ Premium Glassmorphism Design: Animated backgrounds, neon accents, and smooth transitions
- π± Fully Responsive: Works seamlessly on desktop, tablet, and mobile
- β‘ Real-time Analysis: Instant feedback with loading animations
- HTML5 / CSS3 / JavaScript (ES6+)
- Firebase Client SDK (Authentication & Firestore)
- Tesseract.js (Client-side OCR for images)
- Node.js with Express.js
- Multer (File upload handling)
- pdf-parse (PDF text extraction)
- Groq SDK (AI-powered clause analysis)
- Firebase Admin SDK (Server-side authentication & database)
- Firebase Firestore (NoSQL cloud database)
- Firebase Authentication (Google Sign-In)
- Render.com (Deployment platform)
- Node.js (v14 or higher)
- npm (comes with Node.js)
- Firebase Project (for Auth & Firestore)
- Groq API Key (Get it here)
-
Clone the repository
git clone https://github.com/Th-Shivam/Fin-Logic.git cd Fin-Logic -
Install dependencies
npm install
-
Configure Environment Variables
Create a
.envfile in the root directory:# Groq AI API Key GROQ_API_KEY=your_groq_api_key_here # Firebase Configuration (Frontend) FIREBASE_API_KEY=your_firebase_api_key FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com FIREBASE_PROJECT_ID=your-project-id FIREBASE_STORAGE_BUCKET=your-project.firebasestorage.app FIREBASE_MESSAGING_SENDER_ID=your_sender_id FIREBASE_APP_ID=your_app_id FIREBASE_MEASUREMENT_ID=your_measurement_id
-
Add Firebase Service Account Key
- Go to Firebase Console
- Navigate to Project Settings β Service Accounts
- Click Generate New Private Key
- Save the file as
serviceAccountKey.jsonin the project root
-
Enable Firebase Services
In your Firebase Console:
- Authentication: Enable "Google" sign-in provider
- Firestore Database: Create a database (start in test mode)
- Firestore Rules: Update rules to:
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /users/{userId}/{document=**} { allow read, write: if request.auth != null && request.auth.uid == userId; } } }
-
Run the application
npm start
Open http://localhost:3000 in your browser.
-
Push to GitHub (if not already done)
git add . git commit -m "Initial commit" git push origin main
-
Create Web Service on Render
- Go to Render Dashboard
- Click New + β Web Service
- Connect your GitHub repository
- Configure:
- Build Command:
npm install - Start Command:
node server.js
- Build Command:
-
Add Environment Variables
In Render's Environment tab, add all variables from your
.envfile, plus:FIREBASE_SERVICE_ACCOUNT=<paste entire serviceAccountKey.json content here> -
Deploy
- Click Create Web Service
- Wait for deployment to complete
-
Update Firebase Authorized Domains
- Copy your Render URL (e.g.,
https://fin-logic.onrender.com) - Go to Firebase Console β Authentication β Settings β Authorized Domains
- Add your Render URL
- Copy your Render URL (e.g.,
Fin-Logic/
βββ public/
β βββ index.html # Main HTML file
β βββ style.css # Premium UI styles
β βββ script.js # Frontend logic
β βββ firebase-client.js # Firebase client SDK
βββ analysis.js # OCR & fallback risk detection
βββ preprocessing.js # Regex-based risk patterns
βββ groq-service.js # Groq AI integration
βββ firebase-config.js # Firebase Admin SDK
βββ server.js # Express server
βββ package.json # Dependencies
βββ .env # Environment variables (not committed)
βββ serviceAccountKey.json # Firebase credentials (not committed)
βββ README.md # This file
EDUCATIONAL TOOL ONLY
This tool is for informational and educational purposes only. It does NOT provide legal, financial, or professional advice.
- Results are AI-generated estimates and may not be 100% accurate
- Always verify important financial decisions with your bank, legal advisor, or certified financial professional before taking action
- The developers assume no liability for decisions made based on this tool's output
This project is licensed under the MIT License.
We love your input! We want to make contributing to Fin-Logic as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
Please compile with our Contribution Guidelines before submitting a Pull Request.
Shivam Singh
GitHub: @Th-Shivam