Technical Architecture Summary

Hoike Technologies — VAT API Toolkit (MTD VAT, Flat Rate–only)

Scope & HMRC Approval Focus

Hoike Technologies intentionally implements only the two mandatory MTD VAT endpoints required for HMRC production credential approval:

The system is Flat Rate–only by design. All other endpoints are deliberately deferred until post-approval.

1) System Overview

The VAT API Toolkit is a Node.js (Express, ESM) web application backed by PostgreSQL (Prisma ORM). It implements a tightly controlled VAT submission pipeline prioritising determinism, auditability, and HMRC compliance.

The platform supports Flat Rate Scheme VAT only, with both automated invoice aggregation and explicit manual turnover entry, depending on the client’s Flat Rate category.

2) Major Components

Web Application (Express)

  • Client-facing routes for obligations → preview → submit.
  • Admin routes for sandbox test-user management and audit tooling.
  • Server-side rendering (EJS) for transparent, reviewable VAT flows.

Data Layer (PostgreSQL + Prisma)

  • Client: VRN, Flat Rate category, percentage, environment flags.
  • Invoice & InvoiceProcessingRun: source data and normalized outputs.
  • VatReturnPreview: authoritative, hash-locked snapshot of a VAT return for a period.
  • VatReturnSubmission: idempotent submission record including HMRC receipts.
  • OAuthCredential (sandbox) and HmrcAuth (production).

HMRC Integration Layer

  • Environment-aware HTTP client (sandbox vs production).
  • Refresh-token–based OAuth lifecycle management.
  • Mandatory fraud-prevention headers enforced in production.

3) Environment Model

Sandbox and production are strictly isolated at the credential, token, and data level:

Mode Token Store VRN Used Purpose
Sandbox OAuthCredential Sandbox test-user VRN End-to-end functional testing
Production HmrcAuth Live client VRN Real VAT submissions

4) End-to-End VAT Journey

A) Retrieve Obligations

  1. Valid HMRC authorization is verified.
  2. The system retrieves open VAT obligations.
  3. A periodKey is selected for preparation.

B) Preview (Authoritative Snapshot)

  1. Flat Rate category determines data source (AUTO or MANUAL).
  2. For AUTO categories, invoice processing runs are aggregated into gross turnover.
  3. For MANUAL categories, turnover is explicitly entered and confirmed by the user.
  4. A deterministic HMRC payload is generated and written to a VatReturnPreview snapshot.
  5. A payload hash is stored; all subsequent renders use this snapshot.

C) Submit Return

  1. Submission is only allowed from a confirmed preview snapshot.
  2. Payload hash is re-verified immediately before submission.
  3. Idempotent submission records prevent duplicate filings.
  4. HMRC responses and timestamps are persisted for audit.

5) Reliability, Safety, and Auditability

6) Planned Post-Approval Expansion

After HMRC production approval, Hoike Technologies plans to extend support to additional MTD VAT endpoints (liabilities, payments, financial details, penalties) and broader Flat Rate categories, while retaining the same snapshot-based, audit-first architecture.


Document: Technical Architecture Summary • Prepared for HMRC and internal operational review.