API Maker

The backend engine for the AI era

SchemasEpisode 3 7:01 13 chapters November 2026

Table Schemas in TypeScript, Checked on Every Write

In API Maker, the schema of a table is TypeScript written from the real table, kept in Git, and checked by the server on every write, whoever writes. Follow the rules of the support tickets of Calm Home: validations and conversions, nested objects and arrays, vectors and JSON, invented keys refused, and a schema compared with its table.

In the playlists The complete course Databases & schemas

Chapters

What you will learn

  • A schema generated from a MongoDB collection and from a SQL table
  • Validations and conversions, checked on every write
  • Keys that do not exist in the table, refused by name
  • Nested objects, arrays, vectors, JSON and bytes, typed
  • A schema compared with its table, and synced both ways
  • The data analysis a schema is written from, and the history of a schema in Git
In the docsTable schema
Transcript938 words · click a time to play from there

Intro

A schema is the set of rules for a table. In API Maker, it is TypeScript, made from the real table, and kept in Git. The server checks it on every write, whoever writes. In this video, we look at the rules of the support tickets of Calm Home.

Rules, the usual way

Without API Maker, data rules usually live in an entity class, a DTO, and a validator for each table. They are copied into every endpoint and script. And over time, they no longer match the real table. With API Maker, there is one schema for each table, made from the table. Its rules run on every API, and in your code. And the server compares it with the table. In this video: a generated schema, types, arrays, vectors, and JSON, checks and changes of values, keys the server refuses, a save that is refused, and a save that is cleaned, and the schema compared with the table.

A generated schema

Open Instance API. Pick MongoDB, then the catalog database, then products, and open its schema. It was made from the documents themselves. Each field has a type. A field is required when every document has it. Images and tags are arrays of text. Specs is an object inside the document, with its dimensions inside it. And variants is an array of objects. category_id even points to the categories. Its name was enough to know that.

Now PostgreSQL. Pick the instance postgres, then crm, then support_tickets. This schema was also made from the table. It has the primary key, numbered by the database, and the foreign key to customers. It has the length of each column, and NOT NULL becomes required.

Keys the server refuses

Now we add a rule that sounds right: isUnique. An AI assistant might write this. Click Update. It is refused, by name, with the list of the valid keys. A schema never keeps a rule that does nothing.

Validations and conversions

Now the real rules. subject must have five characters or more, after spaces are trimmed. status must be one of three values. It is changed to capital letters first, and it is OPEN when it is missing. priority works the same way, with NORMAL by default. And created_at gets the date, when it is not given. Click Update.

The schema against the table

Click Compare with the database. On the left is your schema. On the right is a schema made from the table as it is today. If someone added or changed a column, you see it here. Go back to the editor, and click Update and Close. The list of tables also tells you, before you open anything. When a table and its schema are different, its row has a mark.

The tooltip lists what is different. One click fixes it, field by field. The schema can follow the table, or the table can follow the schema. Video fifty four shows both ways.

A save refused, a save cleaned

Now let us save some data. Open API Testing, pick PostgreSQL, then crm, then support_tickets, and the API Save single-multiple. We type a bad ticket. The answer is four hundred, with one error for each field. The subject is too short after trimming, and the status and the priority are not in their lists. Nothing was saved in the table. Now a messy ticket: spaces around the subject, a priority in small letters, no status, and no date.

The answer is two hundred and one. The subject is trimmed. Priority is HIGH, status is OPEN, and created_at has the date. The schema did all of that.

Good to know

Good to know. The same rules run when your custom APIs, hooks, and schedulers save data with g.sys.db calls. There are five types: string, number, boolean, date, and objectId. On MongoDB, you also get objects and arrays inside a document. validatorFun and conversionFun take your own function, for anything the keys do not cover. And the schema is a file in Git, so every change has its history.

Vectors, JSON and bytes

A SQL column can also hold more than one value. A vector works on all five SQL databases. It is a list of numbers, so its schema says an array of numbers. A JSON column takes objects and lists. Bytes travel as a Buffer object, and shapes as GeoJSON. Generated APIs, schema APIs, and g.sys.db in all eight languages save, read, and update them the same way.

What a schema is written from

A new schema opens with a second tab. Data Analysis shows what the schema is made from. For each field, you see in how many documents it is, what types it has, and if its values repeat.

The history of a schema

A saved schema has its Schema history. You see the version that is live in the database, and each commit of its file in Git. Open a commit to see what it changed. Here, it added the rules of the support tickets. Pick the first one, without the rules. It can be loaded into the editor, once you say yes. Nothing is saved until you click Update. Revert would write a version into the database right away.

Video forty one shows it.

Built on standards

The rules of a table are in one place, next to the table. Unknown keys and wrong types are refused, so a rule is never ignored, whoever wrote it. And there is one error format, field by field, on every database.

Recap

To sum up. A schema is made from the table. It has types, objects inside objects, arrays, vectors, and JSON. Its checks run on every write. Keys that do not exist are refused by name. And the schema is compared with the table. Next: data safety: encryption, hashing, IDs, and saves at the same time. API Maker. Build faster, spend smarter, deliver better.