Doc Insight UI
May 21, 2025 ยท View on GitHub
Doc Insight UI is a modern web application for extracting and analyzing information from document images using OCR (Optical Character Recognition) technology.
Features
- ๐ Upload document images for information extraction
- ๐ Automatic text detection and highlighting
- ๐ Extract structured data from documents
- ๐ง Smart template-based extraction for different document types
- ๐ผ๏ธ Real-time document preview with text highlighting
- ๐ฑ Responsive design works on desktop and mobile
Tech Stack
- Framework: Next.js 15
- UI: React 19 with Tailwind CSS
- Language: TypeScript
- API Integration: RESTful API communication with backend OCR service
Getting Started
Prerequisites
- Node.js 18.0 or later
- npm or yarn package manager
Installation
- Clone the repository
git clone https://github.com/yourusername/doc-insight-ui.git
cd doc-insight-ui
- Install dependencies
npm install
# or
yarn install
- Create a
.env.localfile in the root directory with the following content:
NEXT_PUBLIC_API_BASE_URL=http://your-api-endpoint
- Start the development server
npm run dev
# or
yarn dev
- Open http://localhost:3000 in your browser
Building for Production
npm run build:prod
npm run start:prod
# or
yarn build:prod
yarn start:prod
Project Structure
doc-insight-ui/
โโโ app/ # Next.js app directory
โ โโโ api/ # API routes
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Home page
โ โโโ globals.css # Global styles
โโโ components/ # React components
โ โโโ ExtractionResult.tsx
โ โโโ FileUpload.tsx
โ โโโ TemplateSelector.tsx
โ โโโ TextHighlighter.tsx
โโโ hooks/ # Custom React hooks
โ โโโ useExtraction.ts
โโโ services/ # API services
โ โโโ api.ts
โโโ types/ # TypeScript type definitions
โ โโโ index.ts
โโโ utils/ # Utility functions
How It Works
- Document Upload: Users can drag and drop or select a document image to upload.
- Template Selection: Users select the type of document (e.g., invoice, receipt, ID card) for targeted extraction.
- Text Extraction: The image is sent to the backend service for OCR processing.
- Result Visualization: Extracted text is highlighted on the original document with bounding boxes.
- Data Processing: Structured data is extracted according to the selected template.
Environment Variables
NEXT_PUBLIC_API_BASE_URL: URL of the backend OCR/extraction service