A powerful Next.js 14 application for AI-powered legal document analysis, featuring document upload, intelligent insights, and interactive Q&A capabilities.
- Document Upload: Drag & drop or file selection for PDF/DOCX documents
- AI Analysis: Intelligent document analysis with risk assessment and compliance scoring
- Interactive Panels: Resizable document viewer, insights panel, and Q&A assistant
- Dark Mode: Beautiful dark/light theme toggle
- Responsive Design: Works seamlessly across desktop and mobile devices
- Mock API: Built-in mock API for development and demonstration
- Real API Ready: Prepared for integration with FastAPI backend
- Frontend: Next.js 14 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- Icons: Lucide React
- State Management: React hooks and context
- File Handling: React Dropzone
frontend/ # Frontend Next.js application
βββ src/
β βββ app/ # Next.js 14 App Router
β β βββ layout.tsx # Root layout with theme provider
β β βββ page.tsx # Home page (redirects to upload)
β β βββ upload/ # Document upload page
β β βββ workspace/ # Main analysis workspace
β β βββ settings/ # Configuration and settings
β βββ components/ # Reusable React components
β β βββ Layout.tsx # Shared layout component
β β βββ ThemeToggle.tsx # Dark/light mode toggle
β β βββ DocumentUpload.tsx # File upload component
β β βββ ResizableDivider.tsx # Panel resize functionality
β β βββ panels/ # Analysis panel components
β β βββ DocumentPanel.tsx
β β βββ InsightsPanel.tsx
β β βββ QAPanel.tsx
β βββ context/ # React context providers
β β βββ ThemeContext.tsx # Theme state management
β βββ lib/ # Utility functions
β β βββ api.ts # API calls (mock & real)
β β βββ theme.ts # Material UI theme configuration
β βββ styles/ # Global styles
β βββ globals.css # Tailwind CSS imports
βββ package.json # Frontend dependencies
βββ next.config.js # Next.js configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
backend/ # FastAPI Python backend
βββ ai/ # AI processing modules
βββ auth/ # Authentication system
βββ documents/ # Document processing
βββ utils/ # Utility functions
βββ main.py # FastAPI application entry
βββ requirements.txt # Python dependencies
- Node.js 18+
- npm or yarn package manager
-
Clone or navigate to the project directory
cd documint-frontend -
Install dependencies
npm install # or yarn install -
Configure environment variables
cp frontend/.env.example frontend/.env.local
Edit
frontend/.env.localto customize API endpoints and configuration:NEXT_PUBLIC_BACKEND_BASE_URL=http://localhost:8000 NEXT_PUBLIC_BACKEND_UPLOAD_ENDPOINT=/upload NEXT_PUBLIC_BACKEND_PROCESS_ENDPOINT=/api/v1/process-document NEXT_PUBLIC_BACKEND_QA_ENDPOINT=/api/v1/qa NEXT_PUBLIC_BACKEND_OCR_ENDPOINT=/api/v1/ocr NEXT_PUBLIC_MAX_FILE_SIZE=10485760 NEXT_PUBLIC_SUPPORTED_FORMATS=.pdf,.doc,.docx
-
Start the development server
cd frontend npm run dev # or yarn dev
-
Open your browser Navigate to http://localhost:3000
- Drag and drop PDF or DOCX files
- Or click to browse and select files
- Files are automatically processed and analyzed
- Redirects to workspace after successful upload
- Document Panel: View your uploaded document content
- AI Insights Panel: Risk assessment, compliance issues, and suggestions
- Q&A Panel: Ask questions about your document and get AI-powered answers
- Resizable Panels: Drag dividers to adjust panel sizes
- Panel Controls: Expand, minimize, or restore panels
- API Mode: Switch between mock API (demo) and real FastAPI backend
- Data Management: Clear locally stored data and preferences
- About: Information about the platform and technologies used
The application uses environment variables for configuration. Copy .env.example to .env.local and customize:
# Backend API Configuration
NEXT_PUBLIC_BACKEND_BASE_URL=http://localhost:8000 # Backend server URL
NEXT_PUBLIC_BACKEND_UPLOAD_ENDPOINT=/upload # File upload endpoint
NEXT_PUBLIC_BACKEND_PROCESS_ENDPOINT=/api/v1/process-document # Document processing endpoint
NEXT_PUBLIC_BACKEND_QA_ENDPOINT=/api/v1/qa # Q&A endpoint
NEXT_PUBLIC_BACKEND_OCR_ENDPOINT=/api/v1/ocr # OCR text extraction endpoint
# Frontend Configuration
NEXT_PUBLIC_FRONTEND_PORT=3000 # Frontend development port
# App Configuration
NEXT_PUBLIC_MAX_FILE_SIZE=10485760 # Max file size in bytes (10MB)
NEXT_PUBLIC_SUPPORTED_FORMATS=.pdf,.doc,.docx # Supported file formatsThe application includes a built-in mock API that simulates real backend responses:
- Instant responses with sample data
- No external dependencies required
- Perfect for development and testing
To connect to a real backend, enable "Real FastAPI Backend" in settings:
- Requires a running FastAPI server
- Uses environment variables for endpoint configuration
- Expected endpoints (configurable via .env):
POST ${NEXT_PUBLIC_BACKEND_BASE_URL}${NEXT_PUBLIC_BACKEND_UPLOAD_ENDPOINT}- File uploadPOST ${NEXT_PUBLIC_BACKEND_BASE_URL}${NEXT_PUBLIC_BACKEND_PROCESS_ENDPOINT}- Document analysisPOST ${NEXT_PUBLIC_BACKEND_BASE_URL}${NEXT_PUBLIC_BACKEND_QA_ENDPOINT}- Question answeringPOST ${NEXT_PUBLIC_BACKEND_BASE_URL}${NEXT_PUBLIC_BACKEND_OCR_ENDPOINT}- OCR text extraction
The application features a comprehensive dark/light theme system:
- Light Theme: Clean, professional appearance
- Dark Theme: Easy on the eyes for extended use
- System Preference: Automatically detects user's system preference
- Persistent: Theme choice is saved in localStorage
Optimized for various screen sizes:
- Desktop: Full panel layout with resizable dividers
- Tablet: Stacked panels with touch-friendly controls
- Mobile: Single-column layout with panel navigation
- Local Storage: Documents and analysis results stored locally
- Privacy: No data sent to external servers in mock mode
- Security: File validation and size limits enforced
- Cleanup: Easy data clearing through settings page
cd frontend
npm run build
vercel --prodcd frontend
npm run build
npm start- 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
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Next.js 14 and the React ecosystem
- Icons provided by Lucide React
- Styling powered by Tailwind CSS
- TypeScript for type safety and better developer experience
For support, questions, or feature requests, please open an issue on the GitHub repository.
DocuMint AI - Revolutionizing legal document analysis with AI-powered insights. π