API Maker
The backend engine for the AI era
Utility classesEpisode 20 6:03 9 chapters November 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
Some code is shared by many APIs. And some code must run once, when a process starts. In this video, Calm Home writes a utility class, uses it in two APIs, and changes it once. Then it adds a process initializer, which loads data before the first request.
Shared code is usually hard to keep in sync. Helpers are copied from one endpoint to another. The copies drift apart. A tax rate is changed in one place, and not in the other. And start up work is repeated on every request. With API Maker, you write a utility class once, and all the code of its language imports it. 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 that use one class, a change made once, a process initializer, and code that runs once for each runner.
Open APIs and Logic, then Utility Classes. Click Add New. Give a path, utils, and a name, Money. So it is imported as utils/Money. Save it. Now open its code. It holds the tax rate of Calm Home, eighteen percent. It gives a price with its tax, and the format of a price. Click Save Code. In API Testing, pick Custom APIs, then Price With Tax. Its code imports utils/Money, and asks it for the tax.
Now its body. Open the Body tab, and give the sku of the Aurora desk lamp. Send. The price is forty nine ninety, and fifty eight eighty eight with its tax. Now pick Order Total. In its body, give an order from MySQL. Send. The total is eight hundred thirty eight eighty five, and nine hundred eighty nine eighty four with its tax. Two databases, and one rule.
Now the tax changes. Open the class Money, and set twelve percent instead of eighteen. Click Save Code. Back in API Testing, pick Price With Tax. In the body, keep the same lamp. Now it is fifty five eighty nine. Pick Order Total. In the body, keep the same order. Now it is nine hundred thirty nine fifty one. One change reached every API, at the next request. No build, and 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. Each language imports them in its own way.
Here is one more API. Category Names answers with the categories of the shop from g.shared, with no database call. Its body is empty. Send. Nothing is loaded yet. We only see which process answered. Open APIs and Logic, then Initializers. Click Add New. Name it load-categories, with order one, and write its code. It reads the categories from MongoDB. It keeps their names and the time in g.shared, and prints a line.
Save it. An initializer runs when a runner process starts. So open the menu of the account, click Restart All Sandbox, and say yes.
Back in API Testing, pick Category Names. Its body is empty. Send. We get the eight categories, and the time they were loaded. Send again. The time is the same. The process loaded them once, before its first request. Console Logs View shows the line of the initializer, once in each of the two sandboxes that started.
Good to know. Initializers run in their order, each with a time limit. If one fails, it is logged, and the runner still serves requests. An initializer runs on the runtimes of its language. A TypeScript one runs on Node.js and on Bun. A saved initializer applies to runners that start after it. Restart All Sandbox runs it now. And classes have versions, Git, and tests, like custom APIs.
One rule lives in one place, so the tax is never copied. Start up work has its own place, with a name, an order, and a time limit. It is not hidden in a handler. So when you ask an AI assistant for a new API, it imports utils/Money, and the rule stays in one place.
To sum up. A class is written once, with types. Every API of its language imports it. A change is live at the next request. And initializers run once for each runner, before the first request. Next: events, to react to anything. API Maker. Build faster, spend smarter, deliver better.
Length 5:10Events
Length 8:36Heavy APIs
Length 6:16Per admin
Length 6:01Custom APIs