Skip to main content
This is a task-oriented guide, not the canonical API reference. Use it to see several RevoEngine capabilities working together, then follow the links to the field-by-field and generated references.
This guide implements a payment-style reservation flow. A caller submits an existing order. RevoEngine authenticates the workload, validates the request, prevents duplicate processing, locks the relevant rows, reserves the balance, writes a transaction record, and returns an operationId that an operator can follow through the platform. The example deliberately stores money in minor units (1250 means 12.50) and reads the amount, account, and currency from the governed orders Table. A caller cannot replace those trusted values in the request body.

Protect the command

A service account, least-privilege access, a JSON request guard, and an idempotency key bound the public operation.

Commit one state change

A serializable transaction locks the order and balance, then writes the balance, order state, and ledger entry together.

Prove what happened

The response, structured logs, Job History, Table audit, and Trace share stable business and platform identifiers.

Architecture

The synchronous boundary reserves funds and produces a durable ledger fact. The Job performs slower or retryable provider work after the database transaction commits. Never keep a database lock open while waiting for an external API.

What this one workflow demonstrates

The same platform model also covers realtime delivery, scheduled and event-driven work, SDK/CLI workflows, custom Node.js, frontend integrations, and governed AI. Those areas have their own guides and references instead of being forced into this sample.

Before you begin

You need permission to create or update Components, Endpoints, Job templates, JSON Validator Components, and Tables. For production, create a dedicated service account such as payments-runtime and grant it only the roles and restricted-resource membership required by this workflow.
Do not put provider credentials, complete request bodies, card data, or unrestricted customer records in Component source, Endpoint metadata, logs, or Job input. Store secrets in Secrets and retain only the identifiers needed to investigate an operation.

1. Model the durable state

Open Databases and create three restricted Tables. Enable Audit before live writes begin; enabling it later does not reconstruct earlier row history.

orders

balances

Create a unique business constraint for the account and currency combination if each account owns only one balance per currency.

transactions

Treat the transactions Table as an append-oriented ledger. Settlement should append or transition an explicit transaction state according to your accounting model; it should not silently rewrite the original amount.

2. Validate the public command

Create a JSON_VALIDATOR Component and add an element such as reserveOrderRequest. The command accepts only the order ID and a caller-generated idempotency key:
The amount, currency, destination account, and desired order status are intentionally absent. They come from trusted rows selected under the runtime principal.

3. Implement the reservation Component

Create a CODE_TS Component named Reserve order balance. The code below uses the same public declarations delivered to Monaco.
api.transactionDatabase() commits when its callback resolves and rolls back when it throws. Await each tx.* call sequentially; parallel transaction operations are rejected. The default timeout is 15 seconds, and explicit timeoutMs values are limited to 1–30 seconds.
The instance-cache idempotency gate suppresses concurrent duplicates. The unique transactions.requestKey and existing ledger row are the durable business truth after the cache entry expires.

4. Configure the Endpoint

Open Endpoints, create the definition inactive, and configure it before activation. Use the smallest practical timeout and memory budget. Inspect the generated OpenAPI operation and exercise both accepted and rejected requests while the definition remains inactive.

Request

Response

Also retain the x-revo-oid response header in the calling system. It is the fastest starting point for a cross-service trace when a client did not preserve the JSON response.

5. Configure durable settlement

Create a Job template for the provider call. The Job reads the transaction by transactionId, verifies that its state is still eligible, calls the provider with a provider-side idempotency key, and records only the safe provider reference. Jobs can run much longer than Endpoints, but they are still bounded. Instance policy can grant up to 59 minutes of execution time and 4 GiB of memory. Design larger work as checkpoints or multiple Jobs rather than assuming an unbounded process, and reserve only the memory the workload actually needs.
A remote timeout is ambiguous: the provider might have completed the operation before the connection failed. Query by the provider idempotency/correlation key before retrying the side effect.

Settlement worker: Secret, HTTP egress, and Storage evidence

Before activating the template, create PAYMENTS_API_URL and PAYMENTS_API_KEY under Secrets, grant the Job service account access to those names, and pre-create payments/settlement-receipts as a restricted Storage path for finance/audit groups. The Component still verifies effective restriction at runtime because storage.ensureFolderPath() does not mutate ACLs on folders that already exist. The settlement Component resolves credentials at runtime, sends a JSON request to the provider, updates the ledger, and writes a restricted receipt artifact. It never returns or logs the resolved API key. The originating Endpoint operation and the Job operation remain separate but linked.
Never log provider.request, request headers, the Secret value, or an unrestricted provider response. api.httpCall() returns diagnostic request data for runtime use; application logs should contain only allowlisted identifiers, status, and timing.
If the HTTP connection times out, query the provider with the same transactionId idempotency key before sending another settlement. If Storage writing fails after provider success, a retry can reconstruct the deterministic receipt from the settled ledger record without repeating the provider effect.

6. Test the failure paths

1

Validate the happy path

Seed one PENDING order and a matching balance. Confirm that available funds decrease, reserved funds increase, one ledger row appears, and the response exposes all three identifiers.
2

Replay the same request

Send the same requestKey. Confirm that no second reservation or ledger entry is created and the prior transaction can be identified.
3

Race two requests

Submit two different requests against the same balance. Confirm that row locking and serializable isolation prevent overspending.
4

Reject insufficient funds

Confirm a 409 response, no partial balance update, no reserved order state, and no ledger insert.
5

Interrupt settlement

Simulate a provider timeout. Confirm that the Job retry preserves transactionId, operationId, retry lineage, and provider idempotency metadata.
6

Verify least privilege

Run with the real service account, then remove one required Table or Secret permission and confirm the workflow fails closed.

7. Investigate one operation

Start with the identifier closest to the report: In Jobs History, inspect status, duration, attempt, selected template and Component version, timestamps, metadata, and actor. In Databases → Audit, verify the balance and order transition. In Trace, follow the operationId across Endpoint execution and Job dispatch.
A successful Endpoint response proves that reservation committed and settlement was scheduled. It does not prove that the provider settled the order. Customer notification should follow a terminal Job state plus a confirmed transaction/provider state.

Production extensions

This guide keeps the architecture visible rather than pretending to be a complete payment system. A production implementation commonly adds:
  • a reconciliation Job for transactions stuck in PENDING_SETTLEMENT;
  • an append-only settlement/reversal ledger policy;
  • provider webhook verification and replay protection;
  • currency- and tenant-specific limits;
  • dual-control approval for high-value or manual operations;
  • dashboards and alerts for age, retries, failure classes, and balance invariants;
  • retention and redaction rules aligned with financial and privacy obligations.

Reference, architecture, and operations

Database runtime reference

Search exact signatures for transactions, row reads and writes, idempotency, Jobs, logs, and operation IDs.

Database definitions

Configure field types, constraints, indexes, references, audit, and access boundaries.

Endpoint configuration

Review every route, validation, runtime, response, and retention option.

Identity and access

Configure users, service accounts, Groups, Permissions, API keys, and resource ACLs.

Jobs

Understand execution limits, retries, concurrency, long-running work, and history.

Traces and correlation

Investigate a distributed operation without collecting secrets.

HTTP and Storage

Integrate JSON APIs, stream large payloads, and create governed Storage artifacts.
Last modified on September 5, 2026