< 5ms Cold Start
V8 isolates spin up in microseconds — 100× faster than container-based functions. No waiting.
TypeScript Native
Write TypeScript directly — no build step. The runtime compiles on first invocation and caches.
Web Standard APIs
Full access to fetch, Request, Response, crypto, URL, TextEncoder, and the entire Web API surface.
Per-Project Isolation
Each function runs in its own V8 isolate. Memory is bounded. No shared state between projects.
Invocation Logs
Every invocation is logged — status code, duration, error messages — visible in the console.
npm via CDN
Import any npm package via CDN URL (esm.sh, jspm). No install step, no node_modules.
Functions vs Tasks vs Runs
- Functions — Lightweight HTTP handlers. Any HTTP request → V8 isolate → Response. Best for webhooks, APIs, data transforms.
- Tasks — Durable TypeScript handlers with queues, retries, step.run, and step.waitForEvent. Best for long-running async work.
- Runs — Container-based batch compute. Bring any Docker image. Best for ML training, ETL, and multi-language workloads.
Quick Start
Write a function handler, deploy it with the CLI, and get a live URL immediately.
// Every function exports a default async handler
// req: standard Web API Request object
// return: standard Web API Response object
export default async function handler(req: Request): Promise<Response> {
const url = new URL(req.url)
const name = url.searchParams.get('name') ?? 'World'
return Response.json({
message: `Hello, ${name}!`,
timestamp: new Date().toISOString(),
})
}# Deploy the function
sylphx functions deploy hello-world --file ./functions/hello-world/index.ts
# Output:
# Name: hello-world
# Version: 1
# Status: ● active
# URL: https://my-project.sylphx.app/functions/hello-world
# Invoke it immediately
curl "https://my-project.sylphx.app/functions/hello-world?name=Claude"
# → { "message": "Hello, Claude!", "timestamp": "2026-04-06T..." }Using Sylphx BaaS in Functions
Functions can access any Sylphx BaaS service using the server SDK. The SYLPHX_SECRET_KEY env var is automatically injected at runtime.
import { createConfig, createServerClient } from 'https://esm.sh/@sylphx/sdk/server'
const config = createConfig({
secretKey: Deno.env.get('SYLPHX_SECRET_KEY')!,
})
export default async function handler(req: Request): Promise<Response> {
if (req.method !== 'POST') {
return new Response('Method Not Allowed', { status: 405 })
}
const { email, name } = await req.json()
// Auth — create a new user
const client = createServerClient(config)
const user = await client.auth.createUser({ email, name })
// KV — cache the user profile
const { kv } = await import('https://esm.sh/@sylphx/sdk/server')
const kvClient = kv(config)
await kvClient.set(`user:${user.id}`, user, { ttl: 3600 })
return Response.json({ userId: user.id }, { status: 201 })
}Importing npm Packages
Since functions run in Deno, npm packages are imported via CDN URL rather than npm install. Use esm.sh for best compatibility.
// Import npm packages via esm.sh CDN
import { z } from 'https://esm.sh/[email protected]'
import { Hono } from 'https://esm.sh/hono@4'
const app = new Hono()
const schema = z.object({ email: z.string().email(), age: z.number().min(18) })
app.post('/validate', async (c) => {
const body = await c.req.json()
const result = schema.safeParse(body)
if (!result.success) {
return c.json({ errors: result.error.flatten() }, 400)
}
return c.json({ valid: true, data: result.data })
})
export default app.fetchSDK — Programmatic Deploy
import { createConfig, FunctionsClient } from '@sylphx/sdk'
const config = createConfig({ secretKey: process.env.SYLPHX_SECRET_KEY! })
// Deploy (create or update — idempotent)
const fn = await FunctionsClient.deploy(config, {
name: 'send-webhook',
code: `
export default async (req: Request) => {
const { url, payload } = await req.json()
await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
})
return Response.json({ delivered: true })
}
`,
timeoutSeconds: 10,
memoryMb: 64,
})
console.log('Deployed:', fn.url)
// Invoke server-to-server
const result = await FunctionsClient.invoke(config, 'send-webhook', {
url: 'https://hooks.example.com/notify',
payload: { event: 'order.created', orderId: '123' },
})
// Fetch recent logs
const logs = await FunctionsClient.logs(config, 'send-webhook', {
limit: 20,
errorsOnly: true,
})Runtime Limits
| Property | Type | Description |
|---|---|---|
Memory | integer | Default 150 MB, max 512 MB |
Execution timeout | duration | Default 30s, max 120s |
Code size | size | Max 512 KB inline; use CLI for larger bundles |
Allowed APIs | string | Full Web Standard API (fetch, crypto, URL, TextEncoder, etc.) |
Disallowed APIs | string | No filesystem (fs), no raw sockets (net), no child_process |
npm packages | string | Import via CDN URL (esm.sh). Pure-JS packages only — no native bindings. |
Runtime | string | Deno (V8 isolates via Supabase Edge Runtime) |
API Reference
| Property | Type | Description |
|---|---|---|
POST /sdk/functions | endpoint | Deploy (create or update) a function. Returns deploy result with live URL. |
GET /sdk/functions | endpoint | List all functions for this project. |
GET /sdk/functions/:name | endpoint | Get a function by name. |
DELETE /sdk/functions/:name | endpoint | Permanently delete a function. |
POST /sdk/functions/:name/invoke | endpoint | Server-to-server function invocation. |
GET /sdk/functions/:name/logs | endpoint | Fetch recent invocation logs. |