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

Getting Started

Prerequisites

  • Node.js 18.0 or later
  • npm or yarn package manager

Installation

  1. Clone the repository
git clone https://github.com/yourusername/doc-insight-ui.git
cd doc-insight-ui
  1. Install dependencies
npm install
# or
yarn install
  1. Create a .env.local file in the root directory with the following content:
NEXT_PUBLIC_API_BASE_URL=http://your-api-endpoint
  1. Start the development server
npm run dev
# or
yarn dev
  1. 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

  1. Document Upload: Users can drag and drop or select a document image to upload.
  2. Template Selection: Users select the type of document (e.g., invoice, receipt, ID card) for targeted extraction.
  3. Text Extraction: The image is sent to the backend service for OCR processing.
  4. Result Visualization: Extracted text is highlighted on the original document with bounding boxes.
  5. 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