AI-assisted intake and review workflow for managing invention disclosures. Inventors upload PDF documents, the backend extracts structured fields with Google Gen AI, and in-house counsel review disclosures through a tailored dashboard.
- Frontend: React + TypeScript (Vite), React Query, React Router
- Backend: Express + TypeScript, Prisma ORM, Multer, pdf-parse, Google Generative AI SDK
- Database: PostgreSQL
- Node.js 20+
- npm 9+
- PostgreSQL 15+
- Google AI Studio API key (for Gemini extraction)
backend/ # Express API, Prisma schema, PDF + GenAI services
frontend/ # React SPA with inventor and counsel workspaces
docs/ # Planning and design notes
-
Create backend environment file:
cd backend cp .env.example .envUpdate
DATABASE_URLand Google Gen AI variables. To run without Gen AI, setENABLE_GENAI=false. -
Create frontend environment file:
cd frontend cp .env.example .envAdjust
VITE_API_BASE_URLif the backend runs on a different host/port.
cd backend
npm install
npx prisma migrate dev --name initThis generates the Prisma client and applies schema changes to your PostgreSQL instance.
cd backend
npm install # already run in repo, repeat if needed
npm run dev # start API with ts-node-dev (port 4000)
npm run build # type-check and emit JS to distThe API exposes:
POST /api/disclosures– upload PDF (multipart), generate docket number, persist extracted dataGET /api/disclosures– list disclosures (counsel role only)GET /api/disclosures/:id– retrieve single disclosurePATCH /api/disclosures/:id– update status/notes
Supply the caller role via x-user-role header (inventor or counsel). Uploaded PDFs are stored under backend/storage/uploads and served at /files/<filename>.
cd frontend
npm install # already run, repeat if needed
npm run dev # Vite dev server (port 5173 by default)The SPA offers:
- Inventor workspace (
/inventor): PDF upload form, dynamic inventor list, AI-generated preview. - Counsel dashboard (
/counsel): filterable docket table, detail panel with status + notes, PDF download.
Set VITE_API_BASE_URL to match the backend (include protocol, no trailing slash). React Query handles client-side caching and refetch after mutations.
The backend uses the @google/generative-ai SDK with API key authentication (Gemini models). Required env vars:
GOOGLE_GENAI_API_KEYGOOGLE_GENAI_MODEL(defaultgemini-1.5-pro)ENABLE_GENAI(trueby default). Set tofalseto use deterministic fallback extraction for local development.
Generate an API key in Google AI Studio, store it securely (e.g., in .env), and ensure outbound HTTPS to generativelanguage.googleapis.com.
- Backend type-check/build:
npm run buildinsidebackend. - Prisma client generation:
npx prisma generate(runs automatically with migrations). - Frontend type-check/build:
npm run buildinsidefrontend.
Consider adding automated tests (Jest/Vitest) for docket number generation and form validation as follow-up work.
- Integrate authentication (SSO or JWT) and role management.
- Move file storage to cloud (S3/GCS) with signed URL access.
- Add email notifications on status changes.
- Expand analytics/reporting for disclosure throughput.
For a comprehensive overview of assumptions, technical decisions, trade-offs, and the roadmap to production hardening, see SOLUTION.md.