Middleware overview

Architecture Overview

Purpose

Connect Zapier automations to Verae blockchain timestamping without:

Components

1. verae-zapier (Zapier Platform CLI app)

Runs on: Zapier’s cloud when a Zap step executes.

Responsibilities:

Does not:

2. verae-zapier-middleware HTTP edge

Runs on: Your infrastructure (public HTTPS).

Responsibilities:

3. NATS + JetStream

Runs on: Private network with middleware.

Responsibilities:

4. Workers

Runs on: Same deploy as middleware or separate worker processes.

Worker Consumes Calls
Job poller verae.zapier.jobs.watch GET /api/status/{jobId} on Verae
Event router verae.zapier.jobs.events Enqueues webhook deliveries
Webhook deliver verae.zapier.webhooks.deliver POST Zapier targetUrl

5. api.veraetime.net (Verae Timestamping Service)

Source of truth for login, timestamp jobs, status, and verification.

OpenAPI: production Swagger / Verae-Swagger.yaml.

Request flows

A. Create Timestamp (async)

Zapier → POST /zapier/v1/timestamp
Middleware: authenticate, checkEntitlement, POST /api/timestamp
Middleware: publish jobs.watch → return 202 { jobId }
Worker: poll status until terminal → publish jobs.events
Event router: match webhooks → publish webhooks.deliver
Webhook worker: POST hooks.zapier.com/...

B. Create Timestamp and Wait

Zapier → POST /zapier/v1/timestamp/wait
Middleware: create + wait for jobs.events (or in-process wait if NATS off)
→ return StatusResponse (completed/failed) or pending+jobId on timeout

C. Auth connection test

Zapier → GET /zapier/v1/auth/me  Authorization: Bearer zmw_…
Middleware: resolve API key → tenant → optional validate Verae token
→ { tenantId, plan, usage, ... }

Feature flags

Flag Effect
NATS_ENABLED=false In-process job poller; still full HTTP API (Phase 6 path)
NATS_ENABLED=true JetStream workers; no in-process poller
MOCK_VERAE=true No live Verae; deterministic mock jobs for tests
DEBUG_VERAE=… Runtime failure tracing (see debugging.md)

Security boundaries

Public Internet
  ├─ Zapier → Middleware HTTPS only
  └─ Middleware → Zapier webhook HTTPS only

Private
  ├─ Middleware ↔ NATS
  └─ Middleware/Workers → api.veraetime.net HTTPS

Never expose NATS ports to the public internet.

Scaling model