67b77b0f1569b2cfc59b5b0ced911d564ac120d4
- Replace custom JWT auth with Firebase Auth SDK - Add Firebase web app configuration - Implement user registration and login with Firebase - Update backend to use Firebase Admin SDK for token verification - Remove custom auth routes and controllers - Add Firebase Cloud Functions deployment configuration - Update frontend to use Firebase Auth state management - Add registration mode toggle to login form - Configure CORS and deployment for Firebase hosting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
CIM Document Processor
A comprehensive web application for processing and analyzing Confidential Information Memorandums (CIMs) using AI-powered document analysis and the BPCP CIM Review Template.
Features
🔐 Authentication & Security
- Secure user authentication with JWT tokens
- Role-based access control
- Protected routes and API endpoints
- Rate limiting and security headers
📄 Document Processing
- Upload PDF, DOC, and DOCX files (up to 50MB)
- Drag-and-drop file upload interface
- Real-time upload progress tracking
- AI-powered document text extraction
- Automatic document analysis and insights
📊 BPCP CIM Review Template
- Comprehensive review template with 7 sections:
- Deal Overview: Company information, transaction details, and deal context
- Business Description: Core operations, products/services, customer base
- Market & Industry Analysis: Market size, growth, competitive landscape
- Financial Summary: Historical financials, trends, and analysis
- Management Team Overview: Leadership assessment and organizational structure
- Preliminary Investment Thesis: Key attractions, risks, and value creation
- Key Questions & Next Steps: Critical questions and action items
🎯 Document Management
- Document status tracking (pending, processing, completed, error)
- Search and filter documents
- View processed results and extracted data
- Download processed documents and reports
- Retry failed processing jobs
📈 Analytics & Insights
- Document processing statistics
- Financial trend analysis
- Risk and opportunity identification
- Key metrics extraction
- Export capabilities (PDF, JSON)
Technology Stack
Frontend
- React 18 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- React Router for navigation
- React Hook Form for form handling
- React Dropzone for file uploads
- Lucide React for icons
- Axios for API communication
Backend
- Node.js with TypeScript
- Express.js web framework
- PostgreSQL database with migrations
- Redis for job queue and caching
- JWT for authentication
- Multer for file uploads
- Bull for job queue management
- Winston for logging
- Jest for testing
AI & Processing
- OpenAI GPT-4 for document analysis
- Anthropic Claude for advanced text processing
- PDF-parse for PDF text extraction
- Puppeteer for PDF generation
Project Structure
cim_summary/
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── services/ # API services
│ │ ├── contexts/ # React contexts
│ │ ├── utils/ # Utility functions
│ │ └── types/ # TypeScript type definitions
│ └── package.json
├── backend/ # Node.js backend API
│ ├── src/
│ │ ├── controllers/ # API controllers
│ │ ├── models/ # Database models
│ │ ├── services/ # Business logic services
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Express middleware
│ │ └── utils/ # Utility functions
│ └── package.json
└── README.md
Getting Started
Prerequisites
- Node.js 18+ and npm
- PostgreSQL 14+
- Redis 6+
- OpenAI API key
- Anthropic API key
Environment Setup
-
Clone the repository
git clone <repository-url> cd cim_summary -
Backend Setup
cd backend npm install # Copy environment template cp .env.example .env # Edit .env with your configuration # Required variables: # - DATABASE_URL # - REDIS_URL # - JWT_SECRET # - OPENAI_API_KEY # - ANTHROPIC_API_KEY -
Frontend Setup
cd frontend npm install # Copy environment template cp .env.example .env # Edit .env with your configuration # Required variables: # - VITE_API_URL (backend API URL)
Database Setup
-
Create PostgreSQL database
CREATE DATABASE cim_processor; -
Run migrations
cd backend npm run db:migrate -
Seed initial data (optional)
npm run db:seed
Running the Application
-
Start Redis
redis-server -
Start Backend
cd backend npm run devBackend will be available at
http://localhost:5000 -
Start Frontend
cd frontend npm run devFrontend will be available at
http://localhost:3000
Usage
1. Authentication
- Navigate to the login page
- Use the seeded admin account or create a new user
- JWT tokens are automatically managed
2. Document Upload
- Go to the "Upload" tab
- Drag and drop CIM documents (PDF, DOC, DOCX)
- Monitor upload and processing progress
- Files are automatically queued for AI processing
3. Document Review
- View processed documents in the "Documents" tab
- Click "View" to open the document viewer
- Access the BPCP CIM Review Template
- Fill out the comprehensive review sections
4. Analysis & Export
- Review extracted financial data and insights
- Complete the investment thesis
- Export review as PDF
- Download processed documents
API Endpoints
Authentication
POST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/auth/logout- User logout
Documents
GET /api/documents- List user documentsPOST /api/documents/upload- Upload documentGET /api/documents/:id- Get document detailsGET /api/documents/:id/status- Get processing statusGET /api/documents/:id/download- Download documentDELETE /api/documents/:id- Delete documentPOST /api/documents/:id/retry- Retry processing
Reviews
GET /api/documents/:id/review- Get CIM review dataPOST /api/documents/:id/review- Save CIM reviewGET /api/documents/:id/export- Export review as PDF
Development
Running Tests
# Backend tests
cd backend
npm test
# Frontend tests
cd frontend
npm test
Code Quality
# Backend linting
cd backend
npm run lint
# Frontend linting
cd frontend
npm run lint
Database Migrations
cd backend
npm run db:migrate # Run migrations
npm run db:seed # Seed data
Configuration
Environment Variables
Backend (.env)
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/cim_processor
# Redis
REDIS_URL=redis://localhost:6379
# Authentication
JWT_SECRET=your-secret-key
# AI Services
OPENAI_API_KEY=your-openai-key
ANTHROPIC_API_KEY=your-anthropic-key
# Server
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000
Frontend (.env)
VITE_API_URL=http://localhost:5000/api
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support and questions, please contact the development team or create an issue in the repository.
Acknowledgments
- BPCP for the CIM Review Template
- OpenAI for GPT-4 integration
- Anthropic for Claude integration
- The open-source community for the excellent tools and libraries used in this project
Description
Languages
TypeScript
92.2%
JavaScript
3.7%
PLpgSQL
3.1%
Shell
1%