AI Legal-Document Generator (Romanian Declarations)
Romanian legal/compliance document tooling
Overview
A Next.js web app that drafts Romanian legal/administrative declarations on demand. Users fill a guided form, an LLM composes the formal document text, and the app renders it to a downloadable PDF, wrapped in a programmatically generated, SEO-optimized marketing surface.
The Challenge
Producing correctly worded legal declarations is tedious and easy to get wrong for non-lawyers. The product lowers that barrier: capture a few structured inputs, generate compliant document language with an LLM, and deliver a ready-to-print PDF, while ranking for the many long-tail declaration types people search for.
What We Built
A Next.js App Router project (TypeScript) with API routes for the core flows: api/generate and api/generate/document (LLM document composition), api/generate/pdf (PDF rendering), api/seo/generate-page (programmatic SEO page generation), and a api/health check. The UI centers on a document-generator and document-preview built with React Hook Form and a Radix/shadcn component set, plus dynamic document/[slug] pages, a generated sitemap.ts/robots.txt. The lib/ai/ layer is prompt-engineering-heavy, prompts.ts, specific-prompts.ts, document-generation-prompts.ts, a document-generator, and an openai client, with Zod validation and PDF export via jsPDF and @react-pdf/fontkit.
Technologies & Approach
Next.js/TypeScript with Tailwind and Radix for the UI; OpenAI for both legal-document text and SEO landing-page content; jsPDF/html2canvas for client-side PDF generation; Zod for input validation. A clear separation between the prompt library (lib/ai) and the rendering/export path keeps document types easy to extend.
Outcome / Impact
A complete AI-document product: structured intake, LLM drafting, PDF export, and an SEO-driven acquisition layer, demonstrating end-to-end generative-document delivery for the legal/compliance space.
Capabilities Demonstrated
- AI-assisted drafting of formal/legal documents
- Structured form-to-PDF generation pipeline
- Prompt-engineered, extensible document templates
- Programmatic SEO landing-page generation