Mock server from a template: a test API for your prototype
The prototype runs on “Task 1” and “Task 2”. In the demo, the screen looks neat, then breaks on the first real data: a long title doesn’t fit, a due date is missing, an avatar didn’t load. A mock server template in Microkoi Bench gives you a ready-made API of a typical app, with realistic data, pagination and errors. The server is up in a minute, and you don’t have to write anything for it.
Why “Task 1” tests nothing
Placeholders are all the same length, and every field is filled in. There’s no task without a due date, no overdue task, no second page of the list. The screen that shows them hasn’t been tested on any of these cases.
You can’t record a real server’s responses either: early in a project there’s no server, and the API hasn’t been designed. You need a server that already knows what an API for this kind of app usually looks like.
Eight templates of typical apps
A template is a ready-made mock server: endpoints, response bodies, images and a description of every endpoint. The catalog has eight templates in four categories.
| Category | Templates |
|---|---|
| Content | Food blog |
| Commerce | Online store, Food delivery, Job search and resumes |
| Social | Social network |
| Services | Token-based authentication, Booking, Task list |
Template texts follow the Bench interface language. In English, there are US cities, prices in dollars and phone numbers in +1 format: the data is made up but looks real.
Create a server from a template
- Open the “Mock servers” section. It starts with the “Mock server templates” screen.
- Choose the “Services” chip or type “tasks” in the search box. Search looks at the name, description and tags.
- Click the task list tile. A preview opens: the description and all endpoints by folder, with method, path and status code.
- Change the “Server name” if you like and click “Create mock server”.
- Turn on the “Running” switch in the server header.
The server takes the first free port starting at 9091 and accepts both HTTP and HTTPS on it. The address to copy is in the address block under the header.
Tasks
GET /api/v1/tasks 200
GET /api/v1/tasks/* 200
POST /api/v1/tasks 201
PATCH /api/v1/tasks/* 200
DELETE /api/v1/tasks/* 204
Projects
GET /api/v1/projects 200
GET /api/v1/projects/*/tasks 200
Errors
GET /api/v1/tasks/t-404 404
GET /api/v1/tasks 401 off
POST /api/v1/tasks 422 off
PATCH /api/v1/tasks/* 409 offData that exposes layout bugs
The task list comes as an object with items, page, pageSize, total and next fields. The first page has ten tasks out of 122, and next points to the second page. Among them are a task without a due date, an overdue task and due dates in two time zones. Tasks come in four statuses, with labels and assignees.
The next link and avatar URLs are built with {{baseUrl}}. The server replaces it with the address it was called at, so images load on the computer, in the emulator and on the phone alike. The phone needs “Network access” next to the server addresses.
Fit it to your product
Once created, it’s an ordinary mock server. The template itself doesn’t change, and a second server made from it is an independent copy.
- Need a new field? Add it to the endpoint body. The “Format” button tidies the JSON, and the syntax check points out a missing comma.
- Don’t need a section right now? Turn off its folder with “Disable all endpoints in folder”. No need to delete it.
- A screen needs its own endpoint? Click “New endpoint in folder” and take the body from a neighboring one.
A change takes effect after “Save”. A running server picks it up right away, without a restart: the app just repeats the request.
Errors come included
Error handling usually gets postponed: without a server, there’s nothing to test it against. In the template, errors come in one format, with error, message and details fields.
- A task that doesn’t exist: GET
/api/always returns 404.v1/ tasks/ t- 404 - 401, 422 and 409 sit disabled in the “Errors” folder. Enable the error endpoint and disable the main one with the same method and path, as the endpoint description says.
{
"error": "validation_failed",
"message": "Check the task fields",
"details": [
{ "field": "title", "message": "Enter a task title" },
{ "field": "dueAt", "message": "The due date can’t be in the past" }
]
}The form uses the details array to highlight the fields with errors. You can build this part of the screen in the first week, not after the backend shows up.
What a template doesn’t do
- It doesn’t store data. Creating a task returns 201 with a ready-made object, but the new task won’t appear in the list.
- It doesn’t filter. The page,
pageSize, status andassigneeIdparameters are accepted, but they don’t change the response. - It doesn’t check headers. A 401 response is a separate endpoint you enable.
For a prototype, that’s enough. Tell the people who’ll review it up front: a task that vanishes after it’s created isn’t an app bug.
Don’t put real tokens or personal data in endpoints. While the server runs with network access, any device on that network sees its responses.
When the backend arrives
The “Export API to note” button in the server header builds a note: the base URL, a table of contents, and endpoints with descriptions, status codes, headers and sample responses. Disabled endpoints go into the “Error variants and alternative responses” section. It describes the API of your prototype with all your changes, not the original template.
The server and the note are ordinary files in the workspace folder. Put the workspace in git, and the whole team gets the same test API.
Which templates are missing for your apps? Write to beta@microkoi.com: which template you took, what you had to add and what you couldn’t find. We read every email.