Functions
Deploy TypeScript functions that run on Deno. Invoke them via HTTP from your Flutter app, or bind them to database events so they run automatically when data changes.
What are functions?
Koolbase Functions are serverless TypeScript functions that run on Deno in an isolated subprocess. They are ideal for logic that cannot run on the client — sending emails, processing payments, calling third-party APIs, or reacting to database changes.
Each function receives a ctx object that gives access to the incoming request, your project database, and any secrets you have configured.
The context object
Every function receives a single ctx argument:
ctx.requestobjectThe incoming request — body, headers, event type, collection, payloadctx.db.insert()functionInsert a record into a collectionctx.db.find()functionQuery records from a collectionctx.db.update()functionUpdate a record by IDctx.db.delete()functionDelete a record by IDDeno.env.get()functionAccess encrypted secrets injected at runtimeTwo invocation modes
HTTP Invoke
Call the function directly from your Flutter app using the SDK. Useful for on-demand logic like sending a message, processing a form, or triggering a workflow.
DB Triggers
Bind the function to a database collection event — created, updated, or deleted. The function fires automatically whenever a matching record is mutated. No polling, no glue code.
In this section
Deploy a Function
Write and deploy TypeScript functions from the dashboard
HTTP Invoke
Call functions from Flutter via the SDK
DB Triggers
Fire functions automatically on database events
Test Mode
Test functions safely with a mock database
Secrets
Inject encrypted environment variables into functions
Retries & DLQ
Automatic retry system and dead letter queue
Limits & Timeouts
Function size, payload, and execution limits
Runtime: Deno 2.7.7
--deny-read --deny-write flags. Network access is available for calling external APIs. File system access is restricted.