The Story of Document Detective
The Inspiration
Every single day, businesses, universities, and individuals sign thousands of commercial agreements, purchase orders, proposals, and project specifications. Yet, hidden in the fine print, minor contradictions often slip by: a contract specifies Net-30 payment terms, but the purchase order says Net-60; a requirement demands a 24-month warranty, but the quote says 12 months.
Standard AI summarizers are helpful, but they treat documents in isolation—they summarize, they don't audit. Human legal or operational teams spend hours reviewing files page-by-page, making them prone to cognitive fatigue.
My inspiration was simple: Build an automated semantic auditor that does not just summarize, but isolates exactly what does not agree.
How I Built It
I built Document Detective from the ground up as a high-fidelity visual dashboard.
The UI/UX Core
React 19 + TypeScript powers the interface, running on a fast Vite compiler.
To stand out to the judges, I designed a space-obsidian dark HUD theme using:
- Frosted glass panels (
glass-panel) Drifting background ambient glow blobs:
blob-purpleblob-cyanblob-pink
Smooth CSS keyframe animations to create subtle movement and depth
The AI Engine
The AI engine uses Google's Gemini 1.5 Flash API.
I routed requests securely through local Vite/Express middleware, allowing uploaded documents to be compared dynamically while maintaining a controlled development environment.
The Mathematical Scoring Engine
The overall consistency score $C$ is computed using a weighted penalty model based on the severity of the findings.
This allows the system to transform individual discrepancies into an overall, easy-to-understand consistency score.
Challenges I Faced
1. Semantic Mapping of Mismatched Layouts
Documents are rarely structured in the same way.
For example, a contract might describe delivery timelines in Section 4.1, while a purchase order details shipping requirements under Term 2.
I overcame this challenge by using Gemini's JSON Response Schema support to perform parallel, schema-enforced classification checks.
2. Cross-Document Citations
Highlighting exactly where discrepancies occurred required precise text citation extraction.
I solved this by instructing Gemini to return exact string literals from both documents. The frontend then dynamically locates these strings and overlays them with yellow and red highlighter states, making discrepancies immediately visible.
3. Vite Port Allocation
Restarting sockets during HMR updates occasionally locked up port 5173 on local systems.
I resolved this by dynamically adjusting the development server to port 5174 and configuring secure middleware interception rules, allowing development reloading to continue smoothly.
What I Learned
Structured JSON AI Outputs
Designing strict interfaces in TypeScript, such as Finding and AnalysisResult, and passing them directly to Gemini's schema parameters significantly reduces AI hallucinations while maintaining strong type safety.
Immersive Micro-Interactions
I realized that a great developer tool should feel like a console.
Adding green terminal-style console logs that stream actual indexing operations during loading creates a much stronger impression than a generic loading spinner.
Drifting Glow Aesthetics
I learned that high-end glassmorphism styling can be incredibly lightweight while still being visually impressive.
Combining simple CSS HSL gradients, radial blur circles, and subtle animations can create a polished and immersive interface without requiring heavy graphical libraries.
Final Takeaway
Document Detective is more than an AI summarizer.
It is designed as a semantic auditing system that compares documents, identifies contradictions, pinpoints their exact locations, and presents the findings through an intuitive visual interface.
The core idea is simple:
Don't just tell users what their documents say. Tell them where their documents disagree.
Built With
- connect
- css
- express.js
- flash
- gemini
- react
- tailwind
- typescript
- vite

Log in or sign up for Devpost to join the conversation.