Docs

Overview

Serverless compute that scales to zero, triggered by HTTP, queues, storage events, or cron.

Function provides event-driven, stateless compute. Functions handle HTTP requests, process queue messages, react to storage events, or run on a schedule. They scale automatically with load and scale to zero when idle.

Platform Mapping

PlatformBacking ServiceProvisioned by
AWSAWS Lambda (ARM64/Graviton)Alien
GCPGoogle Cloud RunAlien
AzureAzure Container AppsAlien

When to Use

Use Function for event-driven, stateless compute — HTTP APIs, webhook handlers, background processors, queue consumers, scheduled tasks.

Don't use Function for long-running stateful workloads, persistent WebSocket connections, or services that need internal DNS discovery.

Quick Start

// alien.ts
const api = new alien.Function("api")
  .code({ type: "source", src: "./api", toolchain: { type: "typescript" } })
  .ingress("public")
  .permissions("execution")
  .build()

Ingress

Controls how the function is accessible over the network.

ModeDescription
"public"Gets an HTTPS endpoint. For APIs, webhooks, internal tools. See External URLs.
"private"No HTTP endpoint. Only reachable via triggers or direct invocation. Default.
"vpc"Accessible within the VPC only. Requires network configuration.

Function-to-Function Invocation

Functions can call other functions directly — low-latency internal calls that bypass public endpoints:

import { func } from "@alienplatform/sdk"

const processor = await func("image-processor")
const result = await processor.invokeJson("resize", { imageUrl: "...", width: 800 })
const url = await processor.getUrl()  // public URL, if available
let processor = ctx.bindings().load_function("image-processor").await?;
let response = processor.invoke(FunctionInvokeRequest {
    target_function: "image-processor".to_string(),
    method: "POST".to_string(),
    path: "/resize".to_string(),
    headers: BTreeMap::new(),
    body: serde_json::to_vec(&payload)?,
    timeout: Some(Duration::from_secs(30)),
}).await?;

Configuration

MethodDefaultDescription
.code(code)requiredSource code or pre-built image. See Toolchains.
.ingress("public" | "private" | "vpc")"private"Network accessibility. See Ingress above.
.memoryMb(number)256Memory allocation. 128–32,768 MB.
.timeoutSeconds(number)180Max execution time. 1–3,600 seconds.
.concurrencyLimit(number)platform defaultMax concurrent executions. Maps to reserved concurrency (Lambda), max instances (Cloud Run), or max replicas (Container Apps).
.commandsEnabled(boolean)falseEnable the remote command protocol.
.readinessProbe({ method, path })Health check after deploy. Only for "public" ingress.
.environment(Record){}Environment variables.
.link(resource)Connect to a resource for binding access. Can be called multiple times.
.trigger(trigger)Add an event trigger. Can be called multiple times.
.permissions(string)requiredPermission profile name.

Triggers

// Queue trigger — one message per invocation
const worker = new alien.Function("worker").trigger(tasks).build()

// In function code:
import { onQueueMessage, onStorageEvent } from "@alienplatform/sdk"

onQueueMessage("tasks", async (msg) => { /* ... */ })
onStorageEvent("uploads", async (event) => { /* ... */ })

On this page