Kaspars Rancans"Admin-Zero" goal for ForgeDash. Architecting "Admin-Zero": Building a Deterministic, Multi-Tenant...
"Admin-Zero" goal for ForgeDash.
Architecting "Admin-Zero": Building a Deterministic, Multi-Tenant Business OS for the UK Trades.
Most SaaS tools for tradespeople are just CRUD wrappers with a pretty UI. When we built ForgeDash, we threw out the "client-side logic" playbook. We wanted a Financial Black Box—a system where the tech disappears, the math is bulletproof, and compliance is a background process.
Here is how/what we engineered:
1. Deterministic Finance: Moving the "Brain" to the Database.
In fintech, letting the frontend handle money is a liability. We adopted a "Dumb Frontend" strategy, isolating 100% of financial, tax, and business logic in PostgreSQL RPCs.
The Problem: UK tax law is a labyrinth of thresholds, Class 4 NICs, and tapers.
The Solution: We implemented the Deterministic Tax Engine directly in PL/pgSQL (fn_calc_uk_tax_25_26). It handles complex edge cases like the Personal Allowance Taper (reducing PA by £1 for every £2 earned over £100k) and calculates liabilities for multiple Student Loan Plans (Plans 1, 2, 4, and Postgrad) as well as pensions.
The Impact: Whether a user is on a spotty 4G connection or a desktop, the "Safe-to-Spend (StP)" number is mathematically identical because it's calculated at the source of truth. Actually StP is the only finacial number users care about.
2. The "Mother Orchestrator" Trigger Pattern
Compliance shouldn't be a manual task.
We built a centralized Mother Orchestrator trigger function (fn_orchestrate_ledger_update) attached to our ledger.
Autonomous Recalculation: Every INSERT, UPDATE, or DELETE on a transaction automatically triggers a top-down refresh of the Organization’s financial "Pots" (Tax, VAT, NI).
The VAT Sentinel: The orchestrator continuously monitors a rolling 12-month turnover. As soon as a business approaches the £90,000 UK VAT threshold, the system proactively alerts the user.
3. Mathematical Trust: Cryptographic Audit Chaining.
To make ForgeDash truly "professional-grade," we implemented blockchain-style Cryptographic Chaining for the audit logs.
Tamper-Evidence: Every record in the audit_logs table is mathematically linked to the one before it.
The Seal: A BEFORE INSERT trigger uses pgcrypto to SHA-256 hash the current payload concatenated with the previous_hash. If a single byte of financial history is altered, the chain breaks, providing a verifiable record for accountants.
4. "Vertical Molding" & The Slot Pattern.
Mechanics, plumbers, and electricians use different jargon, but we didn't want to manage multiple codebases. We built a Modular Vertical Framework.
JSONB Jargon Injection: Industry-specific terms (e.g., "Vehicle/VRM" vs. "Asset/ID") are stored in a vertical_registry. A custom hook, useMoldedUI, fetches this manifest and injects terms and UI tokens (accent colors, border radii) into the app context.
Feature Slots: Components use "Slots" to load vertical-specific modules—like a 2D Car Damage Walkaround for mechanics—while keeping the core layout industry-agnostic.
5. High-Stakes Feature Integration.
ForgeDash isn't just a ledger; it's a full-spectrum operational tool:
The Lead-to-Cash Workflow: We modeled the trade lifecycle as a strict state machine: Appointment ➔ Quote ➔ Job ➔ Invoice ➔ Paid. Each stage is a relational promotion, ensuring zero data re-entry.
Built-in OCR & Expense Tracking: Integrated via n8n and Gemini 2.0, the system scans receipts and uses a high-precision "Auto-Handshake" algorithm to link them to bank statement lines.
Asset Intelligence: For the mechanic vertical, the app performs Automatic VRM Lookups to pull technical data (engine, year, make, model etc.) and tracks the Lifetime Value (LTV) of every customer as well as jobs completed. We also can print/email full service history that is pulled from database.
Branded Documentation: Quotes and invoices are professionally branded and automatically synced to the user's business profile.
6. The "Greasy Finger" UX Standard.
We engineered for the workshop floor, not the boardroom.
Touch Targets: Strictly enforced 48px minimum touch targets for all interactive elements.
Visual Precision: We use Tabular Numerals (tabular-nums) for all financial data to prevent layout jitter as numbers update in real-time.
Privacy First: All PII (Personally Identifiable Information) is protected with AES-256 encryption at the database level.
The Stack:
ForgeDash is Compliance-as-Code. It’s high-performance co-pilot for the modern trade.
P.S. I'm open to listen any critique. Thanks for reading.