When an event producer or tent rental company pulls an operational fire permit for a 40x60 tent or a 200-guest hotel ballroom gala, the local fire marshal does not accept a rough sketch from Canva or Lucidchart. Inspectors check concrete numbers: occupant load under IFC Table 1004.5, minimum exit count and 72-inch tent exit widths under IFC Table 3103.11, the one-half diagonal exit remoteness rule, 36-inch and 44-inch clear egress aisles around banquet seating, 75-foot Class 2A:10BC fire extinguisher travel radii under NFPA 10, and minimum clearances for indirect-fired tent heaters (IFC 3107.12) and LP-gas tanks (IFC 3107.16).
Most commercial CAD tools either cost hundreds of dollars a month, require desktop installation, or treat life-safety rules as manual drafting notes rather than executable geometry checks. While building EgressCAD, I wanted to see how far a purely deterministic browser + Cloudflare Workers architecture could go: live 2D editing, real-time code auditing, and true architectural-scale 11x17 tabloid PDF + AutoCAD R12 DXF generation with zero external CAD backend.
Here is how the geometry engine, code verifier, and vector exporters work in TypeScript.
1. Separating Pure Geometry from UI and Storage
The first architectural decision was keeping every code formula, spatial calculation, and vector export in pure TypeScript modules with zero DOM or Node-native dependencies. That single constraint pays off in three ways:
- Instant client-side feedback: Dragging a 60-inch round table or shifting an exit door along a tent perimeter re-runs all nine IFC/NFPA compliance checks on every frame with zero round-trips.
- Identical server verification: The exact same TypeScript module runs inside the Cloudflare Worker when generating the final 3-sheet 11x17 PDF packet and layered DXF file, so what the user audits on screen is guaranteed to match the printed submittal byte for byte.
- Deterministic unit tests: Every life-safety rule (including edge cases like the 1/3 diagonal sprinkler exception or LP-gas rack separation) can be tested directly against real municipal thresholds in milliseconds.
2. Modeling IFC and NFPA Rules as Spatial Predicates
Instead of treating a floor plan as loose shapes, EgressCAD stores typed spatial entities in feet from a (0, 0) origin: structure bounds (enclosed tent, open canopy, indoor ballroom, outdoor fenced site), exit openings along perimeter edges, round/rectangular tables with explicit 18-inch chair pull-out rings, stages, bars, dance floors, portable extinguishers, indirect tent heaters, LP-gas cylinders, and generators.
From that scene graph, the deterministic audit computes nine checks:
-
Governing Occupant Load (IFC Table 1004.5): Computes area-based load (
floorArea / loadFactor, using 15 sq ft/person for tables and chairs, 7 sq ft/person for concentrated seating, or 5 sq ft/person for standing space) and compares it against actual placed seat count, taking the governing maximum. - Exit Count and Aggregate Width (IFC Table 3103.11 & 1005.3.2): Verifies minimum exits by occupant bracket (e.g., 2 exits for 50-199 occupants in a tent, 3 exits for 200-499, 4 exits for 500-999), enforces the 72-inch minimum clear width for tent exits (36 inches for indoor doors), and checks total capacity at 0.2 inches per occupant.
-
Exit Remoteness (IFC 1007.1.1): Computes the Euclidean diagonal of the assembly area (
sqrt(W^2 + L^2)) and verifies the minimum pairwise separation between primary exits meets0.5 * diagonal(or0.33 * diagonalwhen the venue is fully sprinklered). - Clear Aisle Widths: Expands each banquet table radius by the 18-inch occupied chair pull-out envelope and verifies clearance between adjacent occupied rings and perimeter walls meets the 36-inch secondary and 44-inch main egress path minimums.
- NFPA 10 Extinguisher Coverage: Checks that every corner and interior grid sample of the structure lies within 75 feet of at least one 2A:10BC extinguisher, rendering dashed 75-ft coverage circles directly on the canvas and Sheet FP-101.
- Winter Heating & LP-Gas Clearances (IFC 3107.12 & 3107.16): When indirect heaters, propane tanks, or generators are placed outside a winter tent, checks the minimum 10-foot setback for heating equipment and 10-to-20-foot separation for LP-gas containers, and writes explicit code notes onto the submittal schedules.
3. True-Scale 11x17 Tabloid PDFs Without a Headless Browser
A common shortcut for web-to-PDF export is rasterizing an HTML canvas or spawning Puppeteer. Both break down on fire marshal submittals: raster images blur when inspectors zoom into dimensions, and headless Chrome cannot run inside a lightweight edge Worker.
Instead, we generate vector PDFs directly in TypeScript using pdf-lib on true ANSI B (11" x 17", or 1224 x 792 pt) landscape sheets:
-
Sheet FP-101 (Scaled Floor Plan): Selects an exact architectural scale (
1/16" = 1'-0"or1/8" = 1'-0"depending on venue footprint), maps feet directly to PDF points (1 ft = 4.5 ptat1/16"scale), draws crisp vector walls, exit arrows, dashed chair-pull-out rings, 75-ft extinguisher circles, graphic scale bar, north arrow, NFPA 170 legend, and a right-hand title block with jurisdiction, code edition, andPASS (9/9)audit status. - Sheet FP-102 (Code & Egress Calculation Schedule): Tabulates every IFC/NFPA formula, input, required value, provided value, and pass/fail badge so the plan reviewer can verify the math in 30 seconds.
- Sheet FP-103 (Site & Fire Access Plan): Shows exterior fire-lane access, 10-ft/20-ft heater and LP-gas clearances, and generator setbacks.
For free previews, the same generator overlays a tiled diagonal DRAFT - NOT FOR PERMIT SUBMITTAL watermark across all three sheets and streams the PDF straight into an in-page preview modal via Blob URLs (avoiding mobile and desktop popup blockers). Paid packets strip the watermark and generate an accompanying AutoCAD R12 .dxf file using clean ASCII ENTITIES sections (LINE, CIRCLE, LWPOLYLINE, TEXT) organized onto standard layers (A-WALL, E-EXIT, F-EXTG, I-FURN, A-ANNO) so architects or venue engineers can open it in AutoCAD, BricsCAD, or QCAD with zero translation cleanup.
4. Handling Local Municipal Guardrails Honestly
One hard lesson in building compliance software is knowing where deterministic software stops and licensed professionals begin. Fire code thresholds vary sharply across US cities: Houston triggers tent permits above 1,200 sq ft, Austin and Los Angeles follow 400 sq ft enclosed / 700 sq ft open canopy rules, while Miami-Dade triggers permits at 120 sq ft under High-Velocity Hurricane Zone (HVHZ) wind rules.
More importantly, seven major US jurisdictions (New York City, Chicago, Miami-Dade, Orlando, Tampa, Boston, and Washington, DC) require a licensed Professional Engineer (PE) or Registered Architect (RA) stamp on many temporary assembly filings. Rather than glossing over that, our 40-city permit directory and studio jurisdiction picker surface explicit PE/RA stamp notices upfront and position the DXF export as a clean scaled base file a licensed engineer can review and stamp rather than starting from scratch.
Key Takeaways
- Pure TS engines shine on edge runtimes: Running identical geometry and vector-PDF code in both the browser and Cloudflare Workers eliminates client/server drift and keeps infrastructure overhead near zero.
-
Vector PDFs beat screenshots every time: Mapping feet directly to PDF points (
pdf-lib) gives fire marshals razor-sharp architectural prints at exact1/16" = 1'-0"scale in under 50 milliseconds. - Single-session value beats gated trials: Letting an event crew load a preset (like a 40x60 heated holiday tent), verify all 9 fire-code checks, and inspect the watermarked 3-sheet PDF before ever creating an account removes friction while showing exact engineering output upfront.
You can try the interactive studio, city permit directory, and IFC calculators directly at EgressCAD.
Top comments (0)