Overview
Instant Mock API Server eliminates backend dependency bottlenecks for frontend developers. Turn any TypeScript interface, type definition, or JSON file into a live, local REST API endpoint (http://localhost:3000/api/...) in two clicks—with zero configuration, full CRUD support, and realistic mock data generation.
Highlights
Instant Type-to-API
Highlight any interface, type, or JSON block in your editor, right-click, and select Spawn Endpoint. Your endpoint is immediately served and ready for requests.
Smart Semantic Data Generation
Generates contextual fake records based on property semantics—names, emails, avatar URLs, dates, prices, status enums, and nested relations are structured automatically.
Complete REST CRUD Engine
Every collection endpoint comes equipped with full REST lifecycle methods out of the box:
GET /api/resource (List all items, pagination, and query filters)
GET /api/resource/:id (Retrieve item by ID)
POST /api/resource (Insert item with auto-assigned ID)
PUT /api/resource/:id / PATCH /api/resource/:id (Update or partial merge)
DELETE /api/resource/:id (Delete item)
Built-in CORS & Latency Simulation
- Zero CORS Hassle: Automatically serves
Access-Control-Allow-Origin: * with full preflight handling for React, Vue, Svelte, Angular, Next.js, and mobile applications.
- Latency Testing: Simulate real-world network delays (e.g. 300ms, 1200ms) to test loading skeletons and spinners.
Live Request Inspector & Dataset Editing
Monitor incoming requests, inspect headers and payloads in the sidebar in real time, and edit mock datasets directly in VS Code with instant server synchronization.
Quick Start
1. Highlight your Type or JSON
Select your TypeScript interface or JSON snippet in any file:
interface UserProfile {
id: number;
fullName: string;
email: string;
avatar: string;
role: 'admin' | 'editor' | 'viewer';
isActive: boolean;
}
2. Spawn Endpoint
Right-click your selection and choose "Instant Mock: Spawn Endpoint from Selection".
3. Fetch from your Application
Your API is live and accessible immediately:
const response = await fetch('http://localhost:3000/api/user-profiles');
const data = await response.json();
Commands
| Command |
Identifier |
Description |
| Spawn from Selection |
instantMock.spawnFromSelection |
Create a mock API endpoint from selected code |
| Serve File as Mock |
instantMock.spawnFromFile |
Serve an entire JSON or TypeScript file |
| Open Dashboard |
instantMock.openDashboard |
Open the endpoint manager and live request logs |
| Start Server |
instantMock.startServer |
Launch the local HTTP mock server |
| Stop Server |
instantMock.stopServer |
Stop the running mock server |
| Restart Server |
instantMock.restartServer |
Restart server and apply port configuration |
| Clear All Endpoints |
instantMock.clearEndpoints |
Remove all registered mock routes |
Configuration
Configure options under Settings (Ctrl+, / Cmd+,) $\rightarrow$ Instant Mock API Server:
{
// Port to run the local HTTP mock server on
"mockServer.port": 3000,
// Simulated latency in milliseconds (0 for immediate)
"mockServer.latency": 0,
// Number of mock records to generate for collection schemas
"mockServer.defaultCount": 5,
// Enable wildcard CORS headers (Access-Control-Allow-Origin: *)
"mockServer.enableCors": true,
// Display live server status in the VS Code status bar
"mockServer.showStatusBarItem": true
}
Security & Privacy
- 100% Local: Runs exclusively on
localhost within your local development environment.
- Zero Cloud Transmission: Your code, types, schemas, and payload data are never uploaded to any remote server.
Feedback & Contributions
- Report issues and request features on GitHub Issues.
- If you find this extension helpful, please leave a review on the Marketplace.
A product from bluebuff.in • Released under the MIT License