π FULLY IMPLEMENTED - Production-ready SaaS application for AI-powered contract analysis that scans contracts for risks in seconds.
ClauseGuard is now complete with all requested features implemented:
- β Landing Page - Beautiful hero section with "Scan Your Contracts for Risk in Seconds"
- β Authentication - Clerk integration with Google & GitHub OAuth
- β Dashboard - Sidebar navigation (Home, Upload, History, Settings)
- β File Upload - Drag-and-drop for PDF/DOCX/TXT files
- β AI Analysis - IBM Granite models for risk detection and rewrite suggestions
- β History & Analytics - View past uploads with download capabilities
- β Settings - User preferences and account management
- β Cloud Storage - Cloudinary integration for file storage
- β Production Ready - Docker, deployment configs, error handling
- π Clause Summarization - AI-powered contract clause breakdown
β οΈ Risk Detection - Identify risky clauses with severity levels (Safe/Review/Risky)- βοΈ Safe Rewrite Suggestions - Get AI-generated safer alternatives
- π Dashboard - Track upload history and analytics with usage quotas
- π Secure Authentication - OAuth with Google & GitHub via Clerk
- βοΈ Cloud Storage - File storage via Cloudinary
- π± Responsive Design - Works on desktop, tablet, and mobile
- π Production Ready - Complete deployment setup
Frontend:
- React 18 + TypeScript
- Tailwind CSS for styling
- Vite for build tooling
- Clerk Authentication
- Axios for API calls
- React Router for navigation
- React Dropzone for file uploads
- Framer Motion for animations
Backend:
- Express.js + TypeScript
- MongoDB with Mongoose
- IBM Granite AI Models
- Cloudinary Storage
- PDF/DOCX/TXT parsing
- Winston logging
- Helmet security
- CORS configuration
AI Models (IBM Granite):
granite-4b-instruct-v2- Document analysis & risk detectiongranite-8b-instruct-v1- Clause summarizationgranite-code-v1- Rewrite suggestions
git clone <repo-url>
cd ClauseGuard
npm installFrontend (.env):
cp frontend/env.config.example frontend/.envEdit frontend/.env:
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_clerk_key
VITE_API_URL=http://localhost:3001/api
VITE_NODE_ENV=development
Backend (.env):
cp backend/env.config.example backend/.envEdit backend/.env with your actual keys:
PORT=3001
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/clauseguard
CLERK_SECRET_KEY=sk_test_your_clerk_secret
IBM_GRANITE_API_KEY=your_ibm_granite_api_key
IBM_GRANITE_BASE_URL=https://us-south.ml.cloud.ibm.com
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
Option 1: Start both simultaneously
npm run devOption 2: Start individually
# Terminal 1 - Backend
cd backend && npm run dev
# Terminal 2 - Frontend
cd frontend && npm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
- Health Check: http://localhost:3001/health
- Install locally OR use MongoDB Atlas
- Default local connection:
mongodb://localhost:27017/clauseguard
- Sign up at clerk.com
- Create a new application
- Configure OAuth providers (Google, GitHub)
- Get publishable and secret keys
- Apply for IBM Granite API access
- Get your API key and region endpoint
- Models used: granite-4b-instruct-v2, granite-8b-instruct-v1, granite-code-v1
- Sign up at cloudinary.com
- Get cloud name, API key, and secret
- Used for contract file storage
ClauseGuard/
βββ frontend/ # React + TypeScript frontend
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Main application pages
β β βββ lib/ # Utilities and configurations
β β βββ types/ # TypeScript type definitions
β βββ public/ # Static assets
β βββ package.json
βββ backend/ # Express + TypeScript backend
β βββ src/
β β βββ routes/ # API route handlers
β β βββ services/ # Business logic services
β β βββ models/ # MongoDB models
β β βββ middleware/ # Express middleware
β β βββ server.ts # Main server file
β βββ package.json
βββ docker-compose.yml # Docker development setup
βββ vercel.json # Vercel deployment config
βββ deployment-guide.md # Detailed deployment instructions
- Hero section with gradient backgrounds
- Feature cards with animations
- Statistics section
- Call-to-action buttons
- Responsive navigation
- Sidebar navigation with active states
- User statistics and usage tracking
- Recent uploads display
- Quick upload button
- Welcome messages
- Drag-and-drop file upload
- File type validation (PDF, DOCX, TXT)
- Upload progress indicators
- File size limits
- Real-time status updates
- Contract sections in organized cards
- Risk level badges (Safe/Review/Risky)
- Clause summaries
- Rewrite suggestions
- Confidence scores
- Searchable upload history
- Filtering by date and risk level
- Download analysis as PDF
- Pagination for large datasets
- User profile management
- Usage quota tracking
- Account preferences
- API key management
POST /api/auth/webhook- Clerk webhook handlerGET /api/auth/me- Get current user
POST /api/upload- Upload contract fileGET /api/upload/:id- Get upload status
GET /api/analysis/:id- Get analysis resultsPOST /api/analysis/:id/reanalyze- Trigger reanalysis
GET /api/user/profile- Get user profilePUT /api/user/preferences- Update preferencesGET /api/user/usage- Get usage statistics
See deployment-guide.md for comprehensive deployment instructions covering:
- Frontend: Vercel deployment
- Backend: Railway, Render, or DigitalOcean
- Database: MongoDB Atlas
- Domain: Custom domain setup
- SSL: Automatic HTTPS
- Monitoring: Error tracking and analytics
# Run frontend tests
cd frontend && npm test
# Run backend tests
cd backend && npm test
# Run linting
npm run lint- Helmet.js security headers
- CORS configuration
- File upload validation
- Rate limiting
- Input sanitization
- Secure session management
- Environment variable protection
- Code splitting and lazy loading
- Image optimization
- CDN integration via Cloudinary
- Database indexing
- Caching strategies
- Background processing
# Development with Docker
docker-compose up -d
# Production build
docker build -t clauseguard-backend ./backend
docker build -t clauseguard-frontend ./frontendFor setup assistance or deployment questions:
- Check the
deployment-guide.mdfor detailed instructions - Verify all environment variables are properly set
- Ensure all required services (MongoDB, Clerk, IBM Granite, Cloudinary) are configured
MIT License - see LICENSE file for details
ClauseGuard - Making contract analysis accessible and secure for everyone. π‘οΈ