Skip to content

Th-Shivam/Fin-Logic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Fin-Logic: AI-Powered Financial Protection

Expose the Fine Print β€” An intelligent document analyzer that detects predatory clauses, hidden fees, and dark patterns in financial contracts using AI and OCR.

License Node Firebase


πŸ“‹ Table of Contents


🎯 Overview

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)

Why Fin-Logic?

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.


✨ Features

Core Capabilities

  • πŸ“„ 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

UI/UX

  • 🎨 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

πŸ› οΈ Tech Stack

Frontend

  • HTML5 / CSS3 / JavaScript (ES6+)
  • Firebase Client SDK (Authentication & Firestore)
  • Tesseract.js (Client-side OCR for images)

Backend

  • 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)

Infrastructure

  • Firebase Firestore (NoSQL cloud database)
  • Firebase Authentication (Google Sign-In)
  • Render.com (Deployment platform)

πŸš€ Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm (comes with Node.js)
  • Firebase Project (for Auth & Firestore)
  • Groq API Key (Get it here)

Installation

  1. Clone the repository

    git clone https://github.com/Th-Shivam/Fin-Logic.git
    cd Fin-Logic
  2. Install dependencies

    npm install
  3. Configure Environment Variables

    Create a .env file 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
  4. 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.json in the project root
  5. 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;
          }
        }
      }
  6. Run the application

    npm start

    Open http://localhost:3000 in your browser.


🌐 Deployment

Deploy to Render.com (Free Tier)

  1. Push to GitHub (if not already done)

    git add .
    git commit -m "Initial commit"
    git push origin main
  2. 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
  3. Add Environment Variables

    In Render's Environment tab, add all variables from your .env file, plus:

    FIREBASE_SERVICE_ACCOUNT=<paste entire serviceAccountKey.json content here>
    
  4. Deploy

    • Click Create Web Service
    • Wait for deployment to complete
  5. 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

πŸ“ Project Structure

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

⚠️ Disclaimer

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

πŸ“„ License

This project is licensed under the MIT License.


🀝 Contributing

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.


πŸ“§ Contact

Shivam Singh
GitHub: @Th-Shivam


Built with ❀️ for financial transparency

About

An intelligent document analyzer that detects predatory clauses, hidden fees, and dark patterns in financial contracts using AI and OCR.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors