2bros1ai_
internal operations

From a policy PDF to a signed PDF: the approval engine behind a group of energy companies

One workflow engine for every approval a group of energy companies runs: org-chart routing, signed PDFs, SharePoint archive, Microsoft 365 SSO. Live since June 2026, 120 people on it.

Client
A group of energy companies, 120 people (anonymized)
Systems
Next.js, TypeScript, Postgres (Supabase: RLS, Storage, Realtime), Microsoft Entra ID SSO, Microsoft Graph (Outlook, Calendar, To-Do, SharePoint), PDF generation with signatures and stamps, pg_cron, Vercel, Claude Code
Team
Affan & Furkan Dindar
Date
MetricBeforeAfter
Time to fully approvedUnknown. That was the problem.Median under 17 hours, two-thirds within a day
Where signed documents end upA folder, a drawer, someone's inbox8,000+ filed in SharePoint, automatically
Requests per monthNobody counted4x in the first four months
How an approval movesPrinted, signed, walked desk to deskOne engine, approvers resolved from the org chart
Approval steps on recordWhatever the paper said5,000+, with who, when and which revision
People on the platform0120
Changing a ruleReprint the form, tell everyoneUsually a config change, not a release

Every request that needs a signature, from leave and travel to expenses, purchases, company stamps and finance sign-offs, runs through one engine. Approvers are resolved from a live org chart, every decision is logged, and the signed document files itself into SharePoint. Five months from first commit to live, and still growing.

What they had

A group of energy companies: several legal entities, one set of people running operations across all of them. The rules for who approves what lived in two policy documents and an org chart in Excel. The approvals themselves lived on paper: printed forms, wet signatures, company stamps, walked from desk to desk and filed somewhere. Nobody could say where a request was, who was sitting on it, or how long approvals took. Not because nobody asked. Because nothing was recording it.

What we built, in the order we built it

We didn't digitize forms. We built the system the forms run on.

1. An org model that's the source of truth

Companies, units as a tree, positions, and who held which position when, with dates. The Excel org chart became a database, the database became a live org chart, and the org chart became the routing table. A new request goes to whoever holds the position today, not whoever held it when the form was designed.

2. A workflow engine, not a pile of forms

A workflow is data. It has:

One engine runs 70+ approval steps across every flow: leave, overtime, travel, expenses, advances, purchase comparisons, company-stamp requests, finance and accounting sign-offs, onboarding and offboarding.

3. Documents are the output, not the input

Every flow ends in a PDF the system generates itself: the right template, the full approval history, signatures where the policy wants signatures and the company stamp where it wants a stamp. Attachments travel with it. Nobody retypes anything into Word.

4. Wrap Microsoft 365, don't replace it

The company already lived in Microsoft 365, so the platform lives there too. Sign-in is company SSO through Entra ID. Notifications go out as Outlook email through Microsoft Graph. The home screen shows your calendar and your To-Dos. The finished PDF files itself into SharePoint through a queue with retries and a kill switch, so a SharePoint hiccup delays a document instead of losing it.

5. A lifecycle people can trust

Withdraw, revise, cancel, resubmit, with rights that depend on how far the request has gone. Before the signatures, the requester is in control. After them, only an admin. Every revision round stays in the audit trail.

Guardrails

Row-level security in Postgres, around 160 policies: you see a request if it's yours, if it's yours to approve, or if you're an admin. Sign-in only through the company's own SSO. A privacy consent screen before anyone gets in. Server-side keys never leave the server. Every approval step records who acted, when, and in which revision.

Where the AI is

Not in the approval path, on purpose. A signature is a legal act, and nobody wants a model guessing who should sign a finance document. The AI is in how the system is built, run and handed off.

What broke

Three things, all in production, all fixed.

What changed

Monthly volume grew fourfold in the first four months live. The median time from submission to fully approved is under 17 hours, and two out of three requests are fully approved within a day. More than 8,000 signed documents have filed themselves into SharePoint without anyone dragging a file into a folder.

The policy documents finally have a counterpart that enforces them. When a rule changes, it's usually a configuration change, not a release. Adding an optional document to a leave step and handing the final step of a flow to a different person both shipped without a deploy.

Timeline

Still embedded. Not a hostage situation.

Have a stack that looks like this?

Thirty minutes. We map one workflow live and tell you what it takes. No deck.