Local drop-in API emulator for Vercel, GitHub, Google, Slack, Apple, Microsoft, and AWS. Use when the user needs to start emulated services, configure seed data, write tests against local APIs, set up CI without network access, or work with the emulate CLI or programmatic API. Triggers include "start the emulator", "emulate services", "mock API locally", "create emulator config", "test against local API", "npx emulate", or any task requiring local service emulation.
Local drop-in replacement services for CI and no-network sandboxes. Fully stateful, production-fidelity API emulation, not mocks.
npx emulate
All services start with sensible defaults:
| Service | Default Port |
|---|---|
| Vercel | 4000 |
| GitHub | 4001 |
| 4002 | |
| Slack | 4003 |
| Apple | 4004 |
| Microsoft | 4005 |
| AWS | 4006 |
# Start all services (zero-config)
emulate
# Start specific services
emulate --service vercel,github
# Custom base port (auto-increments per service)
emulate --port 3000
# Use a seed config file
emulate --seed config.yaml
# Generate a starter config
emulate init
# Generate config for a specific service
emulate init --service vercel
# List available services
emulate list
| Flag | Default | Description |
|---|---|---|
-p, --port | 4000 | Base port (auto-increments per service) |
-s, --service | all | Comma-separated services to enable |
--seed | auto-detect | Path to seed config (YAML or JSON) |
The port can also be set via EMULATE_PORT or PORT environment variables.
npm install emulate
Each call to createEmulator starts a single service:
import { createEmulator } from 'emulate'
const github = await createEmulator({ service: 'github', port: 4001 })
const vercel = await createEmulator({ service: 'vercel', port: 4002 })
github.url // 'http://localhost:4001'
vercel.url // 'http://localhost:4002'
await github.close()
await vercel.close()
| Option | Default | Description |
|---|---|---|
service | (required) | 'vercel', 'github', 'google', 'slack', 'apple', 'microsoft', or 'aws' |
port | 4000 | Port for the HTTP server |
seed | none | Inline seed data (same shape as YAML config) |
| Method | Description |
|---|---|
url | Base URL of the running server |
reset() | Wipe the store and replay seed data |
close() | Shut down the HTTP server, returns a Promise |
import { createEmulator, type Emulator } from 'emulate'
let github: Emulator
let vercel: Emulator
beforeAll(async () => {
;[github, vercel] = await Promise.all([
createEmulator({ service: 'github', port: 4001 }),
createEmulator({ service: 'vercel', port: 4002 }),
])
process.env.GITHUB_EMULATOR_URL = github.url
process.env.VERCEL_EMULATOR_URL = vercel.url
})
afterEach(() => { github.reset(); vercel.reset() })
afterAll(() => Promise.all([github.close(), vercel.close()]))
Configuration is optional. The CLI auto-detects config files in this order:
emulate.config.yaml / .ymlemulate.config.jsonservice-emulator.config.yaml / .ymlservice-emulator.config.jsonOr pass --seed <file> explicitly. Run emulate init to generate a starter file.