mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Closes FE-3966 ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## Problem - The admonition uses both 'tip' and 'note', but the visual distinction has long-ago collapsed. - 'Note' is used far more frequently than 'tip' - The two are very similar and it is confusing to know which one to use when they are visually identical ## Solution Collapse 'tip' and 'note' into one by removing all places where there is 'tip' and updating all references to 'tip' into 'note'. **Note:** This PR also resolves new broken links flagged by the E2E docs checker. It may move to another PR since E2Es keep erroring. ### Specific changes See below for an AI-generated list of changes: - **Type system** — removed `'tip'` from `AdmonitionType`, its `TYPE_TO_VARIANT`/`TYPE_LABEL` entries, and the test case in [`packages/ui-patterns/src/Admonition/](packages/ui-patterns/src/Admonition/) - **Remark plugin** — [remarkAdmonition.ts](apps/docs/lib/mdx/plugins/remarkAdmonition.ts) now maps mkdocs `tip` → `note` - **Lint allowlist** — `tip` dropped from `supa-mdx-lint.config.toml` - **Content migration** — all 109 files with `type="tip"` (across `apps/docs`, `apps/www`, `apps/studio`) converted to `type="note"`; zero remaining hits confirmed by repo-wide grep - **Style guide** — `CONTRIBUTING.md` and `contributing/content.mdx` updated to describe 4 admonition types instead of 5 ### Usage before implementation See the usage table that points toward 'note' as being dominant across all apps: Here's the usage table: | Location | `note` | `tip` | |---|---|---| | apps/docs | ~480 | ~143 | | apps/studio | 34 | 6 | | apps/www (blog) | 19 | 3 | | packages/ui-patterns (tests) | 3 | 1 (parametrized) | | design-system / ui-library / packages/ui / packages/common | 0–1 (test fixture only) | 0 | ## Preview links | App | Page | Search text (Ctrl+F) | Verify | |---|---|---|---| | docs | [/docs/guides/ai-tools/byo-mcp](https://docs-git-admonition-collapse-note-tip-supabase.vercel.app/docs/guides/ai-tools/byo-mcp) | official MCP TypeScript SDK | callout's aria-label="Note" | | docs | [/docs/guides/ai-tools/mcp](https://docs-git-admonition-collapse-note-tip-supabase.vercel.app/docs/guides/ai-tools/mcp) | MCP server is available at | callout's aria-label="Note" | | docs | [/docs/guides/ai/python-clients](https://docs-git-admonition-collapse-note-tip-supabase.vercel.app/docs/guides/ai/python-clients) | Click Connect at the top of any project page | callout's aria-label="Note" | | docs | [/docs/guides/auth/audit-logs](https://docs-git-admonition-collapse-note-tip-supabase.vercel.app/docs/guides/auth/audit-logs) | Disabling Postgres storage reduces your database storage costs | callout's aria-label="Note" | | docs | [/docs/guides/database/tables](https://docs-git-admonition-collapse-note-tip-supabase.vercel.app/docs/guides/database/tables) | access a custom schema through the Supabase Data API | callout's aria-label="Note" | | docs | [/docs/guides/troubleshooting/edge-function-404-error-response](https://docs-git-admonition-collapse-note-tip-supabase.vercel.app/docs/guides/troubleshooting/edge-function-404-error-response) | Always configure an appropriate time frame | callout's aria-label="Note" (was single-quoted type='tip') | | www | [blog: cli-v2-config-as-code](https://zone-www-dot-com-git-admonition-collapse-note-tip-supabase.vercel.app/blog/cli-v2-config-as-code) | Detecting config drift | callout's aria-label="Note" | | www | [blog: cli-v2-config-as-code](https://zone-www-dot-com-git-admonition-collapse-note-tip-supabase.vercel.app/blog/cli-v2-config-as-code) | Setting Edge Function secrets | callout's aria-label="Note" | | www | [blog: nosql-mongodb-compatibility-with-ferretdb-and-flydotio](https://zone-www-dot-com-git-admonition-collapse-note-tip-supabase.vercel.app/blog/nosql-mongodb-compatibility-with-ferretdb-and-flydotio) | If your network supports IPv6 connections | callout's aria-label="Note" | Note: the `www` rows use the `zone-www-dot-com` preview host, not the `docs` one you gave — since blog pages are served from the www app, not docs. ## Manual testing 1. Open preview links for affected pages. 2. Inspect. Open console. 3. Paste the following in and see there is no 'Tip' on the page: ``` document.querySelectorAll('[role="alert"]').forEach(el => console.log(el.getAttribute('aria-label'), el.textContent.slice(0,60))) ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Standardized informational callouts across docs and tutorials from **“Tip”** to **“Note”**, updating multiple examples and guidance blocks. * Updated a few related doc references/links and conditional “Next steps” content. * **UI Updates** * Switched various in-app banners and notices to the **“Note”** style variant. * **Bug Fixes / Improvements** * Removed support for the retired **“Tip”** callout type and aligned docs linting, component behavior, and aria labeling to the remaining admonition types. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
168 lines
5.8 KiB
Plaintext
168 lines
5.8 KiB
Plaintext
---
|
|
title: 'Use Supabase with Refine'
|
|
subtitle: 'Learn how to create a Supabase project, add some sample data to your database, and query the data from a Refine app.'
|
|
breadcrumb: 'Framework Quickstarts'
|
|
---
|
|
|
|
<AiPrompt id="refine" />
|
|
|
|
<$Partial path="quickstart_db_setup.mdx" />
|
|
|
|
## 3. Create a Refine app
|
|
|
|
Create a [Refine](https://github.com/refinedev/refine) app using the [create refine-app](https://refine.dev/docs/getting-started/quickstart/).
|
|
|
|
The `refine-supabase` preset adds `@refinedev/supabase` supplementary package that supports Supabase in a Refine app. `@refinedev/supabase` out-of-the-box includes the Supabase dependency: [supabase-js](https://github.com/supabase/supabase-js).
|
|
|
|
```bash
|
|
npm create refine-app@latest -- --preset refine-supabase my-app
|
|
```
|
|
|
|

|
|
|
|
## 4. Install Agent Skills (optional)
|
|
|
|
Supabase's [Agent Skills](/docs/guides/ai-tools/ai-skills) is a curated set of instructions that give your AI agent procedural knowledge about working with Supabase.
|
|
|
|
To install, run the following command in the root of your project:
|
|
|
|
```bash
|
|
npx skills add supabase/agent-skills
|
|
```
|
|
|
|
## 5. Update `supabaseClient` with environment variables
|
|
|
|
Update the `supabaseClient` with the `SUPABASE_URL` and `SUPABASE_KEY` of your Supabase API, which you can get from the helper below, or [from the project **Connect** panel](/dashboard/project/_?showConnect=true&framework=refine&tab=frameworks). The `supabaseClient` is used in auth provider and data provider methods that allow the Refine app to connect to your Supabase backend.
|
|
|
|
<Button variant="primary" asChild>
|
|
<a href="/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=refine">
|
|
Open Connect panel
|
|
</a>
|
|
</Button>
|
|
|
|
```ts name=src/utility/supabaseClient.ts
|
|
import { createClient } from '@refinedev/supabase'
|
|
|
|
const SUPABASE_URL = '<your-supabase-url>'
|
|
const SUPABASE_KEY = '<your-supabase-publishable-key>'
|
|
|
|
export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
|
|
db: {
|
|
schema: 'public',
|
|
},
|
|
auth: {
|
|
persistSession: true,
|
|
},
|
|
})
|
|
```
|
|
|
|
<$Partial path="api_settings.mdx" variables={{ "framework": "refine", "tab": "frameworks" }} />
|
|
|
|
## 6. Add instruments resource and pages
|
|
|
|
Use the following code to automatically add resources and generate code for the pages to show the `instruments` data using Refine Inferencer.
|
|
|
|
This defines pages for `list`, `create`, `show` and `edit` actions inside the `src/pages/instruments/` directory with a `<HeadlessInferencer />` component.
|
|
|
|
The `<HeadlessInferencer />` component depends on `@refinedev/react-table` and `@refinedev/react-hook-form` packages. To avoid errors, you should install them as dependencies with `npm install @refinedev/react-table @refinedev/react-hook-form`.
|
|
|
|
<Admonition type="note">
|
|
|
|
The `<HeadlessInferencer />` is a Refine Inferencer component that automatically generates necessary code for the `list`, `create`, `show` and `edit` pages.
|
|
|
|
Read more on [how the Inferencer works is in the Refine docs](https://refine.dev/docs/packages/documentation/inferencer/).
|
|
|
|
</Admonition>
|
|
|
|
```bash
|
|
npm run refine create-resource instruments
|
|
```
|
|
|
|
## 7. Add routes for instruments pages
|
|
|
|
Add routes for the `list`, `create`, `show`, and `edit` pages.
|
|
|
|
<Admonition type="note">
|
|
|
|
Remove the `index` route for the Welcome page presented with the `<Welcome />` component.
|
|
|
|
</Admonition>
|
|
|
|
```tsx name=src/App.tsx
|
|
import { Refine } from '@refinedev/core'
|
|
import { RefineKbar, RefineKbarProvider } from '@refinedev/kbar'
|
|
import routerProvider, {
|
|
DocumentTitleHandler,
|
|
NavigateToResource,
|
|
UnsavedChangesNotifier,
|
|
} from '@refinedev/react-router'
|
|
import { dataProvider, liveProvider } from '@refinedev/supabase'
|
|
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
|
|
|
import './App.css'
|
|
|
|
import authProvider from './authProvider'
|
|
import {
|
|
InstrumentsCreate,
|
|
InstrumentsEdit,
|
|
InstrumentsList,
|
|
InstrumentsShow,
|
|
} from './pages/instruments'
|
|
import { supabaseClient } from './utility'
|
|
|
|
function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<RefineKbarProvider>
|
|
<Refine
|
|
dataProvider={dataProvider(supabaseClient)}
|
|
liveProvider={liveProvider(supabaseClient)}
|
|
authProvider={authProvider}
|
|
routerProvider={routerProvider}
|
|
options={{
|
|
syncWithLocation: true,
|
|
warnWhenUnsavedChanges: true,
|
|
}}
|
|
resources={[
|
|
{
|
|
name: 'instruments',
|
|
list: '/instruments',
|
|
create: '/instruments/create',
|
|
edit: '/instruments/edit/:id',
|
|
show: '/instruments/show/:id',
|
|
},
|
|
]}
|
|
>
|
|
<Routes>
|
|
<Route index element={<NavigateToResource resource="instruments" />} />
|
|
<Route path="/instruments">
|
|
<Route index element={<InstrumentsList />} />
|
|
<Route path="create" element={<InstrumentsCreate />} />
|
|
<Route path="edit/:id" element={<InstrumentsEdit />} />
|
|
<Route path="show/:id" element={<InstrumentsShow />} />
|
|
</Route>
|
|
</Routes>
|
|
<RefineKbar />
|
|
<UnsavedChangesNotifier />
|
|
<DocumentTitleHandler />
|
|
</Refine>
|
|
</RefineKbarProvider>
|
|
</BrowserRouter>
|
|
)
|
|
}
|
|
|
|
export default App
|
|
```
|
|
|
|
## 8. View instruments pages
|
|
|
|
Start the app with the following command:
|
|
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
Open http://localhost:5173/instruments in a browser, and you should be able to see the instruments pages along the `/instruments` routes. You can edit and add new instruments using the Inferencer generated UI.
|
|
|
|
The Inferencer auto-generated code gives you a good starting point on which to keep building your `list`, `create`, `show` and `edit` pages. You can get these by clicking the `Show the auto-generated code` buttons in their respective pages.
|