diff --git a/apps/docs/app/reference/[...slug]/page.tsx b/apps/docs/app/reference/[...slug]/page.tsx index 2c7bb70463bd9..0ed5497704c71 100644 --- a/apps/docs/app/reference/[...slug]/page.tsx +++ b/apps/docs/app/reference/[...slug]/page.tsx @@ -33,6 +33,10 @@ export default async function ReferencePage(props: { params: Promise<{ slug: Arr const { sdkId, maybeVersion, path } = parsedPath const sdkData = REFERENCES[sdkId] + if (sdkData.enabled === false) { + notFound() + } + const latestVersion = sdkData.versions[0] const version = maybeVersion ?? latestVersion diff --git a/apps/docs/components/Navigation/Navigation.types.ts b/apps/docs/components/Navigation/Navigation.types.ts index 7918a38e68e64..816a5b363b005 100644 --- a/apps/docs/components/Navigation/Navigation.types.ts +++ b/apps/docs/components/Navigation/Navigation.types.ts @@ -11,6 +11,9 @@ export interface NavMenuSection { name: string url?: `/${string}` | `https://${string}` items: Partial[] + icon?: string + hasLightIcon?: boolean + isDarkMode?: boolean enabled?: boolean } diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts index ea41b02c326d8..0a86df1786003 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts @@ -1,6 +1,6 @@ import type { ComponentProps } from 'react' -import { isFeatureEnabled } from 'common' +import { isFeatureEnabled } from 'common/enabled-features' import type { IconPanel } from 'ui-patterns/IconPanel' import type { GlobalMenuItems, NavMenuConstant, NavMenuSection } from '../Navigation.types' @@ -460,7 +460,7 @@ export const NativeMobileLoginItems = [ }, ] -export const SocialLoginItems = [ +export const SocialLoginItems: Array> = [ { name: 'Google', icon: '/docs/img/icons/google-icon', @@ -591,7 +591,7 @@ export const PhoneLoginsItems = [ }, ] -export const auth = { +export const auth: NavMenuConstant = { icon: 'auth', title: 'Auth', items: [ @@ -1440,6 +1440,10 @@ export const functions: NavMenuConstant = { name: 'Development Environment', url: '/guides/functions/development-environment' as `/${string}`, }, + { + name: 'Architecture', + url: '/guides/functions/architecture', + }, ], }, { @@ -1865,7 +1869,7 @@ export const storage: NavMenuConstant = { ], } -export const vectorIndexItems = [ +export const vectorIndexItems: Array> = [ { name: 'HNSW indexes', url: '/guides/ai/vector-indexes/hnsw-indexes', @@ -1876,7 +1880,7 @@ export const vectorIndexItems = [ }, ] -export const ai = { +export const ai: NavMenuConstant = { icon: 'ai', title: 'AI & Vectors', url: '/guides/ai', diff --git a/apps/docs/content/guides/functions.mdx b/apps/docs/content/guides/functions.mdx index 04632855d9344..fdcf0627f9ad4 100644 --- a/apps/docs/content/guides/functions.mdx +++ b/apps/docs/content/guides/functions.mdx @@ -4,7 +4,7 @@ title: 'Edge Functions' description: 'Globally distributed TypeScript functions.' subtitle: 'Globally distributed TypeScript functions.' sidebar_label: 'Overview' -hideToc: true +tocVideo: 'za_loEtS4gs' --- Edge Functions are server-side TypeScript functions, distributed globally at the edge—close to your users. They can be used for listening to webhooks or integrating your Supabase project with third-parties [like Stripe](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/stripe-webhooks). Edge Functions are developed using [Deno](https://deno.com), which offers a few benefits to you as a developer: @@ -14,6 +14,33 @@ Edge Functions are server-side TypeScript functions, distributed globally at the - It is TypeScript first and supports WASM. - Edge Functions are globally distributed for low-latency. +## How it works + +- **Request enters an edge gateway (relay)** — the gateway routes traffic, handles auth headers/JWT validation, and applies routing/traffic rules. +- **Auth & policies are applied** — the gateway (or your function) can validate Supabase JWTs, apply rate-limits, and centralize security checks before executing code. +- **[Edge runtime](https://github.com/supabase/edge-runtime) executes your function** — the function runs on a regionally-distributed Edge Runtime node closest to the user for minimal latency. +- **Integrations & data access** — functions commonly call Supabase APIs (Auth, Postgres, Storage) or third-party APIs. For Postgres, prefer connection strategies suited for edge/serverless environments (see the `connect-to-postgres` guide). +- **Observability and logs** — invocations emit logs and metrics you can explore in the dashboard or downstream monitoring (Sentry, etc.). +- **Response returns via the gateway** — the gateway forwards the response back to the client and records request metadata. + +## Quick technical notes + +- **Runtime:** Supabase Edge Runtime (Deno compatible runtime with TypeScript first). Functions are simple `.ts` files that export a handler. +- **Local dev parity:** Use Supabase CLI for a local runtime similar to production for faster iteration (`supabase functions serve` command). +- **Global deployment:** Deploy your Edge Functions via Supabase Dashboard, CLI or MCP. +- **Cold starts & concurrency:** cold starts are possible — design for short-lived, idempotent operations. Heavy long-running jobs should be moved to [background workers](/docs/guides/functions/background-tasks). +- **Database connections:** treat Postgres like a remote, pooled service — use connection pools or serverless-friendly drivers. +- **Secrets:** store credentials in Supabase [project secrets](/docs/reference/cli/supabase-secrets) and access them via environment variables. + +## When to use Edge Functions + +- Authenticated or public HTTP endpoints that need low latency. +- Webhook receivers (Stripe, GitHub, etc.). +- On-demand image or Open Graph generation. +- Small AI inference tasks or orchestrating calls to external LLM APIs (like OpenAI) +- Sending transactional emails. +- Building messaging bots for Slack, Discord, etc. +