Define mock API endpoints, generate realistic test data, and export as Express.js, fetch/axios, or MSW handlers. Everything runs in your browser.
GET /api/users200
Response preview will appear here...
Click "Generate Mock Code" to see output...
About API Mock Builder
API mocking is essential for modern development workflows. Mock servers let frontend teams build and test features without waiting for backend APIs, enable isolated unit testing, and provide consistent test data across environments.
This tool generates mock endpoint configurations you can export as a JSON config, a runnable Express.js server, fetch/axios interceptor code, or MSW (Mock Service Worker) handlers for browser-based mocking.
Features
Define endpoints with custom HTTP methods, paths, status codes, and headers
Quick templates for common data types (User, Product, Post, Comment, Todo)
Generate arrays of randomized test data (1-20 items)
Export as Express.js, fetch/axios mocks, or MSW handlers
Response delay simulation for loading state testing
100% client-side — your data never leaves your browser
An API mock server simulates real API endpoints by returning predefined responses. It allows frontend developers to build and test applications without depending on a live backend, speeding up development and enabling parallel work.
What is MSW (Mock Service Worker)?▼
MSW (Mock Service Worker) is a popular API mocking library that intercepts HTTP requests at the network level using a Service Worker. It works in both browser and Node.js environments, making it ideal for testing and development.
How do I generate realistic mock data for testing?▼
Use the built-in templates (User, Product, Post, Comment, Todo) to generate realistic-looking JSON data with randomized values. Select a template, choose how many items you need, and toggle randomization for varied data.
Can I export mock endpoints as a runnable Express.js server?▼
Yes. This tool generates complete Express.js server code that you can copy, save as a .js file, and run with Node.js. It includes the endpoint definition, response headers, status codes, and optional delay support.
Is my API mock configuration saved?▼
Everything runs in your browser and nothing is sent to any server. Your data stays completely private. You can copy the JSON configuration to save and share your mock setup with your team.