Relmock Guide

Build

Import and export

Start from the schema you already have, and take your mock's contract back out as OpenAPI, SQL, Prisma, TypeScript or a Postman collection.

Import

The Import page: pasted SQL with two CREATE TABLE statements, and a review listing the categories and coupons tables with their fields, rules and a relation that sets null on delete
  1. Open Import & exportIt is the arrows icon in the left rail.
  2. Upload or pasteDrop a file (up to 2 MB) or switch to Paste. The format is detected.
  3. ReviewPreview import lists every table with its fields, keys, rules and records, plus relations and endpoints. Untick what you don't want, and choose what happens to tables that already exist: keep, import under a new name, or replace.
  4. ImportNothing is saved before this step.
FormatWhat comes in
SQLCREATE TABLE scripts, pg_dump and mysqldump files, with their data. Keys, NOT NULL, UNIQUE, CHECK, enums, lengths and ON DELETE rules become field rules and delete rules.
OpenAPIOpenAPI 3 or Swagger 2, JSON or YAML. Models become tables; operations that tables don't cover become custom endpoints.
Prismaschema.prisma models, enums and relations.
GraphQLSDL type definitions.
JSONAn array of records, or { "users": [...], "posts": [...] } as in json-server's db.json.
CSVOne table per file, or a .zip of CSV files.
PostmanA collection's requests and saved responses become custom endpoints.
Tip
Imported records become the table's seed: Reset every table to seed on the Tables page brings them back after your tests change them.

Export

Choose Export in the side panel, pick a format and options, check the preview, then copy or download.

FormatGood for
OpenAPI 3Sharing the API contract with backend developers, or generating a client. JSON or YAML, with examples from your records.
TypeScriptAn interface per table and a typed client for your mock, ready to paste into your frontend.
SQLPostgreSQL, MySQL or SQLite tables with foreign keys, and optionally the records.
PrismaStarting the real backend with the same models.
PostmanA collection with a request for every route and every custom endpoint.
JSON, CSVAll records, in db.json layout or one CSV per table.

Exports from Relmock import back unchanged, so they also work as a backup of a project.