Files
supabase/apps/docs/features/getting-started/GettingStarted.frameworks.ts
T
anthony lio 22ea45a3ba feat: getting started v2 (#52511)
## Problem

* the getting started page is a stack of content listings: an overview,
use cases, framework quickstarts and tutorials
* a new reader must find a path in that list, and the page gives no
commands or agent prompt for their setup

## Solution

* adds a stepper to the getting started page, so a reader gets the steps
and an agent prompt for their setup
* adds the `docs-getting-started-v2` posthog flag, so the stepper and
the current page can run as an a/b test
* adds events for stepper choices, link clicks and prompt copies, so the
test can compare the two pages
* adds a markdown export of the stepper, so the `.md` page lists every
path for agents
* moves the iso shapes from kb into `ui-patterns`, so the docs feature
cards use the same shapes as the kb heroes
* changes the edge functions shape to a flat puzzle piece, because the
old shape had too many parts

<!-- linear:table-colwidths:397,397 -->
<table>
<thead>
<tr>
<th>state</th>
<th>preview</th>
</tr>
</thead>
<tbody>
<tr>
<td>after</td>
<td>


https://github.com/user-attachments/assets/7127d817-4240-4d08-a1c9-6ada1b1b2563

</td>
</tr>
</tbody>
</table>

## Review instructions

1. open
[/docs/guides/getting-started?docs-getting-started-v2=stepper](<https://docs-git-docs-getting-started-explorations-supabase.vercel.app/docs/guides/getting-started?docs-getting-started-v2=stepper>)
and make sure that the stepper shows with agent selected
2. select next.js and the auth card, then make sure that the setup
prompt names next.js and has a step for auth
3. open
[/docs/guides/getting-started?docs-getting-started-v2=stepper&start=cli&fw=nextjs](<https://docs-git-docs-getting-started-explorations-supabase.vercel.app/docs/guides/getting-started?docs-getting-started-v2=stepper&start=cli&fw=nextjs>)
and make sure that connect your app shows the install command and the
quickstart button

## Checklist

Check all before review:

- [X] I have read
[CONTRIBUTING.md](<https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md>)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](<https://github.com/supabase/supabase/tree/master/apps/docs/style-guide>)
2026-11-13 17:46:38 +02:00

126 lines
3.3 KiB
TypeScript

import { frameworks } from '~/components/FrameworkQuickstarts.constants'
import { isFeatureEnabled } from 'common/enabled-features'
interface Framework {
slug: string
name: string
icon: string
href: string
hasLightIcon?: boolean
sdk: SdkId
install?: string
isCommunity?: boolean
}
interface FrameworkGroup {
id: string
label: string
frameworks: Framework[]
}
type SdkId = 'js' | 'dart' | 'swift' | 'kotlin' | 'python' | 'postgres'
// SDKs without an install command defer to the framework quickstart
const SDKS: Record<SdkId, { install?: string; isCommunity?: boolean }> = {
js: { install: 'npm install @supabase/supabase-js' },
dart: { install: 'flutter pub add supabase_flutter' },
swift: {},
kotlin: { isCommunity: true },
python: { install: 'pip install supabase' },
postgres: {},
}
// frameworks not listed here use the JavaScript SDK
const FRAMEWORK_SDKS: Record<string, SdkId> = {
'ios-swiftui': 'swift',
kotlin: 'kotlin',
flutter: 'dart',
flask: 'python',
reflex: 'python',
laravel: 'postgres',
redwoodjs: 'postgres',
'ruby-on-rails': 'postgres',
'spring-boot': 'postgres',
}
const INSTALL_OVERRIDES: Record<string, string> = {
'expo-react-native':
'npx expo install @supabase/supabase-js react-native-url-polyfill expo-sqlite',
tanstack: 'npm install @supabase/supabase-js @supabase/ssr',
reflex: 'uv add supabase',
}
// these quickstarts start from a template that already installs the client
const TEMPLATE_SLUGS = ['nextjs', 'hono', 'refine']
export const FRAMEWORKS: Framework[] = frameworks
.filter((framework) => framework.enabled !== false)
.map((framework) => {
const slug = framework.href.slice(framework.href.lastIndexOf('/') + 1)
const sdk = FRAMEWORK_SDKS[slug] ?? 'js'
return {
slug,
name: framework.name,
icon: framework.icon,
href: framework.href,
hasLightIcon: framework.hasLightIcon,
sdk,
install: TEMPLATE_SLUGS.includes(slug)
? undefined
: (INSTALL_OVERRIDES[slug] ?? SDKS[sdk].install),
isCommunity: SDKS[sdk].isCommunity,
}
})
const getFrameworksBySlug = (slugs: string[]): Framework[] =>
slugs.flatMap((slug) => FRAMEWORKS.filter((framework) => framework.slug === slug))
export const FRAMEWORK_GROUPS: FrameworkGroup[] = [
{
id: 'popular',
label: 'Popular',
frameworks: getFrameworksBySlug([
'nextjs',
'reactjs',
'vue',
'sveltekit',
'expo-react-native',
'flutter',
]),
},
{
id: 'fullstack',
label: 'Full stack',
frameworks: getFrameworksBySlug([
'nextjs',
'tanstack',
'astrojs',
'nuxtjs',
'sveltekit',
'redwoodjs',
'reflex',
'laravel',
'ruby-on-rails',
]),
},
{
id: 'frontend',
label: 'Frontend',
frameworks: getFrameworksBySlug(['reactjs', 'vue', 'solidjs', 'refine']),
},
{
id: 'mobile',
label: 'Mobile',
frameworks: getFrameworksBySlug(['expo-react-native', 'flutter', 'ios-swiftui', 'kotlin']),
},
{
id: 'backend',
label: 'Backend',
frameworks: getFrameworksBySlug(['hono', 'flask', 'spring-boot']),
},
].filter((group) => group.frameworks.length > 0 && isFeatureEnabled('docs:framework_quickstarts'))
export const getFramework = (slug: string | null): Framework | undefined =>
FRAMEWORKS.find((framework) => framework.slug === slug)