Files
0ae4f32ad9 docs: kaizen fixes to QuickStarts (#47481)
https://github.com/user-attachments/assets/fba86c42-a122-4eb5-8531-db663d022100


Makes a few style and content changes focused on our quickstarts,
starting with
- docs/guides/getting-started/quickstarts/reactjs 
- docs/guides/getting-started/quickstarts/nextjs.

Changes
- Reduced container size and increased x padding for more breathing room
- Adjusted header padding and spacing
- Stripped non critical content from guides
- Merged steps where possible e.g. one sql blocks to run instead of
multiple
- Moved shadcn/supabase ui components into a next step
- Introduced a step for installing agent skills (in future can be
plugin)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Updated multiple quickstarts to add an **“Open Connect panel”**
primary action for environment-variable setup.
  * Removed extra UI CTA partials from several “Query” sections.
* Added **Next steps** links to drop-in UI components and extended the
database flow with an optional **agent skills** step.

* **UI / Guide Layout**
* Refreshed guide spacing/typography (breadcrumb spacing, header
margins, and removed subtitle divider).
* Adjusted guide/table-of-contents sizing and tightened step/details and
code section alignment.
  * Updated main layout width and padding for docs pages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-07 08:38:06 +00:00

99 lines
2.8 KiB
Plaintext

---
title: 'Use Supabase with TanStack Start'
subtitle: 'Learn how to create a Supabase project, add some sample data to your database, and query the data from a TanStack Start app.'
breadcrumb: 'Framework Quickstarts'
---
<$Partial path="quickstart_db_setup.mdx" />
## 4. Create a TanStack Start app
Create a TanStack Start app using the official CLI.
```bash
npm create @tanstack/start@latest my-app -- --package-manager npm --toolchain biome
```
## 5. Install the Supabase client library
The fastest way to get started is to use the `supabase-js` client library which provides a convenient interface for working with Supabase from a TanStack Start app.
Navigate to the TanStack Start app and install `supabase-js`.
```bash
cd my-app && npm install @supabase/supabase-js
```
<$Partial path="api_settings.mdx" variables={{ "framework": "", "tab": "" }} />
## 6. Declare Supabase environment variables
Create a `.env` file in the root of your project and populate with your Supabase connection variables that you can get from the helper above, or [from the project **Connect** panel](/dashboard/project/_?showConnect=true):
<Button variant="primary" asChild>
<a href="/dashboard/project/_?showConnect=true">Open Connect panel</a>
</Button>
```text name=.env
VITE_SUPABASE_URL=<SUBSTITUTE_SUPABASE_URL>
VITE_SUPABASE_PUBLISHABLE_KEY=<SUBSTITUTE_SUPABASE_PUBLISHABLE_KEY>
```
## 7. Create a Supabase client utility
Create a new file at `src/utils/supabase.ts` to initialize the Supabase client.
```ts name=src/utils/supabase.ts
import { createClient } from '@supabase/supabase-js'
export const supabase = createClient(
import.meta.env.VITE_SUPABASE_URL,
import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY
)
```
## 8. Query data from the app
Replace the contents of `src/routes/index.tsx` with the following code to add a loader function that fetches the instruments data and displays it on the page.
```tsx name=src/routes/index.tsx
import { createFileRoute } from '@tanstack/react-router'
import { supabase } from '../utils/supabase'
export const Route = createFileRoute('/')({
loader: async () => {
const { data: instruments } = await supabase.from('instruments').select()
return { instruments }
},
component: Home,
})
function Home() {
const { instruments } = Route.useLoaderData()
return (
<ul>
{instruments?.map((instrument) => (
<li key={instrument.name}>{instrument.name}</li>
))}
</ul>
)
}
```
## 9. Start the app
Run the development server, go to http://localhost:3000 in a browser and you should see the list of instruments.
```bash
npm run dev
```
## Next steps
- Explore [drop-in UI components](/ui) for your Supabase app
- Set up [Auth](/docs/guides/auth) for your app
- [Insert more data](/docs/guides/database/import-data) into your database
- Upload and serve static files using [Storage](/docs/guides/storage)