Skip to content

Repository files navigation

ContractChill

AI-Powered Legal Document Analyzer
Instantly review, identify risks, and understand complex contracts with AI-driven analysis.
Built for freelancers, founders, and anyone who signs agreements but isn't a lawyer.

React Vite TypeScript Express Firebase Gemini Tailwind Railway


Overview

ContractChill transforms complex legal documents into clear, actionable insights. Upload a contract (PDF, DOCX, or TXT), and the AI delivers a structured breakdown with risk flags, plain-language summaries, and negotiation scripts — all tailored to your preferred persona.

Key Features

  • Multi-Persona AI Analysis — Choose from four communication styles: Chill Friend (casual), Angry Lawyer (strict), Corporate Mentor (strategic), or Freelancer Senior (practical). Personas auto-detect English or Indonesian.
  • Red Flag Detection — Clauses flagged as High, Medium, or Safe risk with plain-English explanations.
  • Clause Summaries & Jargon Definitions — Every clause broken down in clear language. Legal terms explained in context.
  • Negotiation Scripts — Generate email or chat drafts to negotiate specific clauses, in the persona's tone.
  • AI Chat — Follow-up Q&A about any analyzed contract.
  • Contract Generator — Draft full contracts from scratch based on project details.
  • Side-by-Side Viewer — Original contract and AI analysis displayed simultaneously.
  • Analysis History — All past analyses saved in Firestore, searchable and filterable by persona.
  • Command Palette⌘K quick navigation to any page.
  • Analytics Dashboard — Visual insights into your contract analysis history.
  • Dark / Light / System Theme — Persistent preference with automatic system detection.
  • PWA Support — Installable as a standalone app with offline fallback.
  • Bilingual — Full English and Indonesian language support.

Tech Stack

Layer Technology
Frontend React 19, TypeScript 6, Vite 8
Styling Tailwind CSS 4, shadcn/ui, beUI
Animation Framer Motion 12
Backend Node.js, Express 5, TypeScript 6
AI Engine Google Gemini 2.5 Flash
Auth Firebase Authentication (email/password + Google)
Database Firestore (NoSQL)
PDF react-pdf-viewer, pdf-parse, jspdf
Icons lucide-react
Notifications sonner
HTTP axios (client), cors + helmet (server)
Container Docker (multi-stage build)

Architecture

contract-chill/
├── client/                  # React SPA
│   ├── src/
│   │   ├── components/      # UI components (motion + base)
│   │   ├── pages/           # Route-level views
│   │   ├── contexts/        # Auth, Theme, Sidebar
│   │   ├── hooks/           # Custom React hooks
│   │   ├── services/        # API client with Firebase auth interceptor
│   │   └── lib/             # Firebase init, utilities
│   └── vite.config.ts
├── server/                  # Express API
│   ├── src/
│   │   ├── controllers/     # Request handlers
│   │   ├── services/        # Gemini AI integration with persona prompts
│   │   ├── middleware/       # Firebase token verification
│   │   ├── types/           # Shared TypeScript types
│   │   └── utils/           # AppError, asyncHandler, file helpers
│   └── index.ts
├── shared/                  # Shared types between client and server
├── Dockerfile               # Multi-stage production build
└── .env.example             # Environment variable reference

Development: Vite dev server (:5173) proxies API calls to Express (:5000).

Production: Express serves the built client assets from client/dist/. All API routes are prefixed with /api.


Getting Started

Prerequisites

  • Node.js 20+
  • Firebase project (Auth + Firestore enabled)
  • Google Gemini API key

Setup

git clone https://github.com/your-org/contract-chill.git
cd contract-chill

# Install workspace dependencies
npm install

# Copy environment variables and fill in your values
cp .env.example client/.env
cp .env.example server/.env

Refer to .env.example for all required variables.

Run Locally

# Starts both client (:5173) and server (:5000) concurrently
npm run dev

Open http://localhost:5173.

Docker

docker build -t contract-chill .
docker run -p 8080:8080 --env-file .env contract-chill

Deployment

Deployed on Railway via the included Dockerfile. Railway auto-deploys from GitHub on push to the default branch.

Environment variables required in production:

Variable Description
GEMINI_API_KEY Google Gemini API key
FIREBASE_SERVICE_ACCOUNT Firebase Admin SDK service account JSON
VITE_FIREBASE_* Firebase Web SDK config values
PORT Server port (Railway sets this automatically)
NODE_ENV Set to production

Design

  • Font: Geist Variable (sans) + Geist Mono (code)
  • Palette: Warm monochrome — off-white backgrounds, near-black text, subtle warm-gray borders
  • Components: beUI motion components + shadcn/ui primitives
  • Animations: Framer Motion — page transitions, stagger reveals, micro-interactions
  • Theme: Light, Dark, and System modes persisted in localStorage

License

All Rights Reserved.

Copyright (c) 2026 ContractChill. This source code is provided for viewing and reference purposes only. See the LICENSE file for details.

About

AI-powered contract analyzer & generator — detect red flags, translate legal jargon, and draft negotiation scripts instantly.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages