2026 · Developer tools · In progress

frobou-mocks

A platform that runs on the team's own infrastructure to mock an API from its OpenAPI contract, test the real API against that contract and fire test webhooks.

frobou-mocks
Role
Design and development
Period
Jun 2026 — present
Stack
Docker · Go · NestJS · Next.js · PostgreSQL · React · TypeScript
Team
Solo, with AI agents

The problem

The frontend sits idle while the API does not exist yet; the backend needs to prove the delivered API honors what was agreed; and integrating with an external system means receiving webhooks that do not arrive yet. Hosted tools solve part of this, but they take the contract, the traffic and the tokens outside the team's network.

frobou-mocks puts the three in a single project: the contract that serves the mock is the same one that later tests the real API. The screens below come from a demo project, a store's order API, built for this page. The interface is in Portuguese.

From contract to mock

A project starts from an OpenAPI 3 document, in JSON or YAML, or from endpoints created by hand. The import brings the paths, the response schemas and the query and header parameters; every imported version is kept, and the project can be exported back as OpenAPI 3.1. The project slug becomes the mock address: localhost:8881/mock/loja/products.

In the builder, a required header makes the mock reject any call that lacks it, and the response schema does not have to be written: it comes from a JSON example.

The endpoint builder with a required X-Api-Key header and a response schema inferred from an example
The X-Api-Key header marked as required and the response schema inferred from a JSON example.

Scenarios

A scenario holds one response per endpoint: status, headers, body and delay. Only one is active per project, and it decides what the mock returns. Switching from checkout-feliz to gateway-instavel makes the app see the payment take 3 seconds and come back with a 502, without touching the app.

With random responses on, the body becomes a list of candidates and each call draws one, with an optional weight. It lets the app deal with a refused payment before there is a real gateway.

The POST /payments response with two candidates drawn by weight
The payment approved with weight 8 and refused with weight 2, with a 450 ms delay.

Validation and calls

The mock server, written in Go, checks every request before answering: the body against the JSON Schema, and the presence and type of required query and header parameters. A request that does not match comes back with a 422 and the reason:

sh
curl -X POST localhost:8881/mock/loja/orders \
  -H 'X-Api-Key: sk_live_…' -d '{"customerId": "c-3307", "items": []}'

HTTP/1.1 422 Unprocessable Entity
{"error":"request failed validation","method":"POST","path":"/orders",
 "errors":["/items: minimum 1 items required, but found 0 items"]}

Every call is recorded, with Authorization and API keys masked before storage, and the list filters by path, method and status. A call that matched no endpoint becomes a captured endpoint with one click: that is how /coupons/BLACKFRIDAY, which the app called and the contract lacked, made it into the project.

The call history with a POST /orders rejected with 422 and expanded
The order with an empty item list, rejected with 422; the API key and the token show up masked.

Contract testing

Once the real API exists, the same project tests it. You give the base URL, the run headers and each endpoint's parameters; the result comes per endpoint, as pass, fail or warn, with the response received and the path of each mismatch. The target can sit on the internal network: localhost and private addresses are allowed, cloud metadata addresses are blocked and redirects are not followed.

A contract test result with five endpoints passing and two failing
Against staging: the price from /products/:productId came as text, and /customers does not exist there yet.

Webhooks

For the side that receives events, each project has its own webhooks: event name, target URL, headers and a list of payloads. Each dispatch draws a payload, sends it and keeps what the target answered, refusals included.

A webhook history with calls refused with 401 and accepted with 202
The first two dispatches came back 401 with the old token; after the header change, 202.

How it is built

A Turborepo monorepo with three services: the API in NestJS 11, with PostgreSQL and migrations applied on startup; the dashboard in Next.js 16, with React 19 and Tailwind 4; and the mock server in Go, which reads each project's configuration from the API and sends the call log back to it. Everything starts with one docker compose up, with no account and no outside service. Whole projects, with endpoints, scenarios, responses, webhooks and contracts, go out and come in as a JSON file, to move them between environments.

Tests run on Jest in the API, Vitest in the dashboard and go test in the mock server.

440

endpoints created in half a second from a real 2 MB OpenAPI contract

3

services of its own, started together with one docker compose up

1500+

test cases across the API, the dashboard and the mock server

Next project fcontainer