Workspace: /Users/marchon/apps/zapier
(imported 2026-09-09). Packages live under packages/.
Commercial billing is packages/zappier — do not reimplement
it in middleware. Composition waves: see
docs/02-architecture/composition.md.
Product goal: Hybrid HTTP edge + NATS
workers middleware between Zapier servers and
https://api.veraetime.net.
Architecture bottom line:
verae-zapier (CLI app) runs on Zapier infrastructure
and calls middleware.verae-zapier-middleware exposes
/zapier/v1/* (auth, billing, sync API).api.veraetime.net over HTTPS and POST REST
Hooks to Zapier.How to use this file
[x] only after the gate command succeeds and
results are recorded under Gate log.Runtime debug
DEBUG_VERAE=1 or
DEBUG_VERAE=auth,nats,jobs,webhooks,http,billing.Primary docs
| Doc | Purpose |
|---|---|
| README.md | Repo overview and quick start |
| docs/architecture/overview.md | System diagram and data flows |
| docs/architecture/nats-subjects.md | Subject topology and payloads |
| docs/developer/modules/ | Per-module function reference |
| docs/plans/phase-gates.md | Gate commands and acceptance criteria |
| docs/api/middleware-openapi.yaml | Zapier-facing OpenAPI |
| Marker | Meaning |
|---|---|
[ ] |
Not started |
[~] |
In progress |
[x] |
Done and gate passed |
| BLOCKED | Waiting on listed dependency |
| GATE | Mandatory test validation — no next phase until green |
Depends on: nothing
Unblocks: Phase 1+
cd /Users/marchon/datacubes/verae-zapier-api
npm run gate:0Pass criteria
scripts/gate-0-structure.mjs)TODO.md, architecture docs, debugging doc, module docs
presentGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | structure + docs gate |
Depends on: Phase 0 GATE
Unblocks: All code phases (debug used everywhere)
npm run gate:1
# equivalent: node --test verae-zapier-middleware/test/unit/debug*.test.jsPass criteria
DEBUG_VERAE unsetDEBUG_VERAE=auth only emits auth
namespaceBearer, zmw_,
zmt_, password fieldstrace.run
callsGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | 11/11 unit tests |
Depends on: Phase 1 GATE
Unblocks: Auth, clients, routes
npm run gate:2Pass criteria
GET /health returns { status: "ok" }VERAE_API_BASE_URL, NATS_URL,
NATS_ENABLED, DEBUG_VERAEGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | health + config unit tests; /zapier returns 501 until Phase 5–6 routes |
Depends on: Phase 2 GATE
Unblocks: Auth bridge, billing, webhook subscribe
API
npm run gate:3Pass criteria
Gate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | store unit tests |
Depends on: Phase 3 GATE
Unblocks: Auth service, timestamp/verify services
npm run gate:4Pass criteria
jobId; wait reaches
completedDEBUG_VERAE=http shows request metadata
without Authorization header valuesGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | tokens + mock client |
Depends on: Phase 4 GATE
Unblocks: Timestamp/verify routes, Zapier custom
auth
npm run gate:5Pass criteria
/zapier/v1/auth/me402 +
QUOTA_EXCEEDED401DEBUG_VERAE=auth,billing traces tenantId/plan
without passwordGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | auth me + quota |
Depends on: Phase 5 GATE
Unblocks: NATS swap-in (Phase 7+), Zapier app
wiring
Note: Implements full product behavior with
NATS_ENABLED=false so Zapier can work before NATS.
npm run gate:6Pass criteria
POST /zapier/v1/timestamp → 202 + jobIdPOST /zapier/v1/timestamp/wait → completed status with
certificate fieldsPOST /zapier/v1/verify → valid true/falseGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | full HTTP mock path |
Depends on: Phase 6 GATE
Unblocks: Workers, production multi-instance
npm run gate:7
# starts NATS if needed, ensures streams, runs nats testsPass criteria
ZAPIER_JOBS, ZAPIER_EVENTS,
ZAPIER_WEBHOOKS existNATS_ENABLED=false still loads app without
connectingGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | nats-server JetStream |
Depends on: Phase 7 GATE
Unblocks: Hybrid production path
npm run gate:8Pass criteria
NATS_ENABLED=true, async create
eventually completes via workertimestamp.completed
payloadGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | workers watch→webhook |
/timestamp/wait via NATS eventsDepends on: Phase 8 GATE
Unblocks: Efficient Zapier “Create and Wait” under
multi-instance
npm run gate:9Pass criteria
Gate log
| Date | Result | Notes |
|---|---|---|
| 2026-09-09 | pass | wait via NATS + timeout pending; NS1 tunnel 70.88.205.138 |
Depends on: Phase 6 GATE (can parallel Phase 7–9
after 6)
Unblocks: Self-serve and enterprise keys for Zapier
npm run gate:10Pass criteria
apiKey + free planGate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | signup + admin |
verae-zapier)Depends on: Phase 6 GATE minimum; Phase 8
recommended for triggers
Unblocks: Private invites on Zapier
npm run gate:11Pass criteria
zapier-platform validate / local test suite green (when
CLI available)Gate log
| Date | Result | Notes |
|---|---|---|
| 2026-08-11 | pass | zapier package unit tests |
Depends on: Gates 8, 10, 11
Unblocks: Remote deploy
npm run gate:12Pass criteria
Gate log
| Date | Result | Notes |
|---|---|---|
| 2026-09-09 | pass | harness/scripts/smoke.sh health + signup + wait |
Depends on: Phase 12 GATE
Unblocks: Real customer traffic
npm run gate:13
# requires env: PRODUCTION_SMOKE=1 and real credentialsPass criteria
NATS_ENABLED=false still serves
sync pathGate log
| Date | Result | Notes |
|---|---|---|
Depends on: Phase 13 GATE
Unblocks: Beta users
Pass criteria
Gate log
| Date | Result | Notes |
|---|---|---|
Depends on: Phase 14
Unblocks: Public listing consideration
Pass criteria
0 Docs/structure
└─▶ 1 Debug facility
└─▶ 2 HTTP shell
└─▶ 3 Stores
└─▶ 4 Tokens + Verae client
└─▶ 5 Auth + entitlements
└─▶ 6 Sync HTTP API (+ in-process poller)
├─▶ 7 NATS infra ──▶ 8 Workers ──▶ 9 Wait-via-NATS
├─▶ 10 Tenancy (parallel after 6)
└─▶ 11 Zapier app (after 6; triggers prefer 8)
└─▶ 12 E2E local (needs 8,10,11)
└─▶ 13 Production Verae
└─▶ 14 Private Zapier push
└─▶ 15 Hardening
| Script | Phase | What it runs |
|---|---|---|
npm run gate:0 |
0 | Structure + doc presence |
npm run gate:1 |
1 | Debug unit tests |
npm run gate:2 |
2 | Config/errors/app tests |
npm run gate:3 |
3 | Store tests |
npm run gate:4 |
4 | Tokens + client tests |
npm run gate:5 |
5 | Auth + entitlement tests |
npm run gate:6 |
6 | HTTP integration (NATS off) |
npm run gate:7 |
7 | NATS stream tests |
npm run gate:8 |
8 | Worker integration |
npm run gate:9 |
9 | Wait path tests |
npm run gate:10 |
10 | Tenant tests |
npm run gate:11 |
11 | Zapier package tests |
npm run gate:12 |
12 | Compose E2E |
npm run gate:13 |
13 | Live smoke (opt-in) |
npm run gate:all |
0–12 | All automated gates in order; stop on first failure |
docs/developer/modules/<name>.md and JSDoc in
source.debug at boundaries:
auth resolve, outbound Verae, NATS publish/consume, webhook HTTP.