API Maker
The backend engine for the AI era
Utility classesEpisode 20 4:48 9 chapters October 2026
Code that many APIs share, and code that runs once when a process starts. Write a utility class of Calm Home, use it in two APIs, change it once and see both follow, then load data in a process initializer before the first request.
In the playlists The complete course Custom APIs & code
Code that many APIs share, and code that runs once when a process starts. In this video, a utility class of Calm Home, used by two APIs and changed once, and a process initializer which loads data before the first request.
Shared code usually means helpers copied from endpoint to endpoint, copies that drift, a tax rate changed in one place and not in the other, and start-up work repeated on every request. With API Maker, a utility class is written once and imported by all the code of its language, a change reaches every API at the next request, and a process initializer prepares each runner once. In this video : a utility class, two APIs and one class, a change made once, a process initializer, and once per runner.
APIs and Logic, Utility Classes. Add New : a path, utils, and a name, Money : it is imported as utils/Money. Save. Its code : the tax rate of Calm Home, eighteen percent, a price with its tax, and the format of a price. Save Code. API Testing, Custom APIs : Price With Tax. Its code imports utils/Money, and asks it for the tax. Its body : the Body tab, the sku of the Aurora desk lamp.
Send : forty nine ninety, fifty eight eighty eight with its tax. Order Total, its body, an order of MySQL. Send : eight hundred thirty eight eighty five, nine hundred eighty nine eighty four with its tax. Two databases, one rule.
Now the tax changes : the class Money, twelve percent instead of eighteen. Save Code. API Testing : Price With Tax, the body, the same lamp. Fifty five eighty nine. Order Total, the body, the same order. Nine hundred thirty nine fifty one. One change, every API, at the next request : no build, no restart. A class is shared by all the code of its language : custom APIs, hooks, events and schedulers, migration scripts and test cases.
Python, PHP, C sharp, Go, Rust, Java and Kotlin have their own classes, imported the way each language imports.
One more API : Category Names answers the categories of the shop from g.shared, with no database call. Its body, empty. Send : nothing loaded yet, only the process which answered. APIs and Logic, Initializers. Add New : load-categories, order one, and its code : it reads the categories of MongoDB, keeps their names and the time in g.shared, and prints a line. Save. An initializer runs when a runner process starts : the menu of the account, Restart All Sandbox, yes.
Back in API Testing, Category Names, the body, empty. Send : the eight categories, and the time they were loaded. Again : the same time. The process loaded them once, before its first request. Console Logs View : the line of the initializer, once in each of the two sandboxes which started.
Initializers run in their order, each with a timeout ; one which fails is logged, and the runner serves all the same. An initializer runs on the runtimes of its language : a TypeScript one on Node.js and on Bun. A saved initializer applies to runners started after it : Restart All Sandbox runs it now. And classes have versions, Git and tests, like custom APIs.
One rule in one place : the tax is never copied. Start-up work in a named, ordered and timed place, not hidden in a handler. So an AI assistant asked for a new API imports utils/Money, and the rule stays one.
To sum up. A class written once, typed. Imported by every API of its language. A change live at the next request. Initializers, once per runner, before the first request. Next : events, react to anything. API Maker. Build faster, spend smarter, deliver better.
Length 4:23Events
Length 5:14Custom APIs
Length 9:04Custom APIs
Length 6:52Custom APIs