If you’re looking for a fast way to mock APIs from HAR files, MockCraft is a lightweight Node.js tool designed just for that.
The Problem: When Mocking Becomes a Bottleneck
During frontend or integration development, having a reliable mock server is crucial. Whether you’re building features before the backend is ready, debugging complex UI flows, or just trying to simulate production-like behavior in a local environment — mocking saves time and headaches.
Like many developers, I initially turned to popular tools like Postman and Mockoon. They’re well-known and offer mock server capabilities, so I figured I was covered. But I quickly ran into frustrating limitations.
• 🧪 I was using a mock API service with a free trial license.
• 📉 That came with a monthly request limit, which I unexpectedly hit during testing.
• 💸 Even with a paid license, I realized I’d still need to create example responses manually for each endpoint.
• 🧱 The workflow was slow, repetitive, and error-prone. Export HAR files from Chrome… create Postman mocks… paste in responses… again and again.
At some point, I found myself thinking:
“I just wanted to test my frontend with real captured traffic, not spend hours manually writing mock routes.”
I knew there had to be a better way — or if there wasn’t, I’d make one.
The Solution: How to Mock APIs from HAR Files
To eliminate the manual overhead, I built a custom Node.js tool that takes a .har file — the kind you can export straight from your browser’s DevTools — and turns it into a fully functional mock server. No extra setup. No hand-written routes.
🛠️ What it does:
• ✅ Reads the HAR file captured during real API traffic
• 🔍 Parses request method, path, and response body
• 🧠 Identifies dynamic segments (like UUIDs) and replaces them with route parameters (e.g., /answer-sheets/:id/start)
• 📦 Outputs a mockRoutes.js file that maps each API call to its mock response
• 🚀 Boots up an Express server and serves responses instantly
• ⚡ Requires zero manual work once you have the HAR
This means: as soon as your browser has seen the API, your mock server can simulate it — with real request/response data.
No need to:
• Copy/paste response payloads
• Write custom mock logic
• Configure routes manually
It just works.
Why No Other Tool Could Solve This
Before building my own solution, I explored all the popular tools — hoping one would just work. But every option fell short in at least one critical way.
Tool | Why It Fell Short |
---|---|
Postman Mock Server | Requires manual creation of each mock route and response. No direct HAR support. |
Mockoon | Doesn’t support HAR import. GUI-only interface — hard to automate or customize. |
Beeceptor / WireMock | Great for specific scenarios, but you still need to manually prepare mock responses. |
Custom Open Source Solutions | Most were either overly complex or didn’t handle dynamic paths like UUIDs cleanly |
What I needed was a tool that could:
• Understand real captured traffic
• Handle dynamic paths like /answer-sheets/:id/start
• Work with real examples, not templates
• Launch a mock server instantly
None of the existing tools gave me that experience. So I built one that did.
What Makes My Tool Special
Why Mock APIs from HAR Files Instead of Manual Setup
Most mock tools feel like overkill — or underpowered. I wanted something lean, developer-first, and automation-ready. Here’s what sets my tool apart:
🔄 HAR → mocks in seconds
Just export a .har file from your browser, and the tool instantly converts it into mockable routes — including the responses.
📦 Fully local and lightweight
It’s a simple Node.js script. No cloud, no bloat. Everything runs on your machine with minimal dependencies.
⚡️ No internet or GUI required
Run everything from the terminal. Perfect for CI pipelines, offline development, or environments where GUI-based tools aren’t practical.
🔥 Handles dynamic paths
The tool automatically replaces UUIDs and other dynamic parts of the URL with route parameters like :id, so one route can serve many requests.
🚀 Ready for future extensions
WebSocket support, dynamic query matching, and delay simulation — all are on the roadmap. It’s built with flexibility in mind.
It’s not just a mock server — it’s a developer productivity hack.
Bonus: How I Might Extend It
This started as a quick utility to make my frontend life easier — but it’s evolving fast. Here are some powerful extensions I’m planning:
🔁 WebSocket Support
Mocking APIs is one thing, but simulating real-time events is another. I want to emit custom WebSocket messages when specific routes are triggered — like sending a testStarted event right after /start is called.
🧠 Load Local Storage Context
Many frontends rely on tokens or state stored in localStorage. I plan to auto-load predefined values so the app “just works” without manual prep.
🖥 UI for Inspecting Active Mocks
A lightweight dashboard where I can view, edit, or toggle mock routes live — perfect for debugging and demos.
🔄 Convert to OpenAPI
Imagine turning real traffic into usable OpenAPI specs for documentation or schema validation. That’s on my radar too.
This project isn’t just a stopgap — it’s becoming a full mock ecosystem, tailored for real-world frontend workflows.
Conclusion: Build What You Need
Sometimes, no existing tool fits just right — especially when you’re juggling real-world development constraints, deadlines, and repetitive tasks. That’s when you stop waiting and build what you need.
My HAR-to-Mock Server tool was born out of frustration, but it turned into something surprisingly powerful — a lightweight, zero-config way to turn real API traffic into working mocks in seconds.
If this sounds useful to you:
• 👉 Check it out on GitHub
• 🛠 Found an edge case or want to contribute? Pull requests welcome!
• 💬 I’d love to hear about your own mocking challenges or how you’re solving them
Mocking shouldn’t be a bottleneck. It should be one of the fastest parts of your development flow.
Let’s make it that way — together.
Related Work
NerdDevs is dedicated to creating innovative developer tools and AI-powered systems that enhance productivity and streamline workflows. Our work includes building intelligent AI agents designed to interact with real-world data effectively.
👉 Curious how? Read our latest post on How Model-Context-Protocol Powers Smarter AI Agents.