Ultimate

Adapters

Every backend an app may swap is an adapter port: one row of ADAPTER_PORTS (packages/core/src/registrar.ts), one field of apps/web/runtime.ts. That file is the ONE place a backend is swapped — no setter on a package barrel, no env switch beside the default, no plugin API. Leave a field out and the boot builds the default the row names from the environment.

Writing your own adapter is four steps, the same for every port:

  1. Implement the interface, imported from the owning package's /adapter subpath.
  2. Copy the in-repo reference below — the memory one, where one ships.
  3. Prove it: behavesLike(<suite>, () => subject) in a test, the suite from @ultimat3/testing/conformance, behavesLike from @ultimat3/testing. The subject is your adapter, or — where a check needs more than the port to observe it — the suite's own <X>Subject object around it; each section below names its fields.
  4. Wire it: one field of apps/web/runtime.ts, which x dev and the container both read before a port is bound.
import type { RuntimeOverrides } from '@ultimat3/cli/serve';
import { memoryJobDriver } from '@ultimat3/jobs';

export const runtime = {
  jobs: memoryJobDriver(),
} satisfies RuntimeOverrides;

runtime.ts runs BEFORE its own ports are installed: import no app module that seals a secret or builds auth at module scope. In a test, await swapAdapter(port, impl) from @ultimat3/testing installs one for that test alone, through the same installer the boot calls; a port it cannot swap is listed in its UNSWAPPED with what a test does instead.

bun run scripts/adapter-ports.ts --json lists every port with its five parts; a part missing is X_ADAPTER_PORT_INCOMPLETE on the boundaries step. A part marked pending below is on that guard's ratchet (scripts/lib/adapter-port-pins.ts) and is being built.

PortInterfacePackage
aiGatewayGateway@ultimat3/ai
auditSinkAuditSink@ultimat3/core
authLimiterAuthLimiterFactory@ultimat3/auth
authServerStoreAuthServerStore@ultimat3/auth
cacheTiersCacheTier@ultimat3/cache
clockSleepClock@ultimat3/core
embedderEmbedder@ultimat3/ai
errorReporterErrorReporter@ultimat3/core
eventBusEventBus@ultimat3/jobs
failureStoreFailureStore@ultimat3/core
idempotencyStoreIdempotencyStore@ultimat3/action
imagesImageTransformDriver@ultimat3/seo
isrStoreIsrStore@ultimat3/render
jobsJobDriver@ultimat3/jobs
mailMailDriver@ultimat3/mail
mcpConfirmationStoreMcpConfirmationStore@ultimat3/mcp
meterStoreMeterStore@ultimat3/action
notifyStoresNotifyStores@ultimat3/notify
outboxStoreOutboxStore@ultimat3/jobs
purgePurgeDriver@ultimat3/cache
pushSubscriptionStorePushSubscriptionStore@ultimat3/pwa
rateLimitStoreRateLimitStore@ultimat3/http
scrapeDriverScrapeDriver@ultimat3/scraping
searchIndexSearchIndex@ultimat3/entity
secretSourceSecretSource@ultimat3/core
semanticCacheSemanticCacheFactory@ultimat3/ai
smsTransportSmsTransport@ultimat3/notify
storageStorageDriver@ultimat3/storage
totpReplayTotpReplayGuard@ultimat3/auth
transportTransport@ultimat3/realtime
uploadScannerUploadScanner@ultimat3/storage

aiGateway

PartValue
InterfaceGateway from @ultimat3/ai/adapter
Defaultnone: the first model call is refused (X_AI_GATEWAY_MISSING)
CopyproviderGateway in packages/ai/src/gateway.ts — over echoProvider() (packages/ai/src/echo-provider.ts): a gateway that never leaves the process
ProvebehavesLike(gatewayConformance, () => ({ gateway, model }))
WireaiGateway: … in apps/web/runtime.ts, typed Gateway
Bootinstalled by installAiGateway (services phase)

auditSink

PartValue
InterfaceAuditSink from @ultimat3/core/adapter
Defaultnone: an audit: true primitive is refused (X_AUDIT_SINK_MISSING)
CopymemoryAuditSink in packages/action/src/audit-memory.ts
ProvebehavesLike(auditSinkConformance, () => ({ sink, kept, persists }))
WireauditSink: … in apps/web/runtime.ts, typed AuditSink
Bootinstalled by installAuditSink (services phase)

authLimiter

PartValue
InterfaceAuthLimiterFactory from @ultimat3/auth/adapter
DefaultpostgresAuthLimiter over DATABASE_URL
CopymemoryAuthLimiter in packages/auth/src/rate-limit.ts — the port is the factory: (policy) => memoryAuthLimiter(clock, policy)
ProvebehavesLike(authLimiterFactoryConformance, () => ({ factory, clock }))
WireauthLimiter: … in apps/web/runtime.ts, typed AuthLimiterFactory
Bootinstalled by installAuthLimiters (services phase)

authServerStore

PartValue
InterfaceAuthServerStore from @ultimat3/auth/adapter
DefaultpostgresAuthServerStore over DATABASE_URL
CopymemoryAuthServerStore in packages/auth/src/authorization-server-store.ts
ProvebehavesLike(authServerStoreConformance, () => store)
WireauthServerStore: … in apps/web/runtime.ts, typed AuthServerStore
Bootinstalled by installAuthServerStore (services phase)

cacheTiers

PartValue
InterfaceCacheTier from @ultimat3/cache/adapter
Defaultthe rungs cache.tiers names; 'redis' reads REDIS_URL
CopylruTier in packages/cache/src/lru.ts
ProvebehavesLike(cacheTierConformance, () => tier)
WirecacheTiers: … in apps/web/runtime.ts, typed readonly CacheTier[]
Bootread as a value by runtime-cache.ts, each replacing the rung of its own name

clock

PartValue
InterfaceSleepClock from @ultimat3/core/adapter
DefaultsystemClock
CopysystemClock in packages/core/src/sleep-clock.ts — noWaitClock beside it is the one a test hands a run that must not wait
ProvebehavesLike(sleepClockConformance, () => clock)
Wireclock: … in apps/web/runtime.ts, typed SleepClock
Bootinstalled by installClock (boot phase)

embedder

PartValue
InterfaceEmbedder from @ultimat3/ai/adapter
DefaulthashEmbedder: deterministic, offline and lexical, never a network call
CopyhashEmbedder in packages/ai/src/embeddings.ts — a network embedder is remoteEmbedder (packages/ai/src/remote-embedder.ts)
ProvebehavesLike(embedderConformance, () => embedder)
Wireembedder: … in apps/web/runtime.ts, typed Embedder
Bootinstalled by installAiEmbedder (services phase)

errorReporter

PartValue
InterfaceErrorReporter from @ultimat3/core/adapter
DefaultSENTRY_DSN set: sentryErrorReporter; unset: the log line only
CopymemoryErrorReporter in packages/core/src/error-reporter.ts
ProvebehavesLike(errorReporterConformance, () => reporter)
WireerrorReporter: … in apps/web/runtime.ts, typed ErrorReporter
Bootinstalled by installErrorReporter (services phase)

eventBus

PartValue
InterfaceEventBus from @ultimat3/jobs/adapter
DefaultpostgresEventBus over DATABASE_URL
CopymemoryEventBus in packages/jobs/src/events.ts
ProvebehavesLike(eventBusConformance, () => ({ bus, elapse }))
WireeventBus: … in apps/web/runtime.ts, typed EventBus
Bootinstalled by installEventBus (queue phase)

failureStore

PartValue
InterfaceFailureStore from @ultimat3/core/adapter
DefaultpostgresFailureStore over DATABASE_URL, while failureCapture is on
CopypostgresFailureStore in packages/db/src/failure-store-pg.ts — no memory store ships: the Postgres one is the reference
ProvebehavesLike(failureStoreConformance, () => ({ store, find, client }))
WirefailureStore: … in apps/web/runtime.ts, typed FailureStore
Bootread as a value by failure-capture-boot.ts, while failureCapture is on

idempotencyStore

PartValue
InterfaceIdempotencyStore from @ultimat3/action/adapter
DefaultpostgresIdempotencyStore over DATABASE_URL
CopymemoryIdempotencyStore in packages/action/src/idempotency-memory.ts
ProvebehavesLike(idempotencyStoreConformance, () => ({ store, client, reclaimAfterMs, age, reset }))
WireidempotencyStore: … in apps/web/runtime.ts, typed IdempotencyStore
Bootinstalled by installIdempotencyStore (queue phase)

images

PartValue
InterfaceImageTransformDriver from @ultimat3/seo/adapter
DefaultbuiltinImageDriver
CopybuiltinImageDriver in packages/seo/src/image-driver.ts
ProvebehavesLike(imageTransformDriverConformance, () => driver)
Wireimages: … in apps/web/runtime.ts, typed ImageTransformDriver
Bootread as a value by serve-web.ts, the /media/* transform

isrStore

PartValue
InterfaceIsrStore from @ultimat3/render/adapter
Defaulta memory store per process
CopymemoryIsrStore in packages/render/src/render-isr-store.ts
ProvebehavesLike(isrStoreConformance, () => store)
WireisrStore: … in apps/web/runtime.ts, typed IsrStore
Bootread as a value by serve-web.ts, the ISR controller

jobs

PartValue
InterfaceJobDriver from @ultimat3/jobs/adapter
DefaultpostgresJobDriver over DATABASE_URL
CopymemoryJobDriver in packages/jobs/src/driver-memory.ts
ProvebehavesLike(jobDriverConformance, () => driver)
Wirejobs: … in apps/web/runtime.ts, typed JobDriver
Bootinstalled by installJobDriver (queue phase)

mail

PartValue
InterfaceMailDriver from @ultimat3/mail/adapter
DefaultSMTP_URL: smtp; RESEND_API_KEY: resend; SES_REGION: ses; none: memory in development/test, refused at the first send elsewhere
CopymemoryMailDriver in packages/mail/src/driver.ts
ProvebehavesLike(mailDriverConformance, () => driver)
Wiremail: … in apps/web/runtime.ts, typed MailDriver
Bootinstalled by installMailDriver (services phase)

mcpConfirmationStore

PartValue
InterfaceMcpConfirmationStore from @ultimat3/mcp/adapter
DefaultpostgresConfirmationStore over DATABASE_URL
CopymemoryConfirmationStore in packages/mcp/src/confirmation-store.ts
ProvebehavesLike(mcpConfirmationStoreConformance, () => store)
WiremcpConfirmationStore: … in apps/web/runtime.ts, typed McpConfirmationStore
Bootinstalled by installConfirmationStore (services phase)

meterStore

PartValue
InterfaceMeterStore from @ultimat3/action/adapter
DefaultpostgresMeterStore over DATABASE_URL
CopymemoryMeterStore in packages/action/src/meter-memory.ts
ProvebehavesLike(meterStoreConformance, () => store)
WiremeterStore: … in apps/web/runtime.ts, typed MeterStore
Bootinstalled by installMeterStore (queue phase)

notifyStores

PartValue
InterfaceNotifyStores from @ultimat3/notify/adapter
DefaultPostgres delivery ledger when the app has a database; memory in development/test; refused elsewhere (X_NOTIFY_STORE_MISSING); allow-all preferences, no inbox, no digest
CopymemoryDeliveryLedger in packages/notify/src/ledger.ts — one member of four: memoryPreferenceStore, memoryInboxStore and memoryDigestStore are the others, one file each
ProvebehavesLike(notifyStoresConformance, () => ({ ledger, inbox, preferences, digest }))
WirenotifyStores: … in apps/web/runtime.ts, typed NotifyStores
Bootinstalled by installNotifyStores (services phase)

outboxStore

PartValue
InterfaceOutboxStore from @ultimat3/jobs/adapter
DefaultpostgresOutboxStore over DATABASE_URL
CopymemoryOutboxStore in packages/jobs/src/outbox.ts
ProvebehavesLike(outboxStoreConformance, () => ({ relay, claimLeaseMs, transaction, elapse }))
WireoutboxStore: … in apps/web/runtime.ts, typed OutboxStore
Bootread as a value by runtime-queue.ts, behind the jobs facade with the jobs port

purge

PartValue
InterfacePurgeDriver from @ultimat3/cache/adapter
DefaultCLOUDFLARE_API_TOKEN + CLOUDFLARE_ZONE_ID: cloudflare; FASTLY_API_TOKEN + FASTLY_SERVICE_ID: fastly; neither: none
CopynoopPurgeDriver in packages/cache/src/cdn.ts
ProvebehavesLike(purgeDriverConformance, () => ({ driver, refused }))
Wirepurge: … in apps/web/runtime.ts, typed PurgeDriver
Bootread as a value by runtime-cache.ts, the cdn tier

pushSubscriptionStore

PartValue
InterfacePushSubscriptionStore from @ultimat3/pwa/adapter
DefaultpostgresPushSubscriptionStore over DATABASE_URL, while VAPID keys are set
CopymemoryPushSubscriptionStore in packages/pwa/src/push-store.ts
ProvebehavesLike(pushSubscriptionStoreConformance, () => store)
WirepushSubscriptionStore: … in apps/web/runtime.ts, typed PushSubscriptionStore
Bootread as a value by runtime-push.ts, while pwa.vapid is set

rateLimitStore

PartValue
InterfaceRateLimitStore from @ultimat3/http/adapter
DefaultpostgresRateLimitStore over DATABASE_URL
CopymemoryRateLimitStore in packages/http/src/rate-limit.ts
ProvebehavesLike(rateLimitStoreConformance, () => store)
WirerateLimitStore: … in apps/web/runtime.ts, typed RateLimitStore
Bootinstalled by installRateLimitStore (services phase)

scrapeDriver

PartValue
InterfaceScrapeDriver from @ultimat3/scraping/adapter
Defaultnone: a scrape() declaring no driver is refused at its first run
CopyfakeBrowser in packages/scraping/src/driver-fake.ts
ProvebehavesLike(scrapeDriverConformance, () => driver)
WirescrapeDriver: … in apps/web/runtime.ts, typed ScrapeDriver
Bootinstalled by installScrapeDriver (services phase)

searchIndex

PartValue
InterfaceSearchIndex from @ultimat3/entity/adapter
DefaultpostgresSearchIndex: .searchable()'s generated tsvector, over the app's pool
CopymemorySearchIndex in packages/entity/src/search-index-memory.ts — the built-in postgresSearchIndex (search-index-postgres.ts) reads .searchable()'s generated tsvector and writes nothing on index
ProvebehavesLike(searchIndexConformance, () => ({ index, entity, store, drop }))
WiresearchIndex: … in apps/web/runtime.ts, typed SearchIndex
Bootinstalled by installSearchIndex (services phase)

secretSource

PartValue
InterfaceSecretSource from @ultimat3/core/adapter
DefaultULTIMATE_SECRETS_KEY, then the .secrets.key file
CopyenvSecretSource in packages/core/src/secret-source.ts
ProvebehavesLike(secretSourceConformance, () => ({ source, holding, empty }))
WiresecretSource: … in apps/web/runtime.ts, typed SecretSource
Bootinstalled by installSecretSource (boot phase)

semanticCache

PartValue
InterfaceSemanticCacheFactory from @ultimat3/ai/adapter
Defaulta memorySemanticCache per scope, per process
CopymemorySemanticCache in packages/cache/src/semantic.ts — the port is the factory: (scope) => memorySemanticCache(), one cache per scope
ProvebehavesLike(semanticCacheFactoryConformance, () => factory)
WiresemanticCache: … in apps/web/runtime.ts, typed SemanticCacheFactory
Bootinstalled by installSemanticCache (services phase)

smsTransport

PartValue
InterfaceSmsTransport from @ultimat3/notify/adapter
Defaultmemory in development/test; refused at the first send elsewhere (X_NOTIFY_SMS_TRANSPORT_MISSING)
CopymemorySmsTransport in packages/notify/src/sms-transport.ts
ProvebehavesLike(smsTransportConformance, () => transport)
WiresmsTransport: … in apps/web/runtime.ts, typed SmsTransport
Bootinstalled by installSmsTransport (services phase)

storage

PartValue
InterfaceStorageDriver from @ultimat3/storage/adapter
DefaultS3_ENDPOINT set: s3; unset: the embedded disk
CopymemoryStorageDriver in packages/storage/src/driver-memory.ts
ProvebehavesLike(storageDriverConformance, () => driver)
Wirestorage: … in apps/web/runtime.ts, typed StorageDriver
Bootread as a value by runtime-storage-boot.ts, the default disk

totpReplay

PartValue
InterfaceTotpReplayGuard from @ultimat3/auth/adapter
DefaultpostgresTotpReplayGuard over DATABASE_URL
CopymemoryTotpReplayGuard in packages/auth/src/mfa.ts
ProvebehavesLike(totpReplayGuardConformance, () => guard)
WiretotpReplay: … in apps/web/runtime.ts, typed TotpReplayGuard
Bootinstalled by installTotpReplay (services phase)

transport

PartValue
InterfaceTransport from @ultimat3/realtime/adapter
DefaultNATS_URL set: nats; unset: memory (one node)
CopyInProcessTransport in packages/realtime/src/fanout.ts
ProvebehavesLike(transportConformance, () => transport)
Wiretransport: … in apps/web/runtime.ts, typed Transport
Bootread as a value by runtime-bus.ts, which installs the channel transport it dials

uploadScanner

PartValue
InterfaceUploadScanner from @ultimat3/storage/adapter
Defaultnone: promoteAttachment scans nothing
CopymemoryUploadScanner in packages/storage/src/upload-scanner-memory.ts
ProvebehavesLike(uploadScannerConformance, () => scanner)
WireuploadScanner: … in apps/web/runtime.ts, typed UploadScanner
Bootinstalled by installUploadScanner (services phase)

Edit this page on GitHubThis page as markdown