TL;DR: Before you ask "JS or Python?" — unzip the file and look. Thirty seconds of grepping ended a fake debate and saved hours of the wrong build.

the setup

my business partner (a small law practice I build systems for) needed engagement letters fully automated.

The pipeline we planned: client fills a Fillout (form builder) form → webhook fires to our Python serverless function on Vercel → function renders my business partner's Word template → uploads to Google Drive → my business partner downloads, edits, re-uploads → "Send for signature" hits the DocuSeal (e-sign API) Cloud API → DocuSeal fires a completion webhook → signed PDF + cert land back in the system.

Five distinct services. Seven atomic commits, each independently shippable.

what broke first

The original plan was simpler: Fillout generates a PDF → grab it via API.

Except Fillout doesn't expose generated PDFs via API. Dead end.

Then I considered Make.com watching Gmail for PDF attachments. Also dead — too fragile, too indirect.

The answer became obvious once I stopped chasing the PDF: render it ourselves, from the form data, using my business partner's own Word template as the blueprint.

the fake choice

That's where I almost walked into a trap.

My instinct was to frame the next question as "JS library or Python sidecar?" — a real-looking architectural decision, one I've made before.

And I almost just... asked it. As if the answer were open.

the 30-second fix

Before framing the choice out loud, I did one thing: unzip on my business partner's blueprint .docx, then grepped for Jinja tags.

What came back: 47 unique template tags. 18 of them were {%p if X %} — paragraph-level conditionals specific to docxtpl (Python Word-template lib).

No JavaScript library supports {%p ... %} natively.

The choice was a mirage. Python was the only possible answer. If I'd built it in JS, I'd have spent the build phase rewriting 47 tags, then hit a wall on the paragraph conditionals mid-build — hours wasted, plus my business partner's template loses its 1:1 fidelity with the Word doc she actually edits.

Thirty seconds of unzip + grep closed the debate before it opened.

what shipped

Seven commits. Full loop from Fillout webhook all the way to DocuSeal completion webhook dropping the signed PDF and certificate back into the matter record — with a Python docxtpl renderer at the center, preserving every one of my business partner's template conditionals exactly as she wrote them.

why this matters to me

I build a lot of document pipelines. The temptation is always to frame tech decisions in the abstract before looking at what the artifact actually requires.

The file knows the answer. Inspect it first.