API Maker
The backend engine for the AI era
Data safetyEpisode 4 5:34 10 chapters October 2026
Encryption, hashing, auto increment numbers, generated ids and updates that never erase each other: in API Maker each one is a key in the schema of a table, on MongoDB as on SQL. See what the database really holds, how your code reads it back with the secret, and how a stale update is refused.
In the playlists The complete course Databases & schemas
Encrypted and hashed fields, numbers and ids, and updates that never erase each other : each one a key in the schema of a table. In this video, the reviews and the products of Calm Home.
Protecting data usually means encryption code and keys in every service, counters written by hand, and on MongoDB, racing each other, and a save that silently erases the one before. With API Maker, one key in the schema encrypts or hashes a field, numbers and ids come from the schema, and a stale update is refused. In this video : four fields in a schema, encrypted and hashed values, reading them back on the server, the counters, a version field, and two people saving the same product.
Instance API, mongodb, catalog, reviews, and its schema. Calm Home wants to reach the people who write reviews. Four fields, typed after _id, each with one key. review_no : a number API Maker counts from one thousand and one, on MongoDB, which has no auto increment. public_id : a ULID, an id to share, sorted by time, that says nothing about how many reviews there are. contact_email : encrypted. contact_phone : hashed.
Update and Close.
API Testing, mongodb, catalog, reviews, Save single-multiple. The review of Kabir, with his e-mail and his phone, in clear. Two hundred and one : review number one thousand and one, its ULID, the e-mail encrypted and the phone hashed. That is what the database holds now. The same review once more : one thousand and two, and another ULID. The same e-mail is encrypted differently each time, the same phone always gives the same hash.
A hash can be searched, never read back. An encrypted value can be read back, with the key. The keys live in the default secret, on the server : an algorithm and a secret to encrypt, an algorithm and a nonce to hash. The schema names no key, so Git holds none. A copy of the database or a backup shows cipher text and hashes, nothing else.
Reading them back is the job of your code, on the server. The support team calls back the reviewers of one phone number : hash the phone the same way and find its reviews, then the keys of the secret decrypt each e-mail, for this API only. The custom API Review Contacts. Test API, the phone of Kabir, Send : his two reviews, found by the hash, and the e-mails in clear.
Database, Auto Increments : the counters of the account. reviews, review_no : one thousand and two. Every server of the installation counts on this one counter. Edit sets where the count goes on, one thousand five hundred, for reviews imported from an older shop. The next number is the higher of this value and the highest number of the table, plus the step. Update.
Now the products, which two people can edit at once. Back to Instance API : mongodb, catalog, products, its schema. A version field : an update must send the version it read, and each save counts the next one. Update and Close. Ana and Ben both opened the Ash nightstand, at version one. Update by id, its id, and only the name, the price and the version in the answer.
Ana sets two hundred and nine, with version one : saved, version two. Ben, still on version one, sets one hundred and ninety nine : four hundred, the version does not match, and nothing is written. Ben reloads, sees version two, and decides : saved, version three.
Four id generators : ObjectID, GUID_UUID, ULID and ShortUUID, used when the request has no value. On SQL, isAutoIncrementByDB leaves the numbering to the database. The version is checked by update by id and replace by id ; your code with g.sys.db skips the check unless it asks for it. And like a database sequence, numbers can have gaps : a save refused after its number was counted keeps it.
Keys in the secret, never in code or in Git. The schema says what is protected, and every write follows it : the APIs and your code alike. So an endpoint written by an AI assistant can not store an e-mail in clear.
To sum up. Encryption and hashing, one key each. Read back on the server, with the secret. Numbers and ids from the schema, on MongoDB too. The counters on one page. Stale updates refused. Next : relations across databases, and the ER diagram. API Maker. Build faster, spend smarter, deliver better.
Length 4:07ER diagram
Length 5:46Databases
Length 11:06Table designer
Length 5:08Data types