Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(docs): generate server.txt reference and wire into www llms (#47782)

Katerina Skroumpelou373e917a997c
diff --git a/apps/docs/internals/generate-reference-markdown.ts b/apps/docs/internals/generate-reference-markdown.ts
index 21e5cbfe593..8f18dabc286 100644
--- a/apps/docs/internals/generate-reference-markdown.ts
+++ b/apps/docs/internals/generate-reference-markdown.ts
@@ -33,8 +33,11 @@ type LegacyFn = {
examples?: Example[]
}
+type TypeComment = { shortText?: string; text?: string; examples?: Example[] }
+
type TypeSpec = {
- methods: Record<string, { comment?: { shortText?: string; examples?: Example[] } }>
+ methods: Record<string, { comment?: TypeComment }>
+ variables: Record<string, { comment?: TypeComment }>
}
type RefBase = {
@@ -106,6 +109,13 @@ const REFERENCES: Ref[] = [
contentDir: path.join(process.cwd(), 'content/reference/dart/v2'),
feature: 'sdk:dart',
},
+ {
+ kind: 'sdk-new',
+ title: 'Supabase Server SDK Reference',
+ outFile: 'server.md',
+ mdxDir: path.join(MDX_ROOT, 'server'),
+ contentDir: path.join(process.cwd(), 'content/reference/server/v1'),
+ },
{
kind: 'sdk-legacy',
title: 'Kotlin Client Library Reference',
@@ -281,6 +291,7 @@ async function renderSdkNew(ref: SdkNewRef): Promise<string> {
])
const fnsById = new Map(functions.map((fn) => [fn.id, fn]))
const methods = typeSpec.methods ?? {}
+ const variables = typeSpec.variables ?? {}
const parts: string[] = [`# ${ref.title}`]
for (const section of flatten(sections)) {
@@ -296,11 +307,18 @@ async function renderSdkNew(ref: SdkNewRef): Promise<string> {
if (section.type !== 'function' || !section.id) continue
const fn = fnsById.get(section.id)
if (!fn) continue
- const tsm = fn.$ref ? methods[fn.$ref] : undefined
+ // Mirror the site's getTypeSpec fallback: TypeDoc consts and type aliases
+ // (e.g. server's error/type exports) live under `variables`, not `methods`.
+ const tsm = fn.$ref ? (methods[fn.$ref] ?? variables[fn.$ref]) : undefined
+ // The site joins shortText + text for the full description; some entries
+ // (e.g. deprecated type aliases) carry content only in `text`.
+ const commentBody = [tsm?.comment?.shortText, tsm?.comment?.text]
+ .filter((s): s is string => !!s?.trim())
+ .join('\n\n')
parts.push(
renderFunctionSection({
title: fn.title || section.title || fn.id,
- description: fn.description ?? tsm?.comment?.shortText,
+ description: fn.description ?? (commentBody || undefined),
notes: fn.notes,
examples: fn.examples ?? tsm?.comment?.examples,
})
diff --git a/apps/www/app/llms-full.txt/route.ts b/apps/www/app/llms-full.txt/route.ts
index d09119bdc14..a243474bbe6 100644
--- a/apps/www/app/llms-full.txt/route.ts
+++ b/apps/www/app/llms-full.txt/route.ts
@@ -36,6 +36,7 @@ function getSources(): Source[] {
{ title: 'Supabase Reference (Kotlin)', slug: 'kotlin', enabled: sdkKotlin },
{ title: 'Supabase Reference (Python)', slug: 'python', enabled: sdkPython },
{ title: 'Supabase Reference (C#)', slug: 'csharp', enabled: sdkCsharp },
+ { title: 'Supabase Server SDK Reference', slug: 'server', enabled: true },
{ title: 'Supabase CLI Reference', slug: 'cli', enabled: true },
{ title: 'Supabase Management API Reference', slug: 'api', enabled: true },
]
diff --git a/apps/www/app/llms.txt/route.ts b/apps/www/app/llms.txt/route.ts
index 340c7eb7877..4c07a6d7fd8 100644
--- a/apps/www/app/llms.txt/route.ts
+++ b/apps/www/app/llms.txt/route.ts
@@ -67,6 +67,7 @@ async function getSources(): Promise<Source[]> {
{ title: 'Supabase Reference (Kotlin)', relPath: 'llms/kotlin.txt', enabled: sdkKotlin },
{ title: 'Supabase Reference (Python)', relPath: 'llms/python.txt', enabled: sdkPython },
{ title: 'Supabase Reference (C#)', relPath: 'llms/csharp.txt', enabled: sdkCsharp },
+ { title: 'Supabase Server SDK Reference', relPath: 'llms/server.txt', enabled: true },
{ title: 'Supabase CLI Reference', relPath: 'llms/cli.txt', enabled: true },
{ title: 'Supabase Management API Reference', relPath: 'llms/api.txt', enabled: true },
]