Getting Started
Local drop-in replacement for Vercel, GitHub, Google, Slack, Apple, Microsoft, AWS, Okta, MongoDB Atlas, Resend, and Stripe APIs. Built for CI and no-network sandboxes. Fully stateful, production-fidelity API emulation. Not mocks.
Quick Start
npx -p api-emulator api
All services start with sensible defaults. No config file needed:
- Vercel on
http://localhost:4000 - GitHub on
http://localhost:4001 - Google on
http://localhost:4002 - Slack on
http://localhost:4003 - Apple on
http://localhost:4004 - Microsoft on
http://localhost:4005 - AWS on
http://localhost:4006 - Okta on
http://localhost:4007 - MongoDB Atlas on
http://localhost:4008 - Resend on
http://localhost:4009 - Stripe on
http://localhost:4010
CLI
# Start all services (zero-config)
npx -p api-emulator api
# Start specific services
npx -p api-emulator api --service vercel,github
# Custom port
npx -p api-emulator api --port 3000
# Use a seed config file
npx -p api-emulator api --seed config.yaml
# Create a starter configuration file
npx -p api-emulator api init
# Generate config for a specific service
npx -p api-emulator api init --service github
# Generate config and set up native notifications
npx -p api-emulator api init --notifications
# List available services
npx -p api-emulator api list
Interactive initialization offers notification setup as an optional step. On macOS, setup requests notification permission and opens the API Emulator settings guide if permission was previously denied.
Options
| Flag | Default | Description |
|---|---|---|
-p, --port | 4000 | Port for the first service. Other service ports increase from this value. |
-s, --service | all | Comma-separated services to enable |
--grpc-port | 50051 | Base native gRPC port for plugins that declare gRPC services |
--seed | auto-detect | Path to seed config (YAML or JSON) |
--latency | 0 | Delay each HTTP response by this many milliseconds. |
--no-notify | off | Disable the native notification when the emulator server is ready |
The port can also be set via API_EMULATOR_PORT or PORT environment variables. Artificial latency can be set via API_EMULATOR_LATENCY_MS.
Programmatic API
You can also use api-emulator as a library in your tests. See the Programmatic API page for createEmulator, Vitest/Jest setup, and instance methods.
Next.js Integration
Embed emulators directly in your Next.js app so they run on the same origin. See the Next.js Integration page for setup instructions.