Skip to main content

Orbit Functions

Orbit Functions lets you deploy serverless endpoints with a single click. Write your function code, deploy, and get a fn-{name}-{org}.case.systems URL instantly.

Why Functions?

  • Zero Infrastructure - No servers to manage, no containers to configure
  • Instant Deployment - Deploy in seconds, not minutes
  • Automatic Scaling - Scales from 0 to thousands of requests automatically
  • Pay Per Use - Only pay for actual execution time

Quick Start

1. Navigate to Functions

In the Console sidebar, click Functions under the Compute section.

2. Create a Function

Click New and give your function a name. The URL will be generated automatically:
fn-{function-name}-{org}.case.systems

3. Write Your Code

Use the built-in Monaco editor to write your function. Functions receive a standard Web Request and return a Response:
export default async function handler(request) {
  const url = new URL(request.url);
  
  return new Response(JSON.stringify({
    message: "Hello from Orbit Functions!",
    path: url.pathname,
    method: request.method,
  }), {
    headers: { "Content-Type": "application/json" }
  });
}

4. Test Locally

Click Test to open the test panel. You can:
  • Select HTTP method (GET, POST, etc.)
  • Set the request path
  • Add a request body for POST/PUT requests
  • See the response instantly without deploying

5. Deploy

Click Save & Deploy to push your function to production. Once deployed, the status changes to active and you can access it via the URL.

Request Object

Your function receives a Request-like object with these properties:
PropertyTypeDescription
methodstringHTTP method (GET, POST, etc.)
urlstringFull URL including query string
headers.get(name)functionGet a header value
json()async functionParse JSON body
text()async functionGet raw body text

Response Object

Return a Response object with your data:
// JSON response
return new Response(JSON.stringify({ data: "value" }), {
  status: 200,
  headers: { "Content-Type": "application/json" }
});

// Error response
return new Response(JSON.stringify({ error: "Bad request" }), {
  status: 400,
  headers: { "Content-Type": "application/json" }
});

// Redirect
return Response.redirect("https://example.com", 302);

Configuration

Configure your function using the dropdowns in the editor:
SettingOptionsDescription
RuntimeNode.js 20, Node.js 18, Python 3.12, Python 3.11Language runtime
Timeout10s - 15minMaximum execution time
Memory128MB - 4GBMemory allocation

AI Code Generation

Click the Thurgood button to have AI write your function code. Describe what you want:
“A webhook handler that validates Stripe signatures and sends a Slack notification on successful payments”
Thurgood will generate production-ready, heavily-commented code using Claude Opus 4.5.

Example Functions

Hello World

export default async function handler(request) {
  return new Response(JSON.stringify({
    message: "Hello, World!",
    timestamp: new Date().toISOString(),
  }), {
    headers: { "Content-Type": "application/json" }
  });
}

Query Parameters

export default async function handler(request) {
  const url = new URL(request.url);
  const name = url.searchParams.get("name") || "stranger";
  
  return new Response(JSON.stringify({
    greeting: `Hello, ${name}!`,
  }), {
    headers: { "Content-Type": "application/json" }
  });
}

POST with JSON Body

export default async function handler(request) {
  if (request.method !== "POST") {
    return new Response(JSON.stringify({ error: "Method not allowed" }), {
      status: 405,
      headers: { "Content-Type": "application/json" }
    });
  }
  
  const body = await request.json();
  
  return new Response(JSON.stringify({
    received: body,
    processedAt: new Date().toISOString(),
  }), {
    headers: { "Content-Type": "application/json" }
  });
}

Webhook Handler

export default async function handler(request) {
  // Verify webhook signature
  const signature = request.headers.get("x-webhook-signature");
  if (!signature) {
    return new Response(JSON.stringify({ error: "Missing signature" }), {
      status: 401,
      headers: { "Content-Type": "application/json" }
    });
  }
  
  const payload = await request.json();
  
  // Process the webhook
  console.log("Received webhook:", payload.event);
  
  return new Response(JSON.stringify({ success: true }), {
    headers: { "Content-Type": "application/json" }
  });
}

Pricing

Functions are billed based on execution time and memory:
  • Requests: $0.20 per 1M requests
  • Duration: $0.00001667 per GB-second
Example: A 256MB function running for 100ms = $0.000000417 per request.