Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 6 min read How-to mediumAdept

Building ChatGPT Plugins with Supabase Edge Runtime

A TypeScript template for ChatGPT Plugins runs on Supabase Edge Runtime (Deno). The required ai-plugin.json manifest is served by importing JSON into the main function handler, since Edge Runtime can't serve static files. The OpenAPI definition is generated from JSDoc annotations on Deno oak routes using swagger-jsdoc. The guide also covers adding ChatGPT-specific CORS headers via oak middleware, running locally with Docker and docker-compose bind mounts, installing the localhost plugin in the ChatGPT UI, and deploying to Fly.io.

Assumes: TypeScript basicsDocker and docker-composeOpenAPI specifications

Related posts

  • Building ChatGPT Apps with Supabase Edge Functions and mcp-use

    Supabase mediumAdept

    ChatGPT apps built on OpenAI's Apps SDK consist of an MCP server backend and an iframe-rendered web component, and mcp-use lets that MCP server run on Supabase Edge Functions by using Hono instead of the Express-based official SDK. The walkthrough builds a database explorer exposing list-tables, show-table, execute-SQL and Supabase-status tools, each returning React widgets. It distinguishes display-only widgets, which are auto-registered as tools and fetch data client-side, from data-returning widgets, where the server sends separate props to the UI and output to the LLM. It closes with deployment via an mcp-use script and connecting the endpoint in ChatGPT developer mode.

  • Edge Functions are now available in Supabase

    Supabase easyNovice

    Supabase Edge Functions run TypeScript globally on the Deno runtime via Deno Deploy across 30+ data centers. Supabase chose functions-as-a-service over containers for simpler developer experience and faster start-ups, and global deployment over a single region, with Postgres-colocated Database Functions covering DB-heavy work. Requests pass through a Relay gateway that verifies JWTs, rate-limits and logs, then maps function metadata to a Deno Deploy deployment ID. Cold starts fetch code and secrets from Supabase, and logs flow through Logflare into the dashboard. Functions are POST-only, and static hosting is ruled out after phishing abuse on Supabase Storage got the domain denylisted.

  • Mozilla Llamafile in Supabase Edge Functions

    Supabase mediumAdept

    Supabase Edge Functions can now use Mozilla Llamafile, alongside Ollama, as the inference server via an OpenAI-API-compatible mode. Setup takes one of two paths. You can set AI_INFERENCE_API_HOST and call Supabase.ai.Session with mode 'openaicompatible'. Or you can point the OpenAI Deno SDK at the Llamafile server through OPENAI_BASE_URL and stream responses back as server-sent events. With the SDK, the model parameter is ignored because the model is whichever Llamafile is running. The walkthrough covers local serving with the Supabase CLI, deploying a containerized Llamafile to a host like Fly.io, and setting secrets to deploy the functions.

  • Supabase Middleware: composable, reusable middleware for Web Fetch handlers

    Supabase mediumAdept

    `@supabase/middleware` is an MIT-licensed, type-safe middleware engine for Web Fetch handlers. Per-request logic such as CORS, JWT claim verification, feature flags, RLS-scoped Supabase/Postgres clients and MCP OAuth discovery is composed as an ordered pipeline that each adds a typed key to a shared ctx, can short-circuit with a Response, or modify the response on the way out. The pipeline is a plain fetch handler, so it runs on Edge Functions, Vercel, Cloudflare Workers, Deno, Bun and Node 22+. Copy-in bridge files reuse the same entries in Hono, H3, Elysia, NestJS and TanStack Start. Custom middleware is written with `defineMiddleware`, whose type parameters make duplicate keys or misordered dependencies fail to compile (TypeScript 5.4+). The pg-based clients don't work on Workers because they need TCP sockets.

  • Supabase Edge Runtime: Self-hosted Deno Functions

    Supabase mediumAdept

    Supabase Edge Runtime is an MIT-licensed, Rust-based web server built on deno_core that self-hosts Deno Edge Functions (TypeScript, JavaScript, WASM) without code changes. A hyper HTTP server forwards requests to a Main Worker V8 isolate, which can create sandboxed User Worker isolates with restricted APIs and configurable memory (default 150 MB) and wall-clock (default 60s) limits. It also powers `supabase functions serve` for serving all functions locally with hot reload and Deno Deploy API parity, and a Fly.io walkthrough shows how to deploy it. Planned uses include replacing Kong as an API gateway, scheduled functions, and custom platform globals.

The quest for software engineering knowledge.

Look:
Layout: