Skip to main content
Use emulators as libraries in your tests and scripts. There are two approaches: the @deploybaseline/cli package (which wraps all services) and the individual @deploybaseline/* scoped packages.

CLI package

The @deploybaseline/cli package provides a createEmulator helper that starts any service by name.
Each built-in emulator runs in its own Node process, as it does under the CLI, so starting one takes around 100 ms. Start one per test suite and call reset() between tests, as below, rather than one per test. close() stops the process. Custom emulators run in your test process.

Generated secrets

When a GitHub App omits private_key, createEmulator generates an RSA-2048 PKCS#1 key for that emulator instance:
Generated keys remain stable across reset() calls and appear only in generatedSecrets. Explicitly configured keys are never returned there. A new createEmulator call generates a new key.

Vitest / Jest setup

createEmulator options

OptionDefaultDescription
serviceService name: ‘github’, ‘google’, ‘slack’, ‘apple’, ‘microsoft’, ‘okta’, ‘resend’, ‘stripe’, ‘clerk’, ‘linear’, or ‘twilio’
port4000Port for the HTTP server
hostname127.0.0.1Listening address for built-in and custom emulators
seednoneInline seed data (same shape as a provider’s section in the config file)
baseUrlnoneOverride the advertised base URL (used in OAuth redirects, webhook URLs, etc.). Per-service baseUrl in seed config takes highest priority, then this option, then the BASELINE_BASE_URL env var (supports template), then .
statenoneKeep state across restarts: a JSON file path, sqlite:<path>, or libsql:// URL (locked to one emulator at a time), or a PersistenceAdapter such as sqliteState(). Saved state wins over seed. See Saved state.
resetStatefalseIgnore saved state, reseed, and overwrite it
saveDebounceMs250Wait after a change before saving; close() always saves
versionthis CLI’s rangeProvider version range for a built-in service, such as ‘^0.14’. The provider comes from the project’s node_modules, the provider cache, or a pull from npm. See Provider versions
offlinefalse (or BASELINE_OFFLINE=1)Never touch the network when finding the provider
faultsnoneInjected latency and errors, in the same shape as a service’s faults config. Also read from the service’s seed section. Off unless set. See Fault injection
Use hostname: '0.0.0.0' to allow connections from containers or other machines, and baseUrl to advertise a URL reachable by those clients. This option also applies to custom definitions passed to createEmulator.

Instance methods

MethodDescription
urlBase URL of the running server
generatedSecretsReadonly secrets generated while preparing seed data (reused from saved state when restored)
restoredtrue when the emulator started from saved state instead of seeding
reset()Wipe the store and replay seed data (saved too, with state). Returns a Promise: await it before the next request
flush()Write pending state now (with state)
snapshot()Resolves to the current state as a state file object
restore(state)Replace the current state with a snapshot() result, or a state file’s contents (object or JSON text). Resolves to
saveSnapshot(name)Save the current state under a name: a file next to state, otherwise in memory
restoreSnapshot(name)Replace the current state with a named snapshot
listSnapshots(), deleteSnapshot(name)List or delete named snapshots
close()Shut down the HTTP server, close WebSocket connections (code 1001), and save state; returns a Promise

Scoped packages

Each emulator is published as its own @deploybaseline/* package. Install only the ones you need:

Available packages

One package per provider, in the same categories as the Providers page, plus the kits they share:
PackageProviderWhat is emulated
Identity and auth
@deploybaseline/auth0Auth0Universal Login, OAuth and OIDC, Management API, role-based access control
@deploybaseline/clerkClerkFrontend API, Backend API, OAuth and OIDC, organizations, sessions, JWT templates
@deploybaseline/oktaOktaOAuth 2.0 and OIDC, authorization servers, users, groups, apps
@deploybaseline/appleAppleSign in with Apple: authorization, client secrets, ID tokens, server-to-server notifications
Workspace and productivity
@deploybaseline/googleGoogleOAuth 2.0 and OIDC, Gmail, Calendar, Drive, Sheets, Docs
@deploybaseline/microsoftMicrosoftEntra ID OAuth 2.0 and OIDC, Microsoft Graph: Outlook mail, calendar, contacts, To Do, users and groups; SharePoint Online and OneDrive over Graph and the SharePoint REST API
@deploybaseline/notionNotionPages, databases and data sources, queries, search, blocks, comments, OAuth, webhooks
Messaging and email
@deploybaseline/slackSlackWeb API, OAuth v2, incoming webhooks, interactivity, events, Socket Mode
@deploybaseline/discordDiscordBot REST API, Gateway over WebSocket, interactions, OAuth2, rate limits
@deploybaseline/twilioTwilioProgrammable Messaging, Messaging Services, Verify, Voice, Conversations
@deploybaseline/whatsappWhatsAppCloud API messages, templates, media, phone numbers and accounts, webhooks
@deploybaseline/resendResendEmails, idempotency, domains, API keys, audiences and contacts, a local inbox
@deploybaseline/sendgridSendGridMail Send, scheduling, templates, API keys, Marketing, Event Webhook, a local inbox
Payments and commerce
@deploybaseline/stripeStripeCustomers, Payment and Setup Intents, charges, refunds, subscriptions, invoices, Checkout, Connect, webhooks
@deploybaseline/paypalPayPalOrders v2, a hosted approval page, Payments v2, webhooks
@deploybaseline/squareSquarePayments, refunds, orders, customers, catalog, locations, OAuth, webhooks
@deploybaseline/plaidPlaidLink, items and accounts, transactions, institutions, sandbox helpers, webhooks
@deploybaseline/shopifyShopifyAdmin GraphQL API, OAuth, webhooks
Developer platforms
@deploybaseline/githubGitHubREST and GraphQL: repositories, issues, pull requests, organizations, webhooks, Actions, Checks, OAuth Apps and GitHub Apps
@deploybaseline/linearLinearGraphQL API, OAuth, webhooks
@deploybaseline/jiraJiraREST API, JQL search, Agile boards and sprints, OAuth 2.0 (3LO), webhooks
CRM and support
@deploybaseline/salesforceSalesforceRecords, SOQL, describe, sObject collections, composite requests, OAuth
@deploybaseline/hubspotHubSpotCRM objects, search, associations, properties, pipelines, owners, OAuth, webhooks
@deploybaseline/zendeskZendeskTickets, comments, users, organizations and groups, search, views, triggers, OAuth, webhooks
@deploybaseline/servicenowServiceNowTable API, Attachment API, Aggregate API
Finance and ERP
@deploybaseline/netsuiteNetSuiteRecords, transforms, SuiteQL, custom fields and records, metadata, OAuth 2.0
@deploybaseline/quickbooksQuickBooksAccounting entities, queries, batch, change data capture, OAuth 2.0, webhooks
@deploybaseline/xeroXeroAccounting API, OAuth 2.0 and OpenID Connect, webhooks
Shared
@deploybaseline/coreShared store, middleware, and utilities
@deploybaseline/graphqlGraphQL kit (Linear, GitHub, and Shopify run on it)
@deploybaseline/wsWebSocket kit (Slack Socket Mode and the Discord Gateway run on it, and bundle it)

Direct usage

Each scoped package exports its service plugin and seed helpers:
These are the same modules the CLI loads internally.

Custom emulators

Custom definitions created with defineEmulator from @deploybaseline/cli work in the CLI and in in-process tests. The same definition provides typed state, HTTP handlers, reset, versioned snapshots, and optional inspection/persistence. See Custom emulators for the quickstart, API reference, and complete lifecycle semantics.