Skip to main content
[AVAILABLE]. packages/api. Not a library other packages import, it’s the running server. No public exports (src/index.ts is empty).

Purpose

Composes every other package into one running Express process: policy loading, the gateway, credential isolation, and 14 HTTP routes. For the routes themselves, request/response shapes, and verified error codes, see REST API Introduction and Endpoints, this page covers the server’s internal structure.

Install

Not installed as a dependency, this package is the deployable server itself. See Deploy patterns.

Structure

PathPurpose
src/server.tsEntry point. Builds the execution system, the application, then the Express app, and listens on port 3000.
src/app.tsMounts all 14 routes and the error handler, in order, the error handler must be registered last.
src/application.tscreateApplication(executionSystem), wires RuntimeFactory.create() with the repositories and policy repository.
src/routes/*.tsOne file per route (or router factory), see Endpoints for each one’s behavior.
src/middleware/error-handler.tsMaps thrown errors to HTTP status codes by instanceof, falls through to an unstructured 500 for anything unrecognized.
src/mappers/BusinessTransactionMapper.tsfromRequest(body), forces status: RECEIVED and createdAt: now regardless of client input.
src/bootstrap/*.tsThe composition root: createExecutionSystem, createExecutionGateway, createExecutionControl, createConnectorRegistry, createConnectorRoute, createConnectorAuthenticator, createCredentialProvider, createVendorPaymentConnector, createGatewayKeyPair, createGatewayPublicKey, createGatewayIdentity, createNonceStore, createSessionStore, createExecutionAuditSink. Every bootstrap decision described on The gateway and Credential isolation lives here.
Two files in src/bootstrap/ are dead code, not wired into anything: ConnectorCatalog.ts and ConnectorFactory.ts list connectors (including disabled stubs like stripe/sap) but neither is imported anywhere in packages/api/src. The real, running connector registration path is createConnectorRegistry.ts, see The gateway. Two other files, scripts/generate-keys.ts (repo root) and packages/api/src/bootstrap/createVendorPaymentSecureConnector.ts, are empty, 0-byte stub files, also unused.

Minimal example

npm run generate:gateway-keys
PARMANA_STORAGE=memory PARMANA_POLICY_DIR=/absolute/path/to/policies \
  VENDOR_PAYMENT_TOKEN=quickstart-demo-token npm run dev
Full walkthrough: Quickstart.

Next

Endpoints

Every route’s request, response, and verified error codes.

Deploy patterns

Storage, keys, and the full environment checklist for running this server.