Policy Match: A full-stack policy compliance scanner powered by Groq that uses OCR and LLMs to extract rules from uploaded documents and check them against predefined policies.
Policy.Match.Demo.mov
Overview • Key Features • Architecture & Tech Stack • Quick Start • Customization • Next Steps • License
This application automates policy reviews by extracting text from documents, parsing policies with LLMs, and highlighting compliance or violations—all in seconds. Fork, customize, and deploy as a foundation for your own compliance workflows.
- OCR Extraction Upload PDFs or images; Apache Tika extracts text & metadata.
- Policy Parsing LLMs identify and structure policy rules for comparison.
- Compliance Checking Compare extracted rules against stored policies; flag aligned vs. violated clauses.
- Human-in-the-Loop Flags Confidence scoring highlights low-confidence checks for review.
- Real-time Results Instant feedback on compliance percentage and specific violations.
- Scalable Plugin Design Easily swap LLM models, policy sources, or storage backends.
Pipeline:
- Document Upload → 2. OCR (Apache Tika) → 3. Rule Extraction (Groq LLM) → 4. Compliance Comparison → 5. Result Presentation
Tech Stack:
-
Backend:
- Go 1.20+ service (
policy-match
binary) - Apache Tika (OCR)
- PostgreSQL (metadata storage)
- Docker & Docker Compose
- GNU Make workflows
- Go 1.20+ service (
-
Frontend:
- Next.js 13 (App Router)
- Tailwind CSS & shadcn/ui components
- Vite-powered dev server
-
Orchestration:
- Root Makefile for install, build, dev, test, clean
docker-compose.yml
for database & OCR service
- Go 1.20+
- Node.js 18+ & npm (or yarn/pnpm)
- Docker & Docker Compose
- GNU Make
- Groq API Key (get yours)
Note: You can install Go, Node.js, npm, or Docker Compose using the Makefile commands, it will prompt you to install what is missing.
-
Clone the repo
git clone https://github.com/build-with-groq/policy-match cd policy-match
-
Install required tools
make bootstrap
This will:
- Check for Go, Node.js, npm, Docker, and Docker Compose
- Prompt to install any missing tools interactively
- Copy environment files
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env.local
- Fill in variables
backend/.env
:
GROQ_API_KEY=your_groq_api_key
LLM_MODEL=meta-llama/llama-4-maverick-17b-128e-instruct
TIKA_URL=http://localhost:9998
ORIGIN=https://your-subdomain.groqlabs.com # Required for production
frontend/.env.local
:
NEXT_PUBLIC_API_BASE_URL=http://localhost:8080
- Install dependencies & start services
make setup
This installs backend & frontend dependencies, starts Docker Compose services, and waits for Postgres & Tika to be ready.
-
Start services
make dev
- Backend on
http://localhost:8080
- Frontend on
http://localhost:3000
- Backend on
-
Open the app Visit
http://localhost:3000
-
Upload Document Select a file to scan and choose a policy to compare.
-
View Results See compliance percentage, highlighted violations, and any human-review flags.
- LLM Model: Change
LLM_MODEL
inbackend/.env
to use a different Groq model. - Policy Sources: Swap or add new policy documents in the database.
- UI Components: Modify or extend shadcn/ui components in
frontend/components/
. - Storage Backends: Replace PostgreSQL with another datastore by updating
docker-compose.yml
and Go code.
- Create your free GroqCloud account: Access official API docs, the playground for experimentation, and more resources via Groq Console
- Build and customize: Fork this repo and start customizing to build out your own Chrome extension with AI capabilities
- Explore Chrome Extension APIs: Learn more about Chrome Extension development to add advanced features
- Get support: Connect with other developers building on Groq, chat with our team, and submit feature requests on our Groq Developer Forum
- See enterprise capabilities: This template showcases production-ready AI that can handle realtime business workloads in browser extensions
- Discuss your needs: Contact our team to explore how Groq can accelerate your AI initiatives and browser-based applications
Licensed under the MIT License. See the LICENSE file for details.
Developed by Mshari Alaeena at Groq • LinkedIn.