DEV Community

Yann_
Yann_

Posted on

How I Built a Legal Document Generator for French Small Businesses

I'm a solo developer shipping SaaS products for the French market. One of my recent builds is Auto-DUERP — a tool that generates a mandatory workplace risk assessment document (called "DUERP" in France) that every employer must have.

Here's the story of why I built it, and the technical decisions behind it.

The problem

In France, every company with at least one employee must produce a DUERP (Document Unique d'Evaluation des Risques Professionnels). It's a legal obligation since 2001.

The reality? Most small business owners either:

  • Pay 200-500 EUR to a consultant for a generic template
  • Download a random Word file from the internet and hope it's compliant
  • Simply don't have one (and risk fines up to 10,000 EUR)

I saw an opportunity for a self-service tool at 49 EUR — 4-10x cheaper than a consultant, but actually tailored to their specific industry.

The stack

I used the same monorepo setup I use for all my products:

  • Next.js 16 (App Router) with TypeScript
  • Tailwind CSS for styling
  • Prisma + PostgreSQL for data
  • Stripe for payments (one-shot, no subscription)
  • @react-pdf/renderer for PDF generation
  • Gemini API for AI-powered risk suggestions

The monorepo also hosts SCI Facile (a tool for creating French real estate companies) and LMNP Facile (rental property tax filing). Shared auth, shared Stripe integration, shared UI components.

How it works

1. Sector-specific data

I compiled risk data for 34 professional sectors from INRS (France's national occupational safety institute). Each sector has pre-filled risks, prevention measures, and severity ratings.

A restaurant owner doesn't see the same risks as an electrician. This is the key differentiator vs. generic templates.

2. The 5-step wizard

The user flow is intentionally simple:

  1. Company info — name, SIRET, sector, employee count
  2. Work units — define areas/departments
  3. Risk identification — AI suggests risks based on sector, user validates/edits
  4. Prevention measures — existing and planned measures
  5. Review & generate — preview, pay, download PDF

No account required. Privacy-first: we don't store personal data after PDF generation.

3. PDF generation

The hardest part was making the PDF look professional. @react-pdf/renderer is powerful but has its quirks — no CSS grid, limited flexbox, font loading issues.

I ended up building a custom PDF template with:

  • Company header with logo
  • Risk matrix (severity x probability)
  • Color-coded risk levels
  • Prevention action plan with deadlines
  • Legal compliance footer

4. AI-assisted risk identification

When a user selects "Restaurant" as their sector, the AI pre-fills common risks (burns, slips, repetitive strain, etc.). But it also adapts based on the specifics — a restaurant with a terrace has different risks than one with only indoor seating.

I use Gemini for this because the cost per generation is negligible at our volume.

SEO as the growth engine

No ads budget. No sales team. Just SEO.

I built programmatic pages for:

  • Every sector (/secteur/restaurant, /secteur/electricien, etc.)
  • Major French cities (/ville/paris, /ville/lyon, etc.)
  • A glossary of workplace safety terms

This gives us ~500 indexable pages from day one. The same strategy I used for my comparison sites — but applied to a SaaS product.

Results so far

  • Live in production in 10 days from idea to launch
  • Indexed by Google within 48 hours (thanks to IndexNow)
  • First organic traffic within a week

The one-shot pricing (49 EUR) means no churn to worry about. Each customer is profitable from day one.

Lessons learned

  1. Legal products need trust signals. Security headers, legal pages, HTTPS — the basics matter more when you're selling compliance tools.

  2. PDF generation is underrated as a moat. Most competitors offer Word templates. A polished, auto-generated PDF feels 10x more professional.

  3. Monorepo saves weeks. Sharing auth, payments, and UI across Auto-DUERP, SCI Facile, and LMNP Facile meant I only had to build the domain-specific logic.

  4. AI is the seasoning, not the dish. The real value is the sector-specific data and the compliance structure. AI just makes the UX smoother.


If you're building for a regulated market, don't underestimate the power of "making the boring thing easy." Nobody wants to write a DUERP. But everybody has to.

That's where the money is.

Top comments (0)