API Maker
The backend engine for the AI era
HooksEpisode 18 7:15 11 chapters November 2026
A rule written once, for a whole database, one table or one API: pre hooks run before the API, post hooks after it. Watch the hooks of Calm Home cap reads at fifty rows, keep their order, mask phone numbers in answers, get tested alone with Test Hooks, and see a loop between hooks stopped by API Maker.
In the playlists The complete course Custom APIs & code
Hooks are code that runs before and after an API. You write a rule once, for a whole database, one table, or one API. In this video, the hooks of Calm Home limit reads, sort orders, hide phone numbers, and stop a loop.
A rule for every endpoint is usually hard to keep. The same check is pasted into every handler. One handler is forgotten, and the rule is broken there. And one change must be made in twenty places. With API Maker, you write a hook once, for a database, a table, or one API. It runs for every caller of those APIs, today and for the APIs you add later. And you can try it alone before it runs for everyone.
In this video: where hooks run, a hook for a whole database, the order of the hooks, a hook that changes the answer, a hook of one API, and Test Hooks, and a loop that is stopped.
Hooks have four levels: an instance, a database, a table, and one API. Pre hooks run before the API, from the outside in. They see the request. They can change it, answer in place of the API, or refuse it. Post hooks run after the API, from the inside out. They get the answer in g.res.output.
Open Instance API, and pick mysql. Open the pre hooks of the sales database. Click Add Hook, name it Cap reads, and open Hook Code. Here is the rule. A read of any table of sales gives fifty rows at most. This matters, because order_events has a million rows. Your own code is trusted, so only Get all is limited, and a log line says so. Save it. The row of sales now shows one pre hook.
Open API Testing. Pick mysql, then sales, then order_events, and Get all, with no limit. Send. We get fifty rows, not a million. The Logs tab shows the line of Cap reads.
Now pick orders, and Get all. This table has two pre hooks. One puts the newest orders first. The other leaves out cancelled orders. Send. CH-2026-0180, the newest order, comes first, and there is no cancelled order. The Logs show the order: the hook of the database ran first, then the two hooks of the table. That order is set in one place. In API Testing, pick Collection Hooks. Pick mysql, then sales, then orders, and the hook Newest first, with its code.
Open Change Hook Orders. The hooks of a list run from top to bottom. Arrows move a hook, a tick skips it, and Save keeps the order. Close it.
Now a post hook. Pick postgres, then crm, and open the post hooks of customers. Click Add Hook, name it Mask phone, and open its code. The answer is in g.res.output, and every phone number keeps only its last four digits. Save it, and close. Open API Testing, pick postgres, then crm, then customers, and Get all. Send. Every phone number is hidden, for every application that calls an API of this table.
Now one level down: the hooks of one API. This is Get all of customers, in its Post Hooks tab. The hook of the table shows here too, in the order the hooks run. Click Add New, name it Full name, and open its code. It adds a full name to every row, and writes a log line. It is saved. Send. We get the full name, and the phone is still hidden.
The hook of the API ran first, then the hook of the table. Now open Test Hooks. Pick a version, and one hook. You see its code. You can change it here, and try it without saving. Send. Only the hook ran. There is no API, so there are no rows, and data is null. Its log line says zero rows.
Here is one last hook, with a mistake. Customer count adds the total count to every answer of customers. It asks for the count with skipHookRunning set to false. So the hooks of the count run too, and this hook is one of them. It also has no isApiRequestFromUser check. So it would count, and count again, for ever. Open API Testing. Pick postgres, then crm, then customers, and Get all.
Send. The answer is five hundred. The same count was called again while the first one was still running. The error says: duplicate API calls or cycle detected, with the list of calls. The rows of Get all are kept, and the loop stops at its second turn.
Good to know. When a pre hook returns a value, that value is the answer, in place of the API. A hook that throws refuses the call. Calls from your own code skip hooks, unless skipHookRunning is false. Active turns a hook off, and Groups run it for some applications only. Video twenty six shows it. An answer from the cache runs no hook. And an API and all its hooks use one language.
A rule lives in one place, for every API of a database or a table, today and tomorrow. The logs say what each hook did, in the order it ran. So an endpoint written by an AI assistant gets the same limits and the same hidden fields, without knowing about them.
To sum up. There are four levels, before and after the API. One hook can hold a rule for a whole database. Post hooks change answers after the API. Test Hooks tries a hook alone. And API Maker stops loops. Next: system APIs, ready made building blocks. API Maker. Build faster, spend smarter, deliver better.
Length 5:15System APIs
Length 6:03Utility classes
Length 8:36Heavy APIs
Length 6:16Per admin