Relmock Guide

Build

Tables, fields and relations

The Schema page shows your tables as a diagram. Here you add tables and fields, set keys, link tables and decide what happens when a linked record is deleted.

The Schema page: a diagram of four related tables, the orders table open in the editor with a new field, and 1 unsaved change next to Cancel and Save
1 a relation line, from the foreign key to the table it points at · 2 a dot marks a table with unsaved changes · 3 the unsaved changes, with Cancel and Save · 4 generator settings for a field.

Add a table

Click + Table and give it a lowercase name such as orders. It becomes the resource /orders of your API. Other ways to add tables:

  • Templates: more than 200 ready-made tables in 20 areas (shops, blogs, HR, health and more).
  • Describe with AI: see AI schema chat.
  • Import & export in the left rail: see Import and export.

Fields and types

Click a table's pencil to open the table editor on the right. Each field has a name and a type. The type decides two things: what generated data looks like (email, fullName, price, dateTime and more than 30 others), and what the API accepts on writes.

  • Add field adds a row. The arrows reorder fields; records come back from the API in this order.
  • The PK box marks the primary key. Each table has one, id by default. New records get the next number, or a UUID for text keys.
  • The settings button next to a field opens its generator settings and its rules for writes, such as required, unique, only listed values, a range or a maximum length. See Generating data.
  • Renaming a field keeps its relations and renames the key in existing records.

Link tables

To make orders.user_id point at users, drag the small dot next to user_id onto the users table. You can also use the link button on a table, which opens the same as a dialog. A table can link to itself, for example employees.manager_id.

The foreign key takes the type of the key it points at, and the diagram draws the link with a crow's foot on the "many" side.

What happens on delete

Click a relation line to change its settings:

Delete ruleDeleting a user who has orders
Block (default)Answers 409 while orders point at the user.
CascadeDeletes the user's orders too. The answer's X-Mock-Cascade header says what was removed.
Set nullKeeps the orders and empties their user_id. Not allowed when the field is required.

The same popover sets the foreign key check (strict: an unknown user_id answers 422; warn: accepted with a warning header; off) and children per parent, for example 0 to 3 orders per user when data is generated. Rules at the top lists every relation in one place.

Save and Cancel

Every change on the Schema page is a draft until you save it: new tables, field changes, relations and their settings, even where tables sit on the diagram.

  • The top bar counts the unsaved changes. Tables with changes get a dot: green for new, amber for changed.
  • Save (or Ctrl S) saves everything at once. If one change is refused, nothing is saved; the message names the table or relation to fix, and your draft stays.
  • Cancel puts back the saved schema. Undo table changes in the editor does the same for one table.
  • Leaving the page or closing the tab with unsaved changes asks first.
  • Generate data, Templates, Describe with AI and Rules work on the saved schema, so they offer to save first.

Move around the diagram

  • Scroll to move up and down; Shift and scroll moves sideways. Dragging the background moves it too.
  • Ctrl and scroll, or a pinch, zooms. The buttons at the bottom left zoom and fit everything on screen.
  • Auto-arrange lays linked tables out from left to right without overlaps.
Free plan
Up to 3 projects, 20 tables per project, 200 records per table and 5 AI schema requests a day. All limits are on Limits, FAQ and help.