Aerostack
Fullstack Edge Functions

Every edge function is a
complete backend.

Serverless functions with a database, cache, queue, AI, vector search, and storage as native bindings. Not HTTP calls. Zero latency. Zero config.

8 native bindings AI built-in Zero cold start Cloudflare global edge
// The Problem

Traditional serverless = function + 7 external services.

Traditional serverless

Function runtime
Database (HTTP) +latency
Cache (HTTP) +latency
Queue (HTTP) +latency
AI provider (HTTP) +latency
Object storage (HTTP) +latency
Vector DB (HTTP) +latency
Stateful coord. (HTTP) +latency
8 services. 7 HTTP round-trips. 7 sets of credentials.

Aerostack edge functions

env.DB D1 SQL database
env.CACHE KV cache
env.QUEUE Background jobs
env.AI AI runtime
env.VECTORIZE Vector search
env.STORAGE R2 object storage
env.DO Durable Objects
env.HYPERDRIVE Postgres/MySQL pool
1 function. 8 primitives built in. Zero HTTP overhead. Zero config.
// Built-in Bindings

8 native bindings. Zero setup.

Every Cloudflare edge function gets access to the full primitive stack — injected at runtime, no credentials, no connection strings.

database

Database

env.DB

SQL queries, batch operations, prepared statements. SQLite-compatible via Cloudflare D1.

speed

Cache

env.CACHE

Key-value storage with TTL, atomic counters, list operations. In-memory speed at the edge.

queue

Queue

env.QUEUE

Background jobs with retries, status tracking, and dead-letter handling. Fire and forget.

psychology

AI Runtime

env.AI

On-edge LLM inference, embeddings, and streaming. Multi-provider — OpenAI, Anthropic, and more.

travel_explore

Vector Search

env.VECTORIZE

Semantic similarity search, RAG pipelines, automatic embedding generation.

folder_open

Storage

env.STORAGE

Object storage with CDN delivery and zero egress fees. Upload, serve, and manage files.

hub

Durable Objects

env.DO

Strongly-consistent coordinated state. WebSockets, counters, locks — all without a separate database.

electric_bolt

Hyperdrive

env.HYPERDRIVE

Pooled, low-latency connections to your existing Postgres or MySQL. No connection-string management.

// AI Functions

AI built into every function.

Aerostack edge functions include the Cloudflare AI runtime as a native binding — not a third-party API call with latency and key management overhead. Call env.AI.run() directly in your handler for on-edge inference, embeddings, and streaming responses.

  • On-edge inference — model runs at the same location as your code
  • Multi-provider: OpenAI, Anthropic, Workers AI, and more
  • Embeddings generated and stored in env.VECTORIZE in one call
  • Streaming responses with no extra infrastructure
  • 500 K inference tokens free per month on every account
psychology ai-function.ts — on-edge inference
export default {
  async fetch(req: Request, env: Env) {
    const { query } = await req.json()

    // Generate embedding — native, zero latency
    const { data: [vec] } = await env.AI.run(
      '@cf/baai/bge-base-en-v1.5',
      { text: [query] }
    )

    // Semantic search in Vectorize
    const { matches } = await env.VECTORIZE
      .query(vec.values, { topK: 5 })

    // Generate answer with context
    const answer = await env.AI.run(
      '@cf/meta/llama-3.3-70b-instruct-fp8-fast',
      { messages: [{ role: 'user',
          content: `Answer using: ${matches}` }] }
    )

    return Response.json(answer)
  }
}
// Architecture

Edge functions vs serverless functions — what actually differs.

"Serverless" and "edge" are often used interchangeably. They are not the same thing — and the difference compounds as your workload grows.

Dimension Traditional serverless
(Lambda, Cloud Functions)
Aerostack edge functions
(Cloudflare Workers)
Execution location 1–4 regional data centres 300+ global edge locations — closest to user
Cold start 100ms–3s (worse in VPCs) Zero — V8 isolates, no container spin-up
Data layer External HTTP calls to DB, cache, queue 8 native bindings — in-process, zero network hop
AI inference External API call + key management env.AI — on-edge, same process as your code
Latency baseline Function RTT + up to 6 service RTTs Function RTT only — all primitives are in-process
Auth & rate limits Custom middleware or separate API gateway One-click gateway — auto key, rate limits, analytics
Agent integration HTTP endpoint only Native MCP tool — callable by name from any AI agent

The comparison that matters for AI workloads: edge functions keep all data operations in-process. Serverless functions make each one a round-trip.

// Open Function Standard

Write once, run anywhere.

OFS functions declare their dependencies in a manifest — the runtime injects them. The same function runs locally on Node.js or Bun with mock bindings during development, and on Cloudflare Workers in production. No vendor lock-in.

Unlike Supabase (Deno-only) or Netlify (Node-only), an OFS function is not tied to one runtime. Declare what your function needs in aerostack.json and the platform provides it — whether that's the real Cloudflare bindings in production or compatible mock adapters when you run locally.

This means you can develop and test functions on your laptop without deploying to the edge first, then ship to 300+ Cloudflare locations with a single command. The local mock injects sdk.db, sdk.cache, and every other binding using the same interface the edge runtime uses.

aerostack.json
{
"name": "get-user",
"runtime": "workers",
"requires": ["db", "cache"]
}
Cloudflare Workers — Stable Node.js 20+ — Stable Bun — Stable Deno — Beta
// How It Looks

One function. Full backend.

index.ts
export default {
  async fetch(request: Request, env: Env) {
    // Query database — native binding, not HTTP
    const orders = await env.DB.prepare(
      'SELECT * FROM orders WHERE user_id = ?'
    ).bind(userId).all()

    // Cache the result with TTL
    await env.CACHE.put('recent-orders', JSON.stringify(orders),
      { expirationTtl: 3600 })

    // Queue a background notification
    await env.QUEUE.send({ type: 'order-summary', userId })

    // AI analysis
    const summary = await env.AI.run('...', { messages: [...] })

    return Response.json({ orders, summary })
  }
}

Four bindings. One function. No infrastructure to manage.

// Agent-Callable

Expose any function as an MCP tool.

Deploy a function, link it to an MCP server, and every AI agent in your workspace can call it by name — no HTTP URL, no auth plumbing. Supabase and Netlify give you an endpoint; Aerostack gives you a named, agent-callable capability.

deployed_code function → MCP tool
// Deploy the function, then link it to an MCP server
aerostack fn deploy lookup-order
aerostack mcp add-tool lookup-order

// Agents now call it by name with a typed schema
// Deploy

Two ways to ship a serverless function.

Deploy a raw function for a public URL, or deploy with a gateway to add API keys, rate limits, and analytics in one click.

bolt

Function only

Public URL · instant
  • signal Deploys to a Cloudflare Worker in roughly 30 seconds
  • signal Returns a public function URL immediately
  • signal No auth, no setup — ideal for prototypes and internal tools
bolt

Function + gateway

One click · managed
  • signal Auto-generates a consumer API key for the function
  • signal Adds rate limiting and a starter usage plan
  • signal Turns on request analytics and logs — no middleware to write
// Use Cases

Build anything. All at the edge.

cloud

Custom API Backend

Build REST or GraphQL APIs with database, auth, and caching built in. Ship a complete backend in a single file.

cloud

Bot Intelligence Layer

Power AI bots with persistent memory, RAG over your data, and real-time tool execution at the edge.

cloud

RAG Pipeline

Ingest documents, generate embeddings, store vectors, and serve semantic search — all from one function.

cloud

Real-time Data Pipeline

Process webhooks, transform data, queue background jobs, and write results to database — with zero infrastructure.

// Foundation Layer

Functions power everything.

Edge functions are the foundation layer. Every MCP server, skill, bot workflow, and agent endpoint runs on top of the same fullstack runtime.

Start building Cloudflare edge functions — all 8 primitives included.

Database, cache, queue, AI runtime, vector search, storage, Durable Objects, and Hyperdrive — every serverless function ships with the full stack, globally deployed in 30 seconds.

Frequently asked questions

What are Aerostack edge functions, and what makes them "fullstack"? expand_more
Aerostack edge functions are TypeScript serverless functions that run on Cloudflare's global edge network. What makes them fullstack is that every binding you'd normally wire up separately — a relational database (D1/SQLite), a key-value cache (KV), object storage (R2), queues, vector search, Durable Objects, and Cloudflare's AI runtime — is injected at runtime with no connection strings, no environment wrangling, and no separate provisioning step. You write a TypeScript handler, call `aerostack deploy`, and in roughly 30 seconds the function is live worldwide. There's no server to manage, no warm-up penalty, and no cold start. Most edge platforms give you compute; Aerostack gives you compute plus the full data layer already attached.
How do Aerostack edge functions differ from AWS Lambda? expand_more
The gaps are structural, not just cosmetic. AWS Lambda runs in a handful of regions; Aerostack edge functions run at Cloudflare's 300+ global locations, so a request is handled close to the user without any routing configuration on your part. Lambda has a well-documented cold-start problem that gets worse with VPC attachments; Aerostack functions have zero cold start by design. The deeper difference is the data layer: with Lambda you configure a VPC, manage connection pools, add a separate cache layer, and wire credentials for each service. With Aerostack, database, KV cache, object storage, queues, and AI are all native bindings — available as typed objects in your handler with nothing to configure. For teams building AI-adjacent or latency-sensitive workloads, that eliminates an entire class of infrastructure toil.
What data bindings are available inside a function? expand_more
Every function has access to the full Cloudflare primitive stack as native bindings injected at runtime: D1 for relational SQL (SQLite-compatible), KV for low-latency key-value reads, R2 for object storage with no egress fees, queues for async fan-out and background jobs, vector search for semantic retrieval and embedding lookups, the Cloudflare AI runtime for on-edge inference, and Durable Objects for strongly-consistent coordinated state. None of these require connection strings or credentials in your code — they're available as typed objects in the function context from the moment the handler starts. You pick which bindings a function uses when you set it up, and only those are attached, keeping the surface area minimal.
How do AI agents call an edge function? expand_more
Any edge function can be exposed as an MCP tool, which means any AI agent connected to your Aerostack workspace can call it by name — no HTTP URL, no authentication plumbing, no prompt-engineering to describe the endpoint. The agent sees the function as a named capability with a typed schema, calls it like any other tool, and gets a structured result back. This is what makes edge functions a first-class part of the agentic layer: your business logic, database queries, or external API wrappers become agent-callable tools without any extra integration work. Functions can also back skills — reusable, parameterized tools shared across agents — and can be called from within workflow nodes, so the same function serves both interactive agent sessions and automated pipelines.
How do I expose an edge function as an MCP tool? expand_more
Deploy the function, then link it to an MCP server in your workspace — once linked, the function shows up as a named tool with a typed schema that any connected AI agent can call directly. There is no separate HTTP integration to build and no endpoint description to prompt-engineer: the agent sees the function as a first-class capability and invokes it like any other tool. This is the part incumbent edge-function platforms like Supabase and Netlify do not do. They hand you an HTTP endpoint; Aerostack turns the same TypeScript logic into an agent-callable tool. The same function can also back a reusable skill and run inside a workflow node, so one piece of business logic serves direct API calls, agent sessions, and automated pipelines.
Can I add authentication and billing to my edge function without writing middleware? expand_more
Yes. There are two ways to deploy. The first deploys the function on its own and returns a public Cloudflare Worker URL in roughly 30 seconds — no auth, ideal for prototypes and internal tools. The second deploys the function with a gateway in one click: it auto-generates a consumer API key, applies rate limiting, sets up a starter usage plan, and turns on request analytics and logs. You do not write any auth or rate-limit middleware yourself — the gateway handles key validation, throttling, and usage tracking in front of the function. You can start with a raw function and add a gateway later when you are ready to share it more widely or put guardrails around it.
What does the free tier include for edge functions? expand_more
The free tier includes access to all edge function capabilities — compute, bindings, and the AI runtime — plus 500,000 AI inference tokens per month. That covers a meaningful volume of production workloads: semantic search, on-edge classification, generation tasks, or any combination, all without a credit card. The compute itself runs on Cloudflare Workers, which has its own generous free execution tier. When you bring your own model key (OpenAI, Anthropic, or any provider you configure), the platform markup drops to zero and the token budget is effectively your provider account's limit. There's no cold-start tax on the free tier — function latency is identical regardless of plan.
How do I deploy an edge function globally? expand_more
Write your TypeScript handler, configure your bindings in the function settings, and run `aerostack deploy` from the project directory. The CLI builds, validates, and propagates the function across Cloudflare's network — the whole process takes roughly 30 seconds from command to globally live. There's no region selection, no multi-region deployment config, and no DNS setup; Cloudflare's anycast routing ensures every request hits the nearest available location automatically. Subsequent deploys follow the same path: change the code, run the command, and the updated version is live worldwide in the same window. Rollbacks work the same way — redeploy the previous version and the change propagates in about 30 seconds.
Can edge functions be used inside workflows and skills? expand_more
Yes — edge functions are one of the primary building blocks for the rest of the Aerostack platform. As an MCP tool, a function is callable from any MCP tool node inside a workflow, so a multi-step agentic automation can read from a database, call an external API, or run an inference step just by calling the function by name at the relevant node. Skills are parameterized, reusable tool definitions that also back edge functions — you build the logic once as a function and surface it as a named skill available across every agent and bot in the workspace. This means the same TypeScript business logic that handles a direct API call is also the engine behind a skill a conversational agent invokes and a step inside a published workflow.
When is an edge function NOT the right choice — and should I use a workflow or MCP server instead? expand_more
An edge function is the right choice when the logic is self-contained, deterministic, and fast: a database read, a transform, a webhook handler, a short AI inference call. It is not the right choice when the task involves multi-step reasoning where the path depends on model output, or when you need a human-approval pause, conditional branching across many tools, or state held across minutes or hours. Those are workflow problems, not function problems. Similarly, if you're integrating a third-party SaaS and the integration involves multiple API surfaces with complex auth, an MCP server keeps that complexity in one place rather than spreading it across several functions. The rule of thumb: if you can describe the logic in a single sentence with no 'it depends', use a function; if the logic has branches the model decides, use a workflow.
What are Cloudflare edge functions and how does Aerostack use them? expand_more
Cloudflare edge functions — also called Cloudflare Workers — are serverless TypeScript/JavaScript functions that execute at Cloudflare's network of 300+ global locations rather than in a fixed region. This means the function runs physically close to whoever makes the request, cutting round-trip time without any routing configuration on your part. Aerostack builds on top of Cloudflare Workers and extends them with a managed primitive layer: instead of provisioning a D1 database, a KV namespace, an R2 bucket, and a Vectorize index separately and wiring them all up, Aerostack injects all 8 bindings — D1, KV, R2, queues, AI runtime, vector search, Durable Objects, and Hyperdrive — into your function at runtime, automatically. You declare which bindings a function uses, call aerostack deploy, and the function is live at every Cloudflare edge location in roughly 30 seconds. The result is a Cloudflare edge function with a complete data layer already attached — not a bare worker you still need to configure.
What is the difference between an AI function and a regular serverless function? expand_more
A regular serverless function handles HTTP requests, runs business logic, and optionally calls external APIs. An AI function does all of that but also has AI inference, embeddings, and vector search built in as native bindings — not external HTTP calls to a provider. With Aerostack edge functions, env.AI gives you on-edge inference via the Cloudflare AI runtime, env.VECTORIZE gives you semantic search over your own embeddings, and env.DB lets you store and retrieve structured data alongside vector results — all in one TypeScript handler, all without managing API keys for a separate AI provider. The practical difference: a regular serverless function calling OpenAI adds 200–800ms of API latency per inference call. An Aerostack AI function runs inference at the same edge location as the function itself, with no external round-trip. That matters for real-time use cases like streaming chat, semantic search, and on-demand classification.