InkGrader is a state-of-the-art, AI-powered grading system designed to automate the evaluation of handwritten documents. By combining advanced OCR (Optical Character Recognition) with intelligent multi-agent systems and RAG (Retrieval-Augmented Generation), InkGrader provides an unparalleled experience for automated grading and assessment management.
- 📷 Intelligent OCR Extraction: High-accuracy extraction of handwritten text from scans and PDFs.
- 🤖 Multi-Agent AI System:
- Extraction Agent: Seamlessly parses raw OCR text into structured question/answer formats.
- Grading Agent: Evaluates student responses based on context, accuracy, and provided reference materials.
- 📚 RAG-Enhanced Evaluation: Powered by PostgreSQL
pgvector, the system cross-references student answers with official marking schemes for highly accurate grading. - ⚡ Background Processing: Grading jobs are queued in Postgres and claimed by a replicated worker pool; results can be refreshed on demand from the frontend.
- 📊 Modern Dashboard: A premium Next.js 16 App Router dashboard for managing exams, uploading student work, and viewing detailed feedback.
- 🔐 Enterprise-Grade Auth: Secure authentication flow utilizing Better Auth with Drizzle ORM and PostgreSQL.
- Framework: FastAPI (Asynchronous high-performance API)
- Package Manager: uv
- AI/LLM: Groq API, Hugging Face Inference API for embeddings
- Vector Search: PostgreSQL
pgvectorextension - Database ORM: SQLAlchemy 2.0
- Background Tasks: Postgres-backed job queue (
grading_jobs,SKIP LOCKEDclaiming) - OCR: OCR.Space API / Pypdf
- Framework: Next.js 16 (App Router)
- Styling: Tailwind CSS 4
- Components: shadcn/ui, Lucide Icons, Radix UI
- Data Fetching: React Query (@tanstack/react-query)
- Authentication: Better Auth with Drizzle ORM
- Design: Premium aesthetics with Geist Sans & Geist Mono
- Python 3.12+ (Using
uvfor dependency management) - Node.js 18+
- PostgreSQL Database (with
pgvectorenabled) - Groq API Key
- Hugging Face API Key
- OCR.Space API Key
Tip: You can quickly spin up PostgreSQL with pgvector using Docker:
docker run -d --name pgvector -e POSTGRES_PASSWORD=pass -p 5432:5432 pgvector/pgvector:pg16- Navigate to the backend:
cd backend - Create your environment variables file:
Fill in your API keys and database URL in the
cp .env.example .env
.envfile. - Install dependencies using
uv(resolves the whole workspace —core,api, andworker— into one shared environment):uv sync
- Start the two services (each in its own terminal):
uv run --package inkgrader-api fastapi dev api/app.py # HTTP API, port 8000 uv run --package inkgrader-worker python worker/worker.py # grading worker (run several for more throughput)
docker compose up(seedocker-compose.ymlat the repo root) does this for you, including 3 grading-worker replicas.
- Navigate to the frontend:
cd frontend - Create your environment variables file:
Ensure you configure
cp .env.example .env
DATABASE_URL, Google OAuth keys (if used), and Better Auth secret. - Install dependencies:
npm install
- Setup the database schema for authentication via Drizzle:
npm run db:push
- Start the Next.js development server:
npm run dev
POSTGRES_URL=postgresql+psycopg://user:pass@localhost:5432/postgres
HF_API_KEY=YOUR_HUGGING_FACE_ACCESS_TOKEN
GROQ_API_KEY=YOUR_GROQ_API_KEY
OCR_API_KEY=YOUR_OCR_API_KEYDATABASE_URL=postgresql://user:pass@localhost:5432/postgres
DEV=true
GOOGLE_CLIENT_ID=YOUR_GOOGLE_OAUTH_ID
GOOGLE_CLIENT_SECRET=YOUR_GOOGLE_OAUTH_SECRET
BETTER_AUTH_URL=http://localhost:3000/
NEXT_PUBLIC_APP_URL=http://localhost:3000/
BETTER_AUTH_SECRET=YOUR_BETTER_AUTH_SECRET
BACKEND_URL=http://127.0.0.1:8000/backend/: auvworkspace containing shared core code and 2 independently deployable services, sharing one lockfile.core/: shared business logic, not a process on its own.Agents/: The "brains"—Extraction and Grading agents.Database/: SQLAlchemy models and Data Access Layers (DALs).FileProcessor/: OCR and document parsing utilities.Grading/: Postgres-backed job queue (grading_jobstable) and student-answer evaluation.
api/: the HTTP API (app.py,routes.py).worker/: the grading worker (worker.py), run at multiple replicas for throughput.
frontend/: Next.js 16 App Router interface and Better Auth integration.app/: Next.js routes and layouts.components/: Reusable UI components powered by shadcn/ui.drizzle/: Drizzle ORM schemas and migrations.
sample_data/: Sample reference materials, rubrics, and student submissions for testing the system.
Distributed under the MIT License. See LICENSE for more information.
Project Link: https://github.com/Geoff-Robin/InkGrader