apiker.init() is the single entry point. It wires your routes, creates the Durable Object classes and attaches the Worker handlers to the module's exports.
import { apiker, res } from "apiker";
apiker.init({
routes: { "/hello": () => res("Hello World!") },
exports,
objects: ["Common"]
});Required
routes
An object mapping path patterns to handlers. See Routes for the pattern syntax.
exports
The module's exports object. Apiker attaches the fetch handler and every generated Durable Object class to it, which is how Cloudflare finds them.
objects
The Durable Object class names your API stores data in. Each name becomes a real class, exported for you. Common is the default target of a bare state() call, so keep it in the list.
objects: ["Common", "Users", "RateLimit", "Logs", "Bans"]Optional
name
The display name used in emails and the admin panel. Defaults to "Apiker".
debug
Logs routing and state operations, and pretty-prints JSON responses with four-space indentation. Defaults to false — leave it off in production.
authRoutes
Adds the built-in authentication endpoints under /auth. Defaults to false. See Auth.
adminPanel
Serves the admin panel under /admp. Defaults to false. See Admin Panel.
firewall
Bans abusive IPs at the Cloudflare edge. Pass true for the defaults, or an object to set the threshold.
firewall: { limitRequestsPerMinute: 120 }The sender identity for transactional email. senderEmail is required once you send anything; name falls back to the API name.
objectStateMapping
Decides which instance of a Durable Object a bare state("Name") call reaches. See State for the tokens it accepts.
scheduled
A function invoked on a cron trigger. See Scheduled Jobs.
objectVersion
A suffix applied when deriving object instance ids, so you can move to a clean set of instances without deleting the old data.


