Emulate Seed Configs
Generate and manage seed configs for emulate (Apache-2.0) — Vercel Labs' stateful API emulation tool. Each category has individual rule files in rules/ loaded on-demand.
Paired agent: This skill pairs with the emulate-engineer subagent (subagent_type: "emulate-engineer"). When a task involves generating a full emulate config from scratch, webhook HMAC setup, CI pipeline integration, or parallel-worker port isolation, spawn the agent rather than handling it inline — it has the full 12-emulator service-port matrix and seed-rules in context.
Not mocks. Emulate provides full state machines with cascading deletes, cursor pagination, webhook delivery, and HMAC signature verification. Create a PR via the API and it appears in GET /repos/:owner/:repo/pulls. Delete a repo and its issues, PRs, and webhooks cascade-delete.
New in 2026-04 (emulate 0.4.x)
- Modular
@emulators/* packages — each service is its own package (@emulators/github, @emulators/stripe, etc.); top-level emulate re-exports createEmulator and the CLI.
- 4 new services (12 total):
mongoatlas:4007, okta:4008, resend:4009, stripe:4010 with drop-in seed YAML blocks.
- Resend local inbox —
GET http://localhost:4009/inbox returns captured emails for assertions without hitting a real provider.
- Stripe hosted checkout — real session redirect flow +
checkout.session.completed/expired webhook delivery, suitable for E2E payment tests.
- MongoDB Atlas — Admin API v2 (projects/clusters/DB users) + Data API v1 with full CRUD + aggregate.
- Okta OIDC — full discovery, JWKS,
authorize/token/userinfo/revoke/introspect plus Users/Groups/Apps CRUD.
- Entra / Apple / Slack expansions (v0.4.0) — PKCE + refresh rotation (Entra), RS256 JWKS (Apple), OAuth v2 consent UI (Slack).
@emulators/adapter-next — catch-all Next.js route handler runs emulators on the same origin as the app; fixes OAuth callback URL drift on Vercel preview deploys.
Quick Reference
| Category |
Rules |
Impact |
When to Use |
| Seed Config |
1 |
HIGH |
Setting up emulate.config.yaml for test environments |
| Service Selection |
1 |
MEDIUM |
Choosing GitHub/Vercel/Google for your tests |
| Webhook Setup |
1 |
MEDIUM |
Testing webhook delivery with HMAC verification |
| Parallel CI |
1 |
HIGH |
Running tests in parallel without port collisions |
| Auth Tokens |
1 |
MEDIUM |
Seeding tokens mapped to emulated users |
Total: 5 rules across 5 categories
Quick Start
# Install (packages published under @emulators/* scope)
npm install --save-dev emulate
# Start all services
npx emulate
# Start specific services with seed data
npx emulate --service github,stripe --seed ./emulate.config.yaml
# Generate a starter config
npx emulate init --service github
Services (0.4.1 — 12 emulators)
| Service |
Default Port |
Coverage |
| Vercel |
:4000 |
Projects, deployments, domains, env vars, teams |
| GitHub |
:4001 |
Repos, PRs, issues, comments, reviews, Actions, webhooks, orgs, teams |
| Google OAuth |
:4002 |
OAuth 2.0 authorize, token exchange, userinfo |
| Slack |
:4003 |
Chat, conversations, users, reactions, OAuth v2 with consent UI |
| Apple Auth |
:4004 |
Sign in with Apple — OIDC discovery, JWKS (RS256), auth flow, token exchange |
| Microsoft Entra |
:4005 |
OAuth 2.0/OIDC v2.0, authorization code + PKCE, refresh token rotation, v1 token endpoint, Graph /users/{id} |
| AWS |
:4006 |
S3 buckets, SQS queues, IAM users/roles, STS identity |
| MongoDB Atlas (0.4+) |
:4007 |
Admin API v2 (projects, clusters, DB users) + Data API v1 (full CRUD + aggregate) |
| Okta (0.4+) |
:4008 |
OIDC discovery, JWKS, authorize/token/userinfo/revoke/introspect, Users/Groups/Apps CRUD |
| Resend (0.4+) |
:4009 |
Send + batch (100/req), list/retrieve/cancel, domains, API keys, audiences, contacts, local inbox (GET /inbox) |
| Stripe (0.4+) |
:4010 |
Customers, payment methods, customer sessions, payment intents, charges, products, prices, hosted checkout session w/ webhook delivery |
| Clerk |
(on-demand) |
Users, sessions, organizations |
See references/api-coverage.md for full endpoint lists.
Next.js Adapter (0.4+) — @emulators/adapter-next
Runs emulators on the same origin as your Next.js app via a catch-all route handler. Fixes the OAuth callback URL drift problem on Vercel preview deploys — no more http://localhost:4001 redirect mismatches.
// next.config.js
const { withEmulate } = require('@emulators/adapter-next')
module.exports = withEmulate({ /* your next config */ })
// app/api/[...emulate]/route.ts
import { createEmulateHandler } from '@emulators/adapter-next'
export const { GET, POST } = createEmulateHandler({
services: ['github', 'stripe', 'resend'],
persistence: { /* load(), save() or built-in filePersistence */ },
})
Seed Config Structure
A seed config pre-populates the emulator with tokens, users, repos, and projects so tests start from a known state.
# emulate.config.yaml
tokens:
dev_token:
login: yonatangross
scopes: [repo, workflow, admin:org]
ci_token:
login: ci-bot
scopes: [repo]
github:
users:
- login: yonatangross
name: Yonatan Gross
- login: ci-bot
name: CI Bot
repos:
- owner: yonatangross
name: my-project
private: false
default_branch: main
topics: [typescript, testing]
vercel:
users:
- username: yonatangross
email: yonaigross@gmail.com
projects:
- name: my-docs
framework: next
# NEW in 0.4.x — drop-in seed blocks
okta:
users:
- login: alice@example.com
firstName: Alice
lastName: Smith
groups: [{ name: Everyone }, { name: Admins }]
apps: [{ name: My Web App }]
authorization_servers:
- name: default
audiences: ["api://default"]
resend:
domains: [{ name: example.com }]
api_keys: [{ name: default }]
# In tests: GET http://localhost:4009/inbox to assert captured emails
stripe:
customers:
- name: Test Customer
email: customer@example.com
products: [{ name: Pro Plan }, { name: Starter Plan }]
prices:
- { product: Pro Plan, unit_amount: 4900, currency: usd, recurring: { interval: month } }
- { product: Starter Plan, unit_amount: 1900, currency: usd, recurring: { interval: month } }
# Webhook delivery fires on checkout.session.completed / expired
mongoatlas:
projects: [{ name: my-project }]
clusters: [{ project: my-project, name: my-cluster }]
database_users: [{ project: my-project, username: app-user }]
See rules/seed-config.md for full schema and best practices.
Programmatic SDK
Service packages live under the @emulators/* scope (e.g., @emulators/github, @emulators/stripe). The programmatic API (createEmulator) is exported from the top-level emulate package.
import { createEmulator } from 'emulate'
const github = await createEmulator({ service: 'github', port: 4001 })
// github.url -> 'http://localhost:4001'
// State is real — create a PR and it appears in the list
const res = await fetch(`${github.url}/repos/org/repo/pulls`, {
method: 'POST',
headers: { Authorization: 'Bearer dev_token' },
body: JSON.stringify({ title: 'Test PR', head: 'feature', base: 'main' })
})
const prs = await fetch(`${github.url}/repos/org/repo/pulls`)
// -> includes the PR we just created
// Cleanup
github.reset() // Synchronous state wipe
await github.close() // Shut down server
See references/sdk-patterns.md for advanced patterns (multi-service, lifecycle hooks).
Webhook Delivery
Emulate delivers real webhooks with HMAC-SHA256 signatures when state changes:
import crypto from 'crypto'
function verifyWebhook(payload: string, signature: string, secret: string): boolean {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex')
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
}
See rules/webhook-setup.md for webhook receiver patterns.
CI Integration
# .github/workflows/test.yml
jobs:
test:
steps:
- uses: actions/checkout@v4
- name: Start emulate
run: npx emulate --service github --seed .emulate/ci.yaml &
- name: Wait for emulate
run: sleep 2
- name: Run tests
run: npm test
env:
GITHUB_API_BASE: http://localhost:4001
VERCEL_API_BASE: http://localhost:4000
Parallel Test Execution
Each test worker gets its own port to avoid race conditions:
// vitest.config.ts
const workerPort = 4001 + parseInt(process.env.VITEST_WORKER_ID || '0')
See rules/parallel-ci.md for full parallel isolation patterns.
Decision Matrix
| Tool |
When to Use |
Stateful? |
Platforms |
| emulate (FIRST CHOICE) |
GitHub/Vercel/Google/Slack/Apple/Entra/AWS/Okta/Resend/Stripe/MongoDB testing |
YES |
All 12 services |
| Pact |
Contract verification between services |
No |
Any |
| MSW |
In-browser/Node HTTP mocking |
No |
Any |
| Nock |
Node.js HTTP intercept |
No |
Any |
| WireMock |
HTTP stub server |
Partial |
Any |
Use emulate when:
- Testing code that calls GitHub, Vercel, Google, Slack, Apple, Entra, AWS, Okta, Resend, Stripe, or MongoDB Atlas
- You need state persistence across multiple API calls in a test
- You want webhook delivery with real HMAC signatures (GitHub, Stripe)
- You need cascading side-effects (delete repo -> PRs cascade-delete)
- You need to assert on sent emails without hitting a real provider (Resend local
/inbox)
- You need hosted Stripe checkout sessions with real redirect flow in tests
Use MSW/Nock when:
- Mocking arbitrary HTTP APIs not covered by emulate
- You need in-browser interception (MSW)
- Tests only need single request/response pairs
Related Skills
testing-integration — Integration test patterns (emulate as first choice for API tests)
testing-e2e — End-to-end test patterns with emulated backends
testing-unit — Unit test patterns (use emulate for API-dependent units)
security-patterns — Auth token patterns (emulate token seeding)
CLI Reference
See references/cli-reference.md for all CLI flags and commands.
SDK Patterns
See references/sdk-patterns.md for programmatic createEmulate() usage.
1---2name: emulate-seed3description: "Generate emulate seed configs for stateful API emulation. Wraps Vercel's emulate tool for GitHub, Vercel, Google OAuth, Slack, Apple Auth, Microsoft Entra, AWS (S3/SQS/IAM), Okta, Resend, Stripe, and MongoDB Atlas APIs. Not mocks — full state machines where create-a-PR-and-it-appears-in-the-list, send-an-email-and-retrieve-from-local-inbox. Use when setting up test environments, CI pipelines, integration tests, or offline development."4tags: [emulate, testing, api-emulation, github, vercel, google, stripe, resend, okta, mongodb, seed, ci, stateful-testing]5version: 1.2.06author: OrchestKit7user-invocable: false8disable-model-invocation: false9complexity: medium10context: inherit11persuasion-type: guidance12agent: emulate-engineer13metadata:14 source: https://skillmd.com/skills/aibot88/emulate-seed15 category: testing16 upstream-package: emulate17 upstream-version-tested: "0.4.1"18---1920# Emulate Seed Configs2122Generate and manage seed configs for [emulate](https://github.com/vercel-labs/emulate) (Apache-2.0) — Vercel Labs' stateful API emulation tool. Each category has individual rule files in `rules/` loaded on-demand.2324> **Paired agent:** This skill pairs with the [`emulate-engineer`](../../agents/emulate-engineer.md) subagent (`subagent_type: "emulate-engineer"`). When a task involves generating a full emulate config from scratch, webhook HMAC setup, CI pipeline integration, or parallel-worker port isolation, spawn the agent rather than handling it inline — it has the full 12-emulator service-port matrix and seed-rules in context.2526**Not mocks.** Emulate provides full state machines with cascading deletes, cursor pagination, webhook delivery, and HMAC signature verification. Create a PR via the API and it appears in `GET /repos/:owner/:repo/pulls`. Delete a repo and its issues, PRs, and webhooks cascade-delete.2728## New in 2026-04 (emulate 0.4.x)2930- **Modular `@emulators/*` packages** — each service is its own package (`@emulators/github`, `@emulators/stripe`, etc.); top-level `emulate` re-exports `createEmulator` and the CLI.31- **4 new services** (12 total): `mongoatlas:4007`, `okta:4008`, `resend:4009`, `stripe:4010` with drop-in seed YAML blocks.32- **Resend local inbox** — `GET http://localhost:4009/inbox` returns captured emails for assertions without hitting a real provider.33- **Stripe hosted checkout** — real session redirect flow + `checkout.session.completed`/`expired` webhook delivery, suitable for E2E payment tests.34- **MongoDB Atlas** — Admin API v2 (projects/clusters/DB users) + Data API v1 with full CRUD + aggregate.35- **Okta OIDC** — full discovery, JWKS, `authorize/token/userinfo/revoke/introspect` plus Users/Groups/Apps CRUD.36- **Entra / Apple / Slack expansions (v0.4.0)** — PKCE + refresh rotation (Entra), RS256 JWKS (Apple), OAuth v2 consent UI (Slack).37- **`@emulators/adapter-next`** — catch-all Next.js route handler runs emulators on the same origin as the app; fixes OAuth callback URL drift on Vercel preview deploys.3839## Quick Reference4041| Category | Rules | Impact | When to Use |42|----------|-------|--------|-------------|43| [Seed Config](#seed-config) | 1 | HIGH | Setting up emulate.config.yaml for test environments |44| [Service Selection](#service-selection) | 1 | MEDIUM | Choosing GitHub/Vercel/Google for your tests |45| [Webhook Setup](#webhook-setup) | 1 | MEDIUM | Testing webhook delivery with HMAC verification |46| [Parallel CI](#parallel-ci) | 1 | HIGH | Running tests in parallel without port collisions |47| [Auth Tokens](#auth-tokens) | 1 | MEDIUM | Seeding tokens mapped to emulated users |4849**Total: 5 rules across 5 categories**5051## Quick Start5253```bash54# Install (packages published under @emulators/* scope)55npm install --save-dev emulate5657# Start all services58npx emulate5960# Start specific services with seed data61npx emulate --service github,stripe --seed ./emulate.config.yaml6263# Generate a starter config64npx emulate init --service github65```6667## Services (0.4.1 — 12 emulators)6869| Service | Default Port | Coverage |70|---------|-------------|----------|71| **Vercel** | `:4000` | Projects, deployments, domains, env vars, teams |72| **GitHub** | `:4001` | Repos, PRs, issues, comments, reviews, Actions, webhooks, orgs, teams |73| **Google OAuth** | `:4002` | OAuth 2.0 authorize, token exchange, userinfo |74| **Slack** | `:4003` | Chat, conversations, users, reactions, OAuth v2 with consent UI |75| **Apple Auth** | `:4004` | Sign in with Apple — OIDC discovery, JWKS (RS256), auth flow, token exchange |76| **Microsoft Entra** | `:4005` | OAuth 2.0/OIDC v2.0, authorization code + PKCE, refresh token rotation, v1 token endpoint, Graph `/users/{id}` |77| **AWS** | `:4006` | S3 buckets, SQS queues, IAM users/roles, STS identity |78| **MongoDB Atlas** *(0.4+)* | `:4007` | Admin API v2 (projects, clusters, DB users) + Data API v1 (full CRUD + aggregate) |79| **Okta** *(0.4+)* | `:4008` | OIDC discovery, JWKS, authorize/token/userinfo/revoke/introspect, Users/Groups/Apps CRUD |80| **Resend** *(0.4+)* | `:4009` | Send + batch (100/req), list/retrieve/cancel, domains, API keys, audiences, contacts, **local inbox** (`GET /inbox`) |81| **Stripe** *(0.4+)* | `:4010` | Customers, payment methods, customer sessions, payment intents, charges, products, prices, **hosted checkout session** w/ webhook delivery |82| **Clerk** | (on-demand) | Users, sessions, organizations |8384See `references/api-coverage.md` for full endpoint lists.8586### Next.js Adapter (0.4+) — `@emulators/adapter-next`8788Runs emulators **on the same origin** as your Next.js app via a catch-all route handler. Fixes the OAuth callback URL drift problem on Vercel preview deploys — no more `http://localhost:4001` redirect mismatches.8990```typescript91// next.config.js92const { withEmulate } = require('@emulators/adapter-next')93module.exports = withEmulate({ /* your next config */ })9495// app/api/[...emulate]/route.ts96import { createEmulateHandler } from '@emulators/adapter-next'97export const { GET, POST } = createEmulateHandler({98 services: ['github', 'stripe', 'resend'],99 persistence: { /* load(), save() or built-in filePersistence */ },100})101```102103## Seed Config Structure104105A seed config pre-populates the emulator with tokens, users, repos, and projects so tests start from a known state.106107```yaml108# emulate.config.yaml109tokens:110 dev_token:111 login: yonatangross112 scopes: [repo, workflow, admin:org]113 ci_token:114 login: ci-bot115 scopes: [repo]116117github:118 users:119 - login: yonatangross120 name: Yonatan Gross121 - login: ci-bot122 name: CI Bot123 repos:124 - owner: yonatangross125 name: my-project126 private: false127 default_branch: main128 topics: [typescript, testing]129130vercel:131 users:132 - username: yonatangross133 email: yonaigross@gmail.com134 projects:135 - name: my-docs136 framework: next137138# NEW in 0.4.x — drop-in seed blocks139okta:140 users:141 - login: alice@example.com142 firstName: Alice143 lastName: Smith144 groups: [{ name: Everyone }, { name: Admins }]145 apps: [{ name: My Web App }]146 authorization_servers:147 - name: default148 audiences: ["api://default"]149150resend:151 domains: [{ name: example.com }]152 api_keys: [{ name: default }]153 # In tests: GET http://localhost:4009/inbox to assert captured emails154155stripe:156 customers:157 - name: Test Customer158 email: customer@example.com159 products: [{ name: Pro Plan }, { name: Starter Plan }]160 prices:161 - { product: Pro Plan, unit_amount: 4900, currency: usd, recurring: { interval: month } }162 - { product: Starter Plan, unit_amount: 1900, currency: usd, recurring: { interval: month } }163 # Webhook delivery fires on checkout.session.completed / expired164165mongoatlas:166 projects: [{ name: my-project }]167 clusters: [{ project: my-project, name: my-cluster }]168 database_users: [{ project: my-project, username: app-user }]169```170171See `rules/seed-config.md` for full schema and best practices.172173## Programmatic SDK174175> Service packages live under the `@emulators/*` scope (e.g., `@emulators/github`, `@emulators/stripe`). The programmatic API (`createEmulator`) is exported from the top-level `emulate` package.176177```typescript178import { createEmulator } from 'emulate'179180const github = await createEmulator({ service: 'github', port: 4001 })181// github.url -> 'http://localhost:4001'182183// State is real — create a PR and it appears in the list184const res = await fetch(`${github.url}/repos/org/repo/pulls`, {185 method: 'POST',186 headers: { Authorization: 'Bearer dev_token' },187 body: JSON.stringify({ title: 'Test PR', head: 'feature', base: 'main' })188})189190const prs = await fetch(`${github.url}/repos/org/repo/pulls`)191// -> includes the PR we just created192193// Cleanup194github.reset() // Synchronous state wipe195await github.close() // Shut down server196```197198See `references/sdk-patterns.md` for advanced patterns (multi-service, lifecycle hooks).199200## Webhook Delivery201202Emulate delivers real webhooks with HMAC-SHA256 signatures when state changes:203204```typescript205import crypto from 'crypto'206207function verifyWebhook(payload: string, signature: string, secret: string): boolean {208 const expected = 'sha256=' + crypto209 .createHmac('sha256', secret)210 .update(payload)211 .digest('hex')212 return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))213}214```215216See `rules/webhook-setup.md` for webhook receiver patterns.217218## CI Integration219220```yaml221# .github/workflows/test.yml222jobs:223 test:224 steps:225 - uses: actions/checkout@v4226 - name: Start emulate227 run: npx emulate --service github --seed .emulate/ci.yaml &228 - name: Wait for emulate229 run: sleep 2230 - name: Run tests231 run: npm test232 env:233 GITHUB_API_BASE: http://localhost:4001234 VERCEL_API_BASE: http://localhost:4000235```236237### Parallel Test Execution238239Each test worker gets its own port to avoid race conditions:240241```typescript242// vitest.config.ts243const workerPort = 4001 + parseInt(process.env.VITEST_WORKER_ID || '0')244```245246See `rules/parallel-ci.md` for full parallel isolation patterns.247248## Decision Matrix249250| Tool | When to Use | Stateful? | Platforms |251|------|------------|-----------|-----------|252| **emulate** (FIRST CHOICE) | GitHub/Vercel/Google/Slack/Apple/Entra/AWS/Okta/Resend/Stripe/MongoDB testing | YES | All 12 services |253| Pact | Contract verification between services | No | Any |254| MSW | In-browser/Node HTTP mocking | No | Any |255| Nock | Node.js HTTP intercept | No | Any |256| WireMock | HTTP stub server | Partial | Any |257258**Use emulate when:**259- Testing code that calls GitHub, Vercel, Google, Slack, Apple, Entra, AWS, Okta, Resend, Stripe, or MongoDB Atlas260- You need state persistence across multiple API calls in a test261- You want webhook delivery with real HMAC signatures (GitHub, Stripe)262- You need cascading side-effects (delete repo -> PRs cascade-delete)263- You need to assert on sent emails without hitting a real provider (Resend local `/inbox`)264- You need hosted Stripe checkout sessions with real redirect flow in tests265266**Use MSW/Nock when:**267- Mocking arbitrary HTTP APIs not covered by emulate268- You need in-browser interception (MSW)269- Tests only need single request/response pairs270271## Related Skills272273- `testing-integration` — Integration test patterns (emulate as first choice for API tests)274- `testing-e2e` — End-to-end test patterns with emulated backends275- `testing-unit` — Unit test patterns (use emulate for API-dependent units)276- `security-patterns` — Auth token patterns (emulate token seeding)277278## CLI Reference279280See `references/cli-reference.md` for all CLI flags and commands.281282## SDK Patterns283284See `references/sdk-patterns.md` for programmatic `createEmulate()` usage.