Skip to content

About

Full-stack enterprise document intelligence & semantic RAG platform built with Spring Boot, React 19, and PostgreSQL pgvector. Features async non-blocking ingestion, hybrid Groq & Gemini AI pipelines, and sub-millisecond similarity search.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 DocuMind AI

Enterprise Document Intelligence & Semantic RAG Platform


Live Demo API Docs



Java 25 Spring Boot React 19 PostgreSQL pgvector Groq Gemini Docker



A production-ready, multi-tenant Retrieval-Augmented Generation (RAG) platform that ingests enterprise documents (PDF, DOCX, TXT, MD), indexes them using vector embeddings into PostgreSQL (pgvector), and generates high-precision, hallucination-resistant answers with clickable source citations, executive summaries, and LaTeX mathematical rendering.


🌐 Live Application Β· πŸ“– API Documentation Β· πŸ“ System Architecture Β· πŸš€ Getting Started



✨ Feature Highlights

⚑ High-Throughput Async Ingestion

Instant file acceptance with non-blocking vector processing in the background.

  • Zero-Wait Uploads: Immediate 201 Created response while background worker thread handles ingestion.
  • Smart Chunking: TokenTextSplitter with 700-token chunks & 100-token overlap to maintain semantic continuity.
  • Universal Parser: Native Apache PDFBox page extraction + Apache Tika for Word (.docx) and plain text (.txt).

πŸš€ Non-Blocking 🧡 Spring @Async πŸ“„ Page-Aware

πŸ›‘οΈ Production Free-Tier Guardrails

Hardened rate-limit architecture designed to survive free-tier cloud quotas without errors.

  • Safe Batching: 15-chunk micro-batches via batchEmbedContents staying strictly under 30k TPM.
  • Round-Robin Multi-Key: Dynamic API key rotation & instant failover to double throughput.
  • Strict Guardrails: 350-chunk document ceiling (~100–200 pages) with 5s inter-batch pacing for zero 429 errors.

πŸ”‘ Multi-Key Rotation ⏱️ 5s Pacing πŸ›‘οΈ 350-Chunk Cap

πŸ” Deep Semantic Vector Search

Sub-millisecond similarity retrieval powered by pgvector on Neon Cloud.

  • HNSW Indexing: Hierarchical Navigable Small World graphs for ultra-fast approximate nearest neighbor lookups.
  • 768-Dim Embeddings: Google Gemini vector embeddings with Cosine Distance similarity calculation.
  • Strict Metadata Tagging: Every chunk tagged with documentId, chunkIndex, userId, and exact page numbers.

πŸ“ pgvector v0.8.6 ⚑ HNSW Graph 🎯 Cosine Metric

πŸ€– Dual-AI Cognitive Pipeline

Split-engine architecture combining specialized embedding with extreme inference speed.

  • Embedding Engine: Google Gemini 768-dimensional model for dense semantic representation.
  • Reasoning Core: Groq-accelerated qwen3.8-27b on custom LPUs for sub-second streaming answers.
  • Hallucination-Proof: Strict system prompts grounding all answers directly in retrieved document context.

⚑ Groq LPU 🧠 Qwen 3.8 27B πŸ’Ž Gemini Embeddings

🎨 Cyber-Grade Modern Dark UI

High-polish React 19 frontend engineered for developer and research workflows.

  • LaTeX & Code Rendering: Native KaTeX math rendering, syntax-highlighted codeblocks, and markdown tables.
  • Dynamic Status Vault: Real-time polling with glowing neon badges (Indexed, Processing, Failed).
  • Interactive Citations: Clickable references displaying exact chunk text and originating page numbers.

βš›οΈ React 19 🎨 Tailwind CSS πŸ“ KaTeX Math

πŸ” Enterprise Multi-Tenant Security

Isolated data segregation and stateless security out-of-the-box.

  • Stateless JWT: Secure access token authorization with BCrypt password hashing.
  • Tenant Isolation: Strict row-level user partitioning ensuring users only access their own vector data.
  • Production Ready: Containerized Docker deployment with auto-recovering stuck document hooks.

