If you’ve ever built an API-driven product, you know this already: mocking is inevitable.
Early on, when the backend isn’t ready yet (or a third-party service is blocking you), mocks keep the frontend moving. They let you build, test, and iterate—even without real backend data.
Let’s dig into the common headaches, the usual workarounds, and how EchoAPI makes mocking a lot more indie hacker–friendly.
Picture this:
You’re hacking on a front-end for an e-commerce app. The user hits "Pay Now," which should call your /pay endpoint and return something like:
{
"data": {
"code": 0,
"message": "success",
"pay_dtime":"2025-08-10 10:00:00",
"order_id":"sn12345678"
}
}
But…
/pay yet.Result? Frontend progress blocked.
This is where mocking saves the day.
The DIY starter kit:
Drop a file in mock/data.json and fetch it.
fetch('/mock/pay.json')
Why it sucks long-term:
(axios-mock-adapter, Mock.js)
Catch requests right in the browser:
mock.onPost('/api/pay/confirm').reply(200, {
"data": {
"code": 0,
"message": "success",
"pay_dtime":"2025-08-10 10:00:00",
"order_id":"sn12345678"
}
});
Downsides:
(json-server, Easy Mock)
Spin up a dedicated mock service.
The catch:
All these work okay in the early days. But once the app grows, you’ll crave flexibility and dynamic responses.
EchoAPI is designed to fix exactly these pain points—lightweight to start, but powerful enough to scale with you. Let’s go back to the /pay example.
Spin up a fixed response in seconds:
{
"data": {
"code": 0,
"message": "success"
}
}
In EchoAPI, you just define the endpoint visually:

Switch to the Mock tab, grab the URL:

And boom, calling it gives back your defined JSON:

Static mocks get boring fast. EchoAPI lets you drop in built-in variables—for example, random timestamps:
{
"data": {
"code": 0,
"message": "success",
"pay_dtime":"2025-08-10 10:00:00"
}
}
Just insert a dynamic date variable:

Now each request feels fresh:

Need something fancier, like an order ID that looks real?
Say: "sn" + 8 digits.
{
"data": {
"code": 0,
"message": "success",
"pay_dtime":"2025-08-10 10:00:00",
"order_id":"sn12345678"
}
}
EchoAPI lets you write (or AI-generate) a custom function:

Example with fn_orderno:

And the result looks way closer to production:


Real APIs don’t always succeed. Sometimes you’re broke, sometimes the account is locked.
With EchoAPI you can mock those states too.
Example: insufficient balance:


And here’s what comes back:


Much closer to real-world testing than hardcoding JSON.
Mocking isn’t just a nice-to-have—it’s a productivity multiplier:
Why EchoAPI works well for indie hackers:
If you’re building fast, iterating solo, or trying to simulate production early—EchoAPI keeps you shipping without waiting.
Happy building 🚀