Stand-ins for the outside world.

Every project that talks to a payment gateway, an identity check, an email provider, a DNS provider, a messaging service or a model API needs something to talk to in a test. This is that something โ€” one implementation, shared, instead of a copy in every repository.

78mocks, from Stripe to Firestore
0dependencies, at runtime or in the tests
51 MBfor every mock in one process
0.2%CPU while idle
352 msto answer the first call

The mocks there are

MockWhat it stands in forPort
stripeThe card payments โ€” PaymentIntents, refunds, the webhook4001
paystackThe card payments (Nigeria)4005
interswitchThe card payments (Nigeria, Interswitch)4006
flutterwaveThe card payments (Nigeria, Flutterwave)4010
monnifyThe bank rails (Nigeria) โ€” reserved virtual accounts4011
paypalThe card and digital payments (PayPal Orders API v2)4028
squareThe card payments (Square Payments API)4029
adyenThe global payments (Adyen Payments API v68)4030
shippoThe shipping labels and tracking (Shippo)4031
easypostThe shipping labels and tracking (EasyPost)4032
fedexThe shipping labels and tracking (FedEx)4033
upsThe shipping labels and tracking (UPS)4034
dhlThe shipping labels and tracking (DHL)4035
amazon-sp-apiThe selling partner API (Amazon SP-API)4036
shopifyThe e-commerce platform (Shopify Admin API)4037
ebayThe marketplace (eBay Sell API)4038
etsyThe handmade marketplace (Etsy Open API)4039
walmartThe marketplace (Walmart Marketplace API)4040
sendgridThe email API (SendGrid Web API v3)4041
mailchimpThe email marketing (Mailchimp Marketing API)4042
klaviyoThe email marketing (Klaviyo API)4043
postmarkThe transactional email (Postmark API)4044
hubspotThe CRM (HubSpot API)4045
salesforceThe CRM (Salesforce REST API)4046
pipedriveThe CRM (Pipedrive API)4047
attioThe CRM (Attio API)4048
quickbooksThe accounting (QuickBooks Online API)4049
netsuiteThe accounting (NetSuite SuiteTalk API)4050
sageThe accounting (Sage Intacct API)4051
cin7The ERP/Inventory (Cin7 API)4052
dearThe ERP/Inventory (DEAR Systems API)4053
tradegeckoThe ERP/Inventory (TradeGecko API)4054
katanaThe ERP/Inventory (Katana MRP API)4055
avalaraThe tax calculation (Avalara AvaTax API)4056
taxjarThe tax calculation (TaxJar API)4057
vertexThe tax calculation (Vertex Cloud API)4058
square-terminalThe POS terminal (Square Terminal API)4059
cloverThe POS (Clover API)4060
toastThe POS (Toast API)4061
lightspeedThe POS (Lightspeed Retail API)4062
segmentThe analytics (Segment API)4063
mixpanelThe analytics (Mixpanel API)4064
amplitudeThe analytics (Amplitude API)4065
rudderstackThe analytics (RudderStack API)4066
rabbitmqThe message broker (RabbitMQ HTTP API)4067
kafkaThe event streaming (Kafka REST Proxy API)4068
sqsThe message queue (AWS SQS API)4069
pubsubThe message queue (Google Cloud Pub/Sub API)4070
redis-streamsThe message streams (Redis Streams API)4071
postgresThe relational database (PostgreSQL REST API)4072
mysqlThe relational database (MySQL REST API)4073
mongodbThe document database (MongoDB REST API)4074
redisThe key-value store (Redis REST API)4075
dynamodbThe NoSQL database (AWS DynamoDB API)4076
firestoreThe document database (Google Cloud Firestore API)4077
youverifyThe identity checks4007
smileidThe identity checks (Nigeria, Smile ID) โ€” BVN, NIN, licences4013
identitypassThe identity checks (Nigeria) โ€” people and businesses4014
twilioThe SMS4009
termiiThe SMS (Nigeria, Termii)4012
onesignalThe push notifications4008
whatsappThe WhatsApp messages (Cloud API)4015
fcmThe push notifications (Firebase)4016
resendThe email โ€” sending domains, the DNS records, sending4002
xeroThe accounting โ€” tokens, connections, invoices4003
cloudflareThe DNS โ€” zones, records4004
openaiThe model calls โ€” OpenAI and Anthropic shapes4017
s3The buckets and the objects (S3)4018
facebookThe social network โ€” pages, posts, comments, insights4019
instagramThe photo sharing โ€” media, comments, insights4020
xThe short messages โ€” tweets, users, followers4021
blueskyThe open protocol โ€” the AT Protocol4022
telegramThe channels and the bots4023
redditThe communities โ€” posts, comments, subreddits4024
linkedinThe professional network โ€” posts, organisations, OAuth4025
tiktokThe short video โ€” publishing, queries, comments4026
youtubeThe video library โ€” videos, channels, search4027

Every endpoint every mock serves is listed in the routes, which is generated from the code. Every route is checked against the provider's own published specification, so a route that has drifted fails the build.

Using it

In a test

import { startMock } from '@bytesickle/api-mock-services'

const stripe = await startMock('stripe')

process.env.NUXT_STRIPE_API_BASE = `${stripe.url}/v1`

// ... the test ...

expect(stripe.last().path).toBe('/v1/refunds')
await stripe.close()

As a container

docker run --rm -p 4001:4001 api-mock-services stripe

# one image, one process, as many mocks as you like
docker run --rm -p 4001:4001 -p 4005:4005 api-mock-services stripe paystack

As a whole stack

docker compose -f examples/docker-compose.yml --profile payments up -d
docker compose -f examples/docker-compose.yml --profile identity up -d
docker compose -f examples/docker-compose.yml --profile all up -d

From another language

The mocks answer over HTTP, so anything can use them. Point the application at the URL and carry on โ€” there is nothing to install.

Where to go next

Overview

Why the project exists, what it replaces, and the three ways to use it.

Architecture

The engine, the browser layer, the footprint budget, and the decisions deliberately not taken.

CI gates

Running the mocks inside the CI kit, so a test run never leaves a container behind.

Offline testing

Pointing an application at the mocks, and driving the failure paths worth testing.

Community

Who uses it, what has been said about it, and how to help.

Support the project

The mocks are maintained in the open, and that takes time.

There is no paid tier and nothing is gated: the package stays MIT, and every mock in it stays free. If sponsoring is not your thing, a star, an issue report, or a pull request that fixes something is worth just as much.