Closes DOCS-1609 ## Problem Quickstart pages have no template in the style guide. ## Solution - **Template:** add `templates/quickstart.md`. Its outline gives each numbered step a fixed heading ID, such as `[#query-data]`. - **Router:** add the quickstart row to Choose a template in `03-page-structure.md`. - **Old contract:** delete `quickstarts/_template.mdx`. ## Preview links The style guide isn't served on the docs site, so these link to the files on the branch. | File | Preview | | --- | --- | | Quickstart template | [`templates/quickstart.md`](https://github.com/supabase/supabase/blob/docs/quickstart-template/apps/docs/style-guide/templates/quickstart.md) | | Template router | [`03-page-structure.md`](https://github.com/supabase/supabase/blob/docs/quickstart-template/apps/docs/style-guide/03-page-structure.md#choose-a-template) | ## Review category (docs PRs only) <!-- If this PR changes docs and you're on the Supabase team, select one category. PRs from forks are always reviewed as Low, so you can skip this section. --> - [ ] Critical: needs a review as soon as possible - [ ] Urgent: the feature ships soon, or it's blocking something else - [ ] Moderate: good to have soon, not urgent - [ ] Low: get to it when you can ## Review instructions 1. Open the quickstart template preview and read it. 2. Compare its outline with [Use Supabase with React](https://supabase.com/docs/guides/getting-started/quickstarts/reactjs). The headings match, except for the IDs. ## Checklist Check all before review: - [ ] 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)
7.6 KiB
Quickstart template
Category: Task content.
Reader question: "How do I get set up with my framework?"
A quickstart takes a reader from nothing to an app in their framework that reads data from a Supabase project, in one sitting. Each framework gets one page in content/guides/getting-started/quickstarts/, and every page has the same steps, so a reader who has followed one can follow any. Leave out explanations and extra features, and link to a tutorial or an explainer instead. When a page needs more than reading data to make sense, such as sign-in or file uploads, write a tutorial.
Frontmatter
Set the following fields, and leave out description. The docs use the subtitle as the page's meta description:
title:Use Supabase with <Framework>, such asUse Supabase with Next.js. Keep it to 35 characters or fewer.subtitle: one sentence that says what the reader builds, starting withLearn how to.breadcrumb:Framework Quickstarts.
Headings, in order
The following outline lists the page's headings for a guide that uses quickstart_db_setup.mdx. Override each numbered heading's ID with the one shown, and number the headings from where the partial before them leaves off:
## Prerequisites <- optional
## 1. Create a Supabase project <- partial
## 2. Set up your database <- partial
## 3. Create a <Framework> app [#create-an-app]
## 4. Set up AI tooling (optional) [#set-up-ai-tooling]
## 5. Install the Supabase client library [#install-the-client-library] <- optional
## 6. Declare Supabase environment variables [#declare-environment-variables]
## 7. Create the Supabase client [#create-the-client] <- optional
## 8. Query data from the app [#query-data]
## 9. Start the app [#start-the-app]
## Production requirements <- partial
## Next steps
The following headings vary by framework:
- Prerequisites: add it only for tools the framework doesn't already imply, such as Java 17 for Spring Boot.
- Steps 1 and 2: take them from a partial. See Use the shared partials.
- Install the Supabase client library: name it for what the reader does, such as
Install dependencies, and keep its ID. Leave it out when the scaffold installs the packages. - Declare Supabase environment variables: leave it out of mobile apps, which put the placeholders in the client step.
- Create the Supabase client: leave it out when the scaffold already creates the client.
- A step the framework needs: add it between the others, with an ID that names what it does, such as
## 6. Configure Astro for SSR [#configure-astro-for-ssr].
Put at least one sentence under every heading.
Write the opening
Start the page with <AiPrompt id="<slug>" />, before any heading. Add the slug as a key in apps/docs/data/ai-prompts.data.ts. Then add ## Prerequisites if the page needs it, followed by the first partial.
Use the shared partials
Every quickstart shares the same text for the same steps. Use the following partials instead of copying their text:
| Partial | Step | Use it when |
|---|---|---|
quickstart_db_setup.mdx |
1 and 2 | The app reads the sample instruments table through a Supabase client library |
quickstart_create_project.mdx |
1 | The app connects to Postgres through its own ORM. Add one sentence saying it uses the framework's own tables |
quickstart_ai_tooling.mdx |
Set up AI tooling | Always |
api_settings.mdx |
Environment variables | The app uses a Supabase client library |
quickstart_connection_string.mdx |
Environment variables | The app connects to Postgres through one session pooler string |
quickstart_mobile_env_note.mdx |
Environment variables | A mobile app uses YOUR_SUPABASE_URL placeholders instead of a .env file |
quickstart_going_to_production.mdx |
Production requirements | Always. It supplies its own heading, so don't add one |
Write the steps
Every step does one thing the reader can check. Follow these rules for the steps that differ between frameworks:
- Environment variables: read credentials from environment variables, never literal values in code. Add the
Open Connect panelbutton before the code block. - Client: when the scaffold creates the client, say where the file lives in the step that first imports it.
- Query: handle the error before using the data, in the language's own way, such as
try/catchin Kotlin. ThegetInstrumentsfunction in the React quickstart is the model. - Writes: when the app inserts or updates data, add the grants and RLS policies in an earlier step.
quickstart_db_setup.mdxgrantsselecttoanononly. - Start the app: say where the app runs, such as its local URL or the Unity editor, and what the reader sees there.
Write next steps
List the following links in this order: the framework's Auth guide, or Auth when there isn't one, then importing data, then Storage, then the Supabase UI Library. Link the UI Library only for frameworks in supportedFrameworks in apps/ui-library/config/docs.ts.
Add the page to navigation
Add the page to apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts. To show it on the getting started pages too, add it to getting-started.data.ts, FrameworkQuickstarts.constants.ts, and GettingStarted.frameworks.ts. These three need a square icon in apps/docs/public/img/icons/ with an explicit fill color, so it shows in dark mode.
Example
The following example shows the first steps of Use Supabase with React, with the code removed. The steps after it follow the outline in the same way:
---
title: 'Use Supabase with React'
subtitle: 'Learn how to create a Supabase project, add some sample data to your database, and query the data from a React app.'
breadcrumb: 'Framework Quickstarts'
---
<AiPrompt id="reactjs" />
<$Partial path="quickstart_db_setup.mdx" />
## 3. Create a React app [#create-an-app]
Create a React app using a [Vite](https://vite.dev/guide/) template.
## 4. Set up AI tooling (optional) [#set-up-ai-tooling]
<$Partial path="quickstart_ai_tooling.mdx" />
Checklist
Before you open a pull request, check the following:
- The page starts with
<AiPrompt>, and its slug is inai-prompts.data.ts. - The headings follow the outline, numbered without gaps, and each numbered heading ends with the ID the outline gives it.
- Shared steps use their partial instead of copied text.
- Credentials come from environment variables, or from placeholders in a mobile client step, and every query handles its error.
- Next steps links the UI Library only for a supported framework.
- The page is in
NavigationMenu.constants.ts.