Compute / your logic, managed
P0 · Foundation
Custom Functions
Run application logic in managed compute, without provisioning or maintaining servers.
Functions are how the other building blocks meet. A function can read documents, check a policy, and call a model with credentials that never reach the browser.
Paths in the tables are relative to https://api.ultrahost.com/v1/projects/{projectId}. Pagination, idempotency, and errors are described in Conventions.
Create
| SDK | REST | Description |
|---|---|---|
functions.create(name, config) | POST /functions | Create a function |
functions.get(name) | GET /functions/{name} | Retrieve configuration |
functions.list() | GET /functions | List functions |
functions.update(name, config) | PATCH /functions/{name} | Update configuration |
functions.delete(name) | DELETE /functions/{name} | Delete a function |
functions.deploy(name, artifact) | POST /functions/{name}/deployments | Deploy code |
functions.listVersions(name) | GET /functions/{name}/versions | List deployed versions |
functions.rollback(name, version) | POST /functions/{name}/rollback | Roll back a deployment |
await admin.functions.create("process-invoice", config);
await admin.functions.deploy("process-invoice", artifact);Deploy and rollback are admin operations. rollback moves the active version. It follows the same idea as schemas: history stays, the pointer changes.
Configure
| SDK | REST | Description |
|---|---|---|
functions.setSecrets(name, secrets) | PUT /functions/{name}/secrets | Configure secrets |
functions.setEnvironment(name, variables) | PUT /functions/{name}/environment | Configure environment variables |
Cron targets a function by name. The function does not need its own scheduler.
Use
| SDK | REST | Description |
|---|---|---|
functions.invoke(name, input?) | POST /functions/{name}/invoke | Run and wait for the result |
functions.invokeAsync(name, input?) | POST /functions/{name}/invoke-async | Start a background execution |
functions.getExecution(id) | GET /functions/executions/{id} | Execution status |
functions.cancelExecution(id) | POST /functions/executions/{id}/cancel | Request cancellation |
functions.logs(name, options?) | GET /functions/{name}/logs | Execution logs |
functions.metrics(name, options?) | POST /functions/{name}/metrics/query | Performance metrics |
const result = await ultrahost.functions.invoke("process-invoice", {
invoiceId: "INV-123"
});const execution = await ultrahost.functions.invokeAsync("generate-report", {
reportId: "monthly-sales"
});
const status = await ultrahost.functions.getExecution(execution.id);Async execution uses the same idea as operations: an id you can read until the work finishes. useFunction(name) is the React hook for functions exposed to the client. Logs and metrics are for operators, not for the public UI.