Skip to content

SusmitBhamare/ClearClause

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

47 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ ClearClause AI

Intelligent Contract Analysis Platform
Transform how legal professionals handle contracts with AI-powered analysis, risk assessment, and automated insights.

Next.js React Node.js MongoDB TypeScript


πŸ“‹ Table of Contents


✨ Features

πŸ” AI-Powered Contract Analysis

  • Intelligent Document Processing: Upload PDF, DOCX, or TXT files
  • Automatic Contract Type Detection: AI identifies contract types (Employment, NDA, Sales, etc.)
  • Risk Assessment: Comprehensive risk analysis with severity levels
  • Opportunity Identification: Discover potential benefits and advantages
  • Key Clause Extraction: Automatically identify and highlight important clauses

πŸ“Š Advanced Analytics

  • Overall Score: AI-generated contract favorability score (1-100)
  • Visual Charts: Interactive charts and graphs for data visualization
  • Detailed Reports: Comprehensive analysis reports with actionable insights
  • Export Capabilities: Download analysis results in multiple formats

πŸ” Security & Authentication

  • OAuth2 Integration: Secure Google authentication
  • Session Management: Robust session handling with Redis
  • Data Encryption: End-to-end encryption for sensitive documents
  • User Privacy: GDPR-compliant data handling

πŸ’³ Payment Integration

  • Stripe Integration: Secure payment processing
  • Subscription Plans: Free and premium tiers
  • Usage Tracking: Monitor API usage and limits

πŸ› οΈ Tech Stack

Frontend

  • Next.js 15.2.4 - React framework with App Router
  • React 19.0.0 - UI library
  • TypeScript 5.8.2 - Type safety
  • Tailwind CSS - Utility-first CSS framework
  • Framer Motion - Animation library
  • Lucide React - Icon library
  • React Query - Data fetching and caching
  • Zustand - State management

Backend

  • Node.js - JavaScript runtime
  • Express.js - Web framework
  • TypeScript - Type safety
  • MongoDB - NoSQL database
  • Mongoose - MongoDB ODM
  • Redis - Caching and session storage
  • Passport.js - Authentication middleware

AI & ML

  • Google Gemini API - Advanced AI model for contract analysis
  • PDF.js - PDF text extraction
  • NLP Processing - Natural language processing

Infrastructure

  • Upstash Redis - Redis-as-a-Service
  • MongoDB Atlas - Cloud database
  • Stripe - Payment processing
  • Resend - Email service

πŸš€ Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • MongoDB database
  • Redis instance
  • Google Gemini API key
  • Stripe account (for payments)

Quick Start

  1. Clone the repository

    git clone https://github.com/SusmitBhamare/ClearClause.git
    cd ClearClause
  2. Install dependencies

    # Install server dependencies
    cd server
    npm install
    
    # Install client dependencies
    cd ../client
    npm install
  3. Set up environment variables

    # Server (.env)
    GOOGLE_GENAI_API_KEY=your_gemini_api_key
    MONGODB_URI=your_mongodb_connection_string
    UPSTASH_REDIS_URL=your_redis_url
    UPSTASH_REDIS_TOKEN=your_redis_token
    CLIENT_URL=http://localhost:3000
    PORT=8080
    
    # Client (.env.local)
    NEXT_PUBLIC_API_URL=http://localhost:8080
  4. Start the development servers

    # Start server (from server directory)
    npm run dev
    
    # Start client (from client directory)
    npm run dev
  5. Open your browser


🎯 Usage

1. Upload Contract

  • Navigate to the dashboard
  • Drag and drop your contract file (PDF, DOCX, TXT)
  • Wait for AI analysis to complete

2. Review Analysis

  • View contract type detection
  • Examine risk assessment with severity levels
  • Review opportunity analysis
  • Check overall favorability score

3. Export Results

  • Download comprehensive analysis report
  • Share insights with team members
  • Use data for contract negotiations

4. Manage Subscriptions

  • Upgrade to premium for advanced features
  • Monitor usage and billing
  • Access priority support

πŸ”§ API Endpoints

Authentication

POST /auth/google          # Google OAuth login
GET  /auth/current-user    # Get current user
POST /auth/logout          # Logout user

Contracts

POST /contracts/detect-type # Detect contract type
POST /contracts/analyze     # Analyze contract
GET  /contracts/user-contracts # Get user's contracts
GET  /contracts/contract/:id   # Get specific contract

Payments

POST /payment/create-checkout-session # Create Stripe session
POST /payment/webhook                 # Stripe webhook

πŸ“ Project Structure

ClearClause/
β”œβ”€β”€ client/                 # Next.js frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/           # App Router pages
β”‚   β”‚   β”œβ”€β”€ components/    # React components
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom hooks
β”‚   β”‚   β”œβ”€β”€ interfaces/    # TypeScript interfaces
β”‚   β”‚   β”œβ”€β”€ lib/          # Utility functions
β”‚   β”‚   β”œβ”€β”€ providers/    # Context providers
β”‚   β”‚   └── store/        # Zustand store
β”‚   β”œβ”€β”€ public/           # Static assets
β”‚   └── package.json
β”œβ”€β”€ server/                # Express.js backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/       # Configuration files
β”‚   β”‚   β”œβ”€β”€ controllers/  # Route controllers
β”‚   β”‚   β”œβ”€β”€ middleware/   # Express middleware
β”‚   β”‚   β”œβ”€β”€ models/       # Mongoose models
β”‚   β”‚   β”œβ”€β”€ routes/       # API routes
β”‚   β”‚   β”œβ”€β”€ services/     # Business logic
β”‚   β”‚   └── utils/        # Utility functions
β”‚   └── package.json
└── README.md

⭐ Star this repository if you found it helpful!

GitHub stars GitHub forks GitHub issues

About

AI-powered contract analysis platform that automatically detects contract types, analyzes risks and opportunities, and provides comprehensive insights using AI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors