FunctionsInstructionsLocal() — supabase Function Reference
Architecture documentation for the FunctionsInstructionsLocal() function in FunctionsEmptyState.tsx from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/studio/components/interfaces/Functions/FunctionsEmptyState.tsx lines 192–359
export const FunctionsInstructionsLocal = () => {
const showStripeExample = useIsFeatureEnabled('edge_functions:show_stripe_example')
const templates = useMemo(() => {
if (showStripeExample) {
return EDGE_FUNCTION_TEMPLATES
}
// Filter out Stripe template
return EDGE_FUNCTION_TEMPLATES.filter((template) => template.value !== 'stripe-webhook')
}, [showStripeExample])
return (
<>
<div className="flex flex-col gap-y-4">
<Card>
<CardHeader>
<CardTitle>Developing Edge Functions locally</CardTitle>
</CardHeader>
<CardContent
className={cn(
'p-0 flex flex-col',
'2xl:grid 2xl:grid-cols-[repeat(auto-fit,minmax(240px,1fr))] 2xl:divide-y-0 2xl:divide-x',
'divide-y divide-default items-stretch'
)}
>
<div className="p-8">
<div className="flex items-center gap-2">
<Code size={20} />
<h4 className="text-base text-foreground">Create an Edge Function</h4>
</div>
<p className="text-sm text-foreground-light mt-1 mb-4 prose [&>code]:text-xs text-sm max-w-full">
Create a new edge function called <code>hello-world</code> in your project via the
Supabase CLI.
</p>
<div className="mb-4">
<CodeBlock
language="bash"
hideLineNumbers={true}
className={cn(
'px-3.5 max-w-full prose dark:prose-dark [&>code]:m-0 2xl:min-h-28'
)}
value="supabase functions new hello-world"
/>
</div>
<DocsButton
href={`${DOCS_URL}/guides/functions/local-quickstart#create-an-edge-function`}
/>
</div>
<div className="p-8">
<div className="flex items-center gap-2">
<Play size={20} />
<h4 className="text-base text-foreground">Run Edge Functions locally</h4>
</div>
<p className="text-sm text-foreground-light mt-1 mb-4 prose [&>code]:text-xs text-sm max-w-full">
You can run your Edge Function locally using <code>supabase functions serve</code>.
</p>
<div className="mb-4">
<CodeBlock
language="bash"
hideLineNumbers={true}
className={cn(
'px-3.5 max-w-full prose dark:prose-dark [&>code]:m-0 2xl:min-h-28'
)}
value={`
supabase start # start the supabase stack
supabase functions serve # start the Functions watcher`.trim()}
/>
</div>
<DocsButton
href={`${DOCS_URL}/guides/functions/local-quickstart#running-edge-functions-locally`}
/>
</div>
<div className="p-8">
<div className="flex items-center gap-2">
<Terminal strokeWidth={1.5} size={20} />
<h4 className="text-base text-foreground">Invoke Edge Functions locally</h4>
</div>
<p className="text-sm text-foreground-light mt-1 mb-4">
While serving your local Edge Functions, you can invoke it using cURL or one of the
client libraries.
</p>
<div className="mb-4">
<CodeBlock
language="bash"
hideLineNumbers={true}
className={cn(
'px-3.5 max-w-full prose dark:prose-dark [&>code]:m-0 2xl:min-h-28'
)}
value={`
curl --request POST 'http://localhost:54321/functions/v1/hello-world' \\
--header 'Authorization: Bearer SUPABASE_ANON_KEY' \\
--header 'Content-Type: application/json' \\
--data '{ "name":"Functions" }'`.trim()}
/>
</div>
<DocsButton
href={`${DOCS_URL}/guides/functions/local-quickstart#invoking-edge-functions-locally`}
/>
</div>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Self-hosting Edge Functions</CardTitle>
</CardHeader>
<CardContent className="p-0 grid grid-cols-[repeat(auto-fit,minmax(240px,1fr))] divide-y md:divide-y-0 md:divide-x divide-default items-stretch">
<div className="p-8">
<div className="flex items-center gap-2">
<Server size={20} />
<h4 className="text-base text-foreground">Self-hosting Edge Functions</h4>
</div>
<p className="text-sm text-foreground-light mt-1 mb-4 max-w-3xl">
Supabase Edge Runtime consists of a web server based on the Deno runtime, capable of
running Javascript, Typescript, and WASM services. You may self-host edge functions
on providers like Fly.io, Digital Ocean, or AWS.
</p>
<div className="flex items-center gap-x-2">
<DocsButton href={`${DOCS_URL}/reference/self-hosting-functions/introduction`} />
<Button asChild type="default" icon={<Github />}>
<a href="https://github.com/supabase/edge-runtime/">GitHub</a>
</Button>
</div>
</div>
</CardContent>
</Card>
<ScaffoldSectionTitle className="text-xl mt-12">Explore our templates</ScaffoldSectionTitle>
<ResourceList>
{templates.map((template) => (
<Dialog>
<DialogTrigger asChild>
<ResourceItem
key={template.name}
media={<Code strokeWidth={1.5} size={16} className="-translate-y-[9px]" />}
>
<div>
<p>{template.name}</p>
<p className="text-sm text-foreground-lighter">{template.description}</p>
</div>
</ResourceItem>
</DialogTrigger>
<DialogContent size="large">
<DialogHeader>
<DialogTitle>{template.name}</DialogTitle>
<DialogDescription>{template.description}</DialogDescription>
</DialogHeader>
<Separator />
<DialogSection className="!p-0">
<CodeBlock
language="ts"
hideLineNumbers={true}
className={cn(
'border-0 rounded-none px-3.5 max-w-full prose dark:prose-dark [&>code]:m-0 max-h-[420px]'
)}
value={template.content}
/>
</DialogSection>
</DialogContent>
</Dialog>
))}
</ResourceList>
</div>
</>
)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free