AI-powered legal document analysis that translates complex contracts into plain English with risk assessments.
PaiperSum is a production-ready SaaS platform that helps individuals and businesses understand legal documents by automatically identifying risks, highlighting important clauses, and providing plain-English summaries.
- π Automated Analysis - Instant risk assessment of legal documents
- π Risk Scoring - 0-100 risk score with confidence metrics
- π― Clause Detection - Identifies 14+ types of important clauses
- π Plain English - Complex legalese translated into readable summaries
- π PDF Export - Professional reports with citations
- π Browser Extension - Analyze any webpage instantly
- π± Responsive UI - Beautiful, accessible interface
- Terms of Service / EULA
- Privacy Policies
- Contracts & Agreements
- Waivers & Releases
- NDAs & Confidentiality Agreements
- Employment Agreements
- Rental/Lease Agreements
- β High Risk (Red): Indemnification, Liability Waivers, Assumption of Risk
β οΈ Moderate Risk (Yellow): Arbitration, Class Action Waivers, Auto-Renewal, Data Sharing- β Low Risk (Green): Governing Law, Termination, Force Majeure
# 1. Clone the repository
git clone https://github.com/yourusername/paipersum.git
cd paipersum
# 2. Install dependencies
npm install
# 3. Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# 4. Start the API
cd apps/api
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload
# 5. In a new terminal, start the web app
cd apps/web
npm install
npm run dev
# 6. Open http://localhost:5173 in your browser# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downServices will be available at:
- Web App: http://localhost:5173
- API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- MinIO Console: http://localhost:9001 (minio/minio12345)
paipersum/
βββ apps/
β βββ web/ # React + Vite frontend
β β βββ src/
β β β βββ components/ # Reusable UI components
β β β βββ lib/ # API client, schemas
β β β βββ pages/ # Page components
β β β βββ App.tsx # Main application
β β β βββ main.tsx # Entry point
β β βββ public/ # Static assets, legal pages
β β βββ package.json
β β
β βββ api/ # FastAPI backend
β β βββ main.py # FastAPI application
β β βββ obs.py # Observability & logging
β β βββ security.py # Rate limiting, headers
β β βββ ingest.py # PDF/OCR processing
β β βββ report.py # PDF report generation
β β βββ requirements.txt
β β
β βββ extension/ # Browser extension
β βββ src/
β β βββ content.ts # Content script
β βββ public/
β βββ manifest.json
β
βββ docker-compose.yml # Local development stack
βββ .github/workflows/ # CI/CD pipelines
βββ README.md
- React 18 - UI framework
- TypeScript - Type safety
- Vite - Build tool & dev server
- Tailwind CSS - Styling & design system
- Zod - Runtime type validation
- Axios - HTTP client
- FastAPI - High-performance Python API
- Pydantic - Data validation
- PDFMiner - PDF text extraction
- Tesseract - OCR for scanned documents
- FPDF - PDF report generation
- PostgreSQL - Database (optional, for auth)
- Redis - Caching & rate limiting
- MinIO - S3-compatible object storage
- Docker - Containerization
- GitHub Actions - CI/CD
- Uvicorn - ASGI server
- Paste Text: Copy legal text directly into the textarea
- Upload File: Drag & drop or select PDF, DOC, DOCX, TXT files
- Analyze: Click "Analyze" to process the document
- Review Results: See risk score, confidence, and detected clauses
- Export PDF: Download a professional report
-
Install:
cd apps/extension npm install npm run build -
Load in Chrome:
- Open
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select
apps/extension/distfolder
- Open
-
Use:
- Navigate to any webpage with legal text
- Look for the PaiperSum panel in the top-right
- Click "Analyze This Page"
# Analyze text
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"text": "I agree to indemnify and hold harmless..."}'
# Analyze file
curl -X POST http://localhost:8000/analyze-file \
-F "[email protected]"
# Export PDF report
curl -X POST http://localhost:8000/export/pdf \
-H "Content-Type: application/json" \
-d '{"text": "..."}' \
--output report.pdfAPI Documentation: http://localhost:8000/docs
Create .env file in the root directory:
# API Configuration
DATABASE_URL=postgresql+psycopg://ps:ps@localhost:5432/paipersum
REDIS_URL=redis://localhost:6379
S3_ENDPOINT=http://localhost:9000
S3_ACCESS_KEY=minio
S3_SECRET_KEY=minio12345
S3_BUCKET=paipersum
JWT_SECRET=your-secret-key-change-in-production
STRIPE_SECRET=sk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx
SENTRY_DSN=https://[email protected]/xxx
ALLOWED_ORIGINS=*
# Web Configuration
VITE_API_URL=http://localhost:8000Add Custom Clauses (apps/api/main.py):
RULES = [
(r"your-regex-pattern", "Clause Title", "Plain English summary", 'risk-level'),
# risk-level: 'red', 'yellow', or 'green'
]Adjust Risk Weights (apps/api/main.py):
RISK_WEIGHTS = {'red': 30, 'yellow': 12, 'green': 4}Rate Limiting (apps/api/security.py):
WINDOW = 10 # seconds
LIMIT = 30 # requests per window# Run all tests
npm test
# Test specific app
npm --workspace apps/web test- Text analysis with sample contract
- File upload (PDF, DOCX, TXT)
- Large file handling (>1MB)
- Invalid file format rejection
- PDF export functionality
- Browser extension on various sites
- Mobile responsiveness
- Accessibility (keyboard navigation, screen readers)
# Build images
docker-compose -f docker-compose.yml build
# Run in production mode
docker-compose -f docker-compose.yml up -d
# View logs
docker-compose logs -f api web
# Scale workers
docker-compose up -d --scale api=3# Install flyctl
curl -L https://fly.io/install.sh | sh
# Login
flyctl auth login
# Deploy API
cd apps/api
flyctl launch
flyctl deploy
# Deploy Web
cd ../web
flyctl launch
flyctl deploy- Connect your GitHub repository
- Create new Web Service for API
- Build Command:
pip install -r requirements.txt - Start Command:
uvicorn main:app --host 0.0.0.0 --port $PORT
- Build Command:
- Create new Static Site for Web
- Build Command:
cd apps/web && npm install && npm run build - Publish Directory:
apps/web/dist
- Build Command:
# Install Railway CLI
npm i -g @railway/cli
# Login and deploy
railway login
railway init
railway up- β HTTPS encryption (in production)
- β Rate limiting (30 req/10sec per IP)
- β Security headers (CSP, HSTS, X-Frame-Options)
- β Input validation & sanitization
- β File upload restrictions (type, size)
- β Request ID tracking
- β Structured logging
- β Error handling without data leaks
- β Not Legal Advice Disclaimer - Prominent throughout UI
- β
Terms of Service -
/terms.html - β
Privacy Policy -
/privacy.html - β GDPR Compliant - Data minimization, right to deletion
- β CCPA Compliant - California privacy rights
- β No Attorney-Client Relationship - Clear disclosure
- π Documents not stored by default (processed in memory)
- π TLS encryption in transit
- π No human review of your documents
- π Analysis results deleted after 90 days (configurable)
PaiperSum provides automated document analysis for informational purposes only. This service:
- Does NOT constitute legal advice
- Does NOT create an attorney-client relationship
- May miss important clauses or misinterpret legal language
- Should NOT be relied upon for legal decisions
- Is NOT a substitute for consultation with a licensed attorney
Always consult a qualified attorney licensed in your jurisdiction before making legal decisions.
| Tier | Price | Features |
|---|---|---|
| Free | $0 | 30 documents/month, basic analysis |
| Pro | $12/mo | Unlimited documents, PDF export, priority support |
| Team | $39/user/mo | Collaboration, API access, custom clauses |
| Enterprise | Custom | SLA, dedicated support, on-premise deployment |
See apps/api/billing.py for webhook handlers and checkout flow.
We welcome contributions! Please see CONTRIBUTING.md for details.
# Fork the repo
# Create a feature branch
git checkout -b feature/amazing-feature
# Make your changes
# Commit with clear messages
git commit -m "Add amazing feature"
# Push to your fork
git push origin feature/amazing-feature
# Open a Pull Request- Follow TypeScript/Python style guides
- Add tests for new features
- Update documentation
- Ensure accessibility compliance
- Add error handling
- Core analysis engine
- Web interface
- PDF export
- Browser extension
- Docker deployment
- Legal compliance pages
- User authentication
- Stripe payment integration
- Document history
- Advanced ML classifier (transformer-based)
- Multi-language support
- Comparison mode (diff two documents)
- Team collaboration features
- API keys for developers
- Webhooks
- OCR improvements
- Mobile apps (iOS/Android)
- Enterprise SSO
- Documentation: docs.paipersum.com
- Email: [email protected]
- Issues: GitHub Issues
- Discord: Join our community
MIT License - see LICENSE file for details.
Copyright Β© 2025 PaiperSum
- Legal clause patterns inspired by ToS;DR
- UI design inspired by modern SaaS best practices
- Built with open-source technologies
- Monthly Active Users (MAU)
- Documents analyzed per day
- Conversion rate (free β paid)
- Average risk score
- Model confidence trends
- API latency (p95, p99)
- Error rates
- Sentry: Error tracking
- OpenTelemetry: Distributed tracing
- Prometheus: Metrics collection
- Grafana: Dashboards
Built with β€οΈ for everyone who's ever clicked "I agree" without reading