SOW Draft Generator

AirGap Labs

IT Infrastructure & Security | Fortinet Engage Preferred Partner

TECHNICAL CASE STUDY

Internal CRM & Automation Suite

Stack: Shopify Liquid  •  n8n Cloud  •  Supabase  •  Chart.js  •  Harvest API

Role: Principal, AirGap Labs  •  Irvine, CA

CASE STUDY

SOW Draft Generator

Async AI pipeline that produces a branded, formatted Word document from a form submission

Industry

IT Infrastructure & Professional Services

Platform

Shopify Liquid + n8n Cloud + Supabase + pure-JS DOCX engine

Timeline

Built as part of the SOW/RFP Manager suite

Audience

Sales engineers and project managers

The Problem

Writing a Statement of Work from scratch is one of the most time-consuming parts of the pre-sales process. A typical SOW at AirGap requires pulling in scope details, fee structures, timeline estimates, legal boilerplate, and formatting everything to brand standards — a process that could take two to four hours per document even for experienced engineers.

The team needed a way to generate a well-structured, professionally formatted first draft in minutes so engineers could spend their time reviewing and refining rather than writing from a blank page.

The Solution

An async AI pipeline triggered from a multi-step modal inside the SOW Manager. The user fills out a structured intake form; an n8n workflow takes over, runs AI drafting in the background, and delivers a completed .docx file — branded and formatted to AirGap standards — directly into the document store.

Pipeline Architecture

  1. User completes a multi-step creation modal in the Shopify Liquid SOW Manager (project type, scope, deliverables, timeline, fee structure)
  2. Form submission triggers an n8n webhook that starts an async drafting job and returns a job ID immediately
  3. The Liquid page polls a status endpoint every few seconds using a pure-JS polling loop with exponential backoff
  4. n8n AI agent drafts structured SOW content across standard sections (Background, Scope, Deliverables, Assumptions, Fee Matrix, Timeline)
  5. A pure-JS DOCX engine (no server-side libraries) assembles the branded Word document: Helvetica AFM word-wrapping, JPEG logo embedding, formatted fee matrix table
  6. The completed file is written to Supabase storage; the polling endpoint returns a signed download URL
  7. The Liquid page detects completion, dismisses the progress indicator, and makes the file available for download and review

~90 sec

Draft generation time

2–4 hrs

Manual drafting time replaced

.docx

Output format (Word)

Async

Non-blocking architecture

Technical Highlights

The most technically demanding aspect was the pure-JS document engine. Because the pipeline runs in a constrained n8n Code node environment, it could not rely on server-side document libraries. Instead, a custom engine implements Helvetica AFM character widths for accurate word-wrapping, handles JPEG binary embedding for the logo, and generates valid .docx XML structure — all without any npm dependencies at runtime.

AirGap is a Microsoft shop, so the primary output format is .docx rather than PDF. The engine produces a file that opens natively in Word with all formatting intact: section headings, a fee matrix table, numbered deliverables, and branded header with logo.

The async polling pattern was essential for user experience. Document generation takes 60–90 seconds; a synchronous request would time out. The non-blocking architecture keeps the UI responsive and gives the user a live progress indicator while the pipeline runs in the background.

Outcome

SOW drafting time dropped from two to four hours to under five minutes of human effort — a 30–50x improvement. Engineers now start from a solid, correctly structured draft rather than a blank document, reducing errors in scope definition and ensuring consistent formatting across all client deliverables. The document store inside the SOW Manager gives the team a searchable history of every SOW ever generated.

About AirGap Labs

AirGap Labs is an IT infrastructure and security firm based in Irvine, California, specializing in Fortinet solutions as a Fortinet Engage Preferred Services Partner. The internal CRM suite described in these case studies was designed and built entirely in-house by the principal, using a lean stack (Shopify, n8n Cloud, Supabase) that keeps operating costs near zero while delivering enterprise-grade functionality.

All three tools are in active daily use by the AirGap team.

AirGap Labs  •  Irvine, CA  •  airgaplabs.com

Back to blog