πŸ”’ JWT + BCrypt 🏒 Multi-Tenant 🐳 Dockerized


πŸ“ System Architecture

flowchart TD
    subgraph Client ["πŸ–₯️ Frontend β€” Vercel CDN"]
        UI["React 19 + Vite SPA\nTailwind CSS + Lucide"]
    end

    subgraph CloudBackend ["βš™οΈ Backend β€” Render.com"]
        API["Spring Boot 4.1.2 (Java 25)\nDocker Runtime"]
        SEC["Spring Security + JWT Filter"]
        ASYNC["Async Ingestion Service\n(@Async Thread Pool)"]
        RAG["RAG Orchestration Engine"]
    end

    subgraph DataStore ["πŸ—„οΈ Database β€” Neon Cloud"]
        PG[("PostgreSQL 18")]
        VEC[("pgvector HNSW Index\n768 Dimensions")]
    end

    subgraph AIProviders ["🧠 External AI Services"]
        GEMINI["Google Gemini API\nbatchEmbedContents β€” 768d"]
        GROQ["Groq Cloud\nQwen 3.8-27b Ultra-Fast LLM"]
    end

    UI -->|"HTTPS REST + JWT"| API
    API --> SEC
    SEC --> ASYNC
    SEC --> RAG
    ASYNC -->|"Batch Embeddings"| GEMINI
    ASYNC -->|"Store Vectors"| VEC
    RAG -->|"Cosine Similarity"| VEC
    RAG -->|"Context + Prompt"| GROQ
    GROQ -->|"Streamed Reasoning"| RAG
    RAG -->|"Structured Answer"| UI
Loading

πŸ› οΈ Tech Stack

Layer Technology Purpose
πŸ—οΈ Backend Spring Boot 4.1.2 Β· Java 25 Enterprise microservice runtime
🧠 AI Layer Spring AI 2.0.1 Vector store abstraction & model orchestration
πŸ—„οΈ Database PostgreSQL 18.6 (Neon Cloud) Serverless relational storage
πŸ“Š Vectors pgvector 0.8.6 HNSW cosine similarity (768 dimensions)
πŸ–₯️ Frontend React 19 Β· TypeScript Β· Vite 8 High-performance reactive SPA
🎨 Styling Tailwind CSS v4 Futuristic dark glassmorphic design
🐳 Container Docker (eclipse-temurin:25-jre) Multi-stage production build
☁️ Hosting Render + Vercel + Neon Globally distributed deployment

πŸ“ Project Structure

docu-mind-ai/
β”‚
β”œβ”€β”€ πŸ“¦ docu-mind-ai-backend/            # Spring Boot 4 (Java 25) REST API
β”‚   β”œβ”€β”€ src/main/java/com/documind/
β”‚   β”‚   β”œβ”€β”€ config/                     # AiConfig, SecurityConfig, CorsConfig
β”‚   β”‚   β”œβ”€β”€ controller/                 # Auth, Document, Chat, Search Controllers
β”‚   β”‚   β”œβ”€β”€ dto/                        # Request/Response records
β”‚   β”‚   β”œβ”€β”€ entity/                     # JPA Entities (User, DocumentMetadata)
β”‚   β”‚   β”œβ”€β”€ repository/                 # Spring Data Repositories
β”‚   β”‚   β”œβ”€β”€ service/                    # Document Parsing, Ingestion, RAG Services
β”‚   β”‚   └── filter/                     # JWT Authentication Filter
β”‚   β”œβ”€β”€ src/main/resources/
β”‚   β”‚   β”œβ”€β”€ application.yaml            # Profile router
β”‚   β”‚   β”œβ”€β”€ application-dev.yml         # Local development config
β”‚   β”‚   └── application-prod.yml        # Production configuration
β”‚   β”œβ”€β”€ Dockerfile                      # Multi-stage container build
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ 🎨 docu-mind-ai-frontend/           # React 19 + Vite + Tailwind Client
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/                 # ChatWindow, UploadModal, Navbar, Sidebar
β”‚   β”‚   β”œβ”€β”€ context/                    # AuthContext, ChatContext
β”‚   β”‚   β”œβ”€β”€ hooks/                      # useDocuments, useChat
β”‚   β”‚   β”œβ”€β”€ pages/                      # Dashboard, Chat, Documents, Search, Login
β”‚   β”‚   └── services/                   # Axios API clients
β”‚   β”œβ”€β”€ vercel.json                     # SPA routing configuration
β”‚   └── package.json
β”‚
└── πŸ“„ README.md

πŸš€ Getting Started (Local Development)

Prerequisites

Requirement Version Link
Java JDK 25+ Adoptium Temurin
Node.js 20+ nodejs.org
PostgreSQL 16+ with pgvector postgresql.org
Groq API Key β€” Groq Console
Gemini API Key β€” Google AI Studio

1️⃣ Database Setup

CREATE DATABASE documind;
\c documind;
CREATE EXTENSION IF NOT EXISTS vector;

2️⃣ Backend Setup

cd docu-mind-ai-backend

# Set environment variables (or configure in application-dev.yml)
export GROQ_API_KEY="your-groq-key"
export GEMINI_API_KEY="your-gemini-key"
export JWT_SECRET="your-256-bit-jwt-secret-string"

# Build and run
./mvnw clean spring-boot:run

Backend starts at http://localhost:8080
Swagger UI at http://localhost:8080/swagger-ui.html

3️⃣ Frontend Setup

cd docu-mind-ai-frontend

npm install
npm run dev

Frontend launches at http://localhost:5173


πŸ”’ Environment Variables

Backend β€” application-prod.yml
Variable Description Example
SPRING_PROFILES_ACTIVE Active Spring profile prod
SPRING_DATASOURCE_URL PostgreSQL JDBC URL jdbc:postgresql://host:5432/documind?sslmode=require
SPRING_DATASOURCE_USERNAME Database username neondb_owner
SPRING_DATASOURCE_PASSWORD Database password β€’β€’β€’β€’β€’β€’β€’β€’
GROQ_API_KEY Groq LLM API Key gsk_...
GEMINI_API_KEY Google Gemini API Key AIzaSy...
JWT_SECRET JWT signing secret min-64-character-secret
PORT Server port (Render injected) 8080 / 10000
Frontend β€” .env
Variable Description Example
VITE_API_BASE_URL Backend API base URL https://docu-mind-ai-l4nr.onrender.com

πŸ“‘ Core API Endpoints

Method Endpoint Auth Description
POST /api/v1/auth/register πŸ”“ Register new user account
POST /api/v1/auth/login πŸ”“ Authenticate & issue JWT
POST /api/v1/documents/upload πŸ”’ Upload document & start async ingestion
GET /api/v1/documents πŸ”’ List all user-owned documents
GET /api/v1/documents/{id} πŸ”’ Get document status & metadata
DELETE /api/v1/documents/{id} πŸ”’ Delete document & vector chunks
POST /api/v1/chat πŸ”’ RAG conversational query
POST /api/v1/search/similarity πŸ”’ Direct vector similarity search

πŸ›‘οΈ Production Deployment

flowchart LR
    A["🎨 Frontend\nVite Build"] -->|"Deploy"| B["β–² Vercel\nEdge CDN"]
    C["βš™οΈ Backend\nDocker Image"] -->|"Deploy"| D["🟒 Render.com\nSingapore"]
    D -->|"JDBC"| E["🐘 Neon Cloud\nap-southeast-1"]
Loading
Component Platform Region Notes
Frontend Vercel Edge (Global) Vite build + SPA rewrites
Backend Render.com Singapore Docker, unprivileged spring:spring user
Database Neon.tech ap-southeast-1 Serverless PostgreSQL 18 + pgvector

πŸ‘¨β€πŸ’» Author

Sagar Sharma

GitHub Project


Built with ❀️ by Sagar Sharma

About

Full-stack enterprise document intelligence & semantic RAG platform built with Spring Boot, React 19, and PostgreSQL pgvector. Features async non-blocking ingestion, hybrid Groq & Gemini AI pipelines, and sub-millisecond similarity search.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages