Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/docs-lint-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
sparse-checkout: |
supa-mdx-lint.config.toml
supa-mdx-lint
apps/docs/content
- name: cache cargo
id: cache-cargo
Expand All @@ -28,17 +30,21 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: 2d535367b06fe62354035464cf8334929bafca85
key: 6435a4cd1eeea7c2bbd343731de7e8a5127cb2d1
- name: install linter
if: steps.cache-cargo.outputs.cache-hit != 'true'
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 2d535367b06fe62354035464cf8334929bafca85
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 6435a4cd1eeea7c2bbd343731de7e8a5127cb2d1
- name: install reviewdog
uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.0
with:
reviewdog_version: v0.20.2
- name: run linter
env:
BASE_REF: ${{ github.base_ref }}
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
supa-mdx-lint apps/docs/content/guides/getting-started apps/docs/content/guides/ai apps/docs/content/guides/auth --format rdf | tee >(cat) | reviewdog -f=rdjsonl -reporter=github-pr-review
git diff --name-only origin/$BASE_REF HEAD \
| grep -E "^apps/docs/content/guides/(getting-started|ai|api|auth|database|deployment|functions)/" \
| xargs -r supa-mdx-lint --format rdf \
| reviewdog -f=rdjsonl -reporter=github-pr-review
12 changes: 6 additions & 6 deletions apps/docs/content/guides/auth/auth-captcha.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: 'auth-captcha'
title: 'Enable Captcha Protection'
description: 'Add Captcha Protection to your Supabase project'
title: 'Enable CAPTCHA Protection'
description: 'Add CAPTCHA Protection to your Supabase project'
tocVideo: 'em1cpOAXknM'
---

Supabase provides you with the option of adding captcha to your sign-in, sign-up, and password reset forms. This keeps your website safe from bots and malicious scripts. Supabase authentication has support for [hCaptcha](https://www.hcaptcha.com/) and [Cloudflare Turnstile](https://www.cloudflare.com/products/turnstile/).
Supabase provides you with the option of adding CAPTCHA to your sign-in, sign-up, and password reset forms. This keeps your website safe from bots and malicious scripts. Supabase authentication has support for [hCaptcha](https://www.hcaptcha.com/) and [Cloudflare Turnstile](https://www.cloudflare.com/products/turnstile/).

## Sign up for Captcha
## Sign up for CAPTCHA

<Tabs
scrollable
Expand Down Expand Up @@ -39,13 +39,13 @@ In the Settings page, look for the **Sitekey** section and copy the key.
</TabPanel>
</Tabs>

## Enable Captcha protection for your Supabase project
## Enable CAPTCHA protection for your Supabase project

Navigate to the **[Auth](https://supabase.com/dashboard/project/_/settings/auth)** section of your Project Settings in the Supabase Dashboard and find the **Enable Captcha protection** toggle under Settings > Authentication > Bot and Abuse Protection > Enable Captcha protection.

Select your CAPTCHA provider from the dropdown, enter your Captcha **Secret key**, and click **Save**.

## Add the Captcha frontend component
## Add the CAPTCHA frontend component

The frontend requires some changes to provide the captcha on-screen for the user. This example uses React and the corresponding Captcha React component, but both Captcha providers can be used with any JavaScript framework.

Expand Down
156 changes: 80 additions & 76 deletions apps/docs/content/guides/auth/server-side/sveltekit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -276,24 +276,24 @@ Set up a listener for Auth events on the client, to handle session refreshes and

```svelte src/routes/+layout.svelte
<script>
import { invalidate } from '$app/navigation';
import { onMount } from 'svelte';
import { invalidate } from '$app/navigation'
import { onMount } from 'svelte'

export let data;
$: ({ session, supabase } = data);
let { data, children } = $props()
let { session, supabase } = $derived(data)

onMount(() => {
const { data } = supabase.auth.onAuthStateChange((_, newSession) => {
if (newSession?.expires_at !== session?.expires_at) {
invalidate('supabase:auth');
}
});
onMount(() => {
const { data } = supabase.auth.onAuthStateChange((_, newSession) => {
if (newSession?.expires_at !== session?.expires_at) {
invalidate('supabase:auth')
}
})

return () => data.subscription.unsubscribe();
});
return () => data.subscription.unsubscribe()
})
</script>

<slot />
{@render children()}
```

</StepHikeCompact.Code>
Expand Down Expand Up @@ -327,15 +327,15 @@ export const load: PageServerLoad = async ({ locals: { supabase } }) => {

```svelte src/routes/+page.svelte
<script>
export let data;
$: ({ countries } = data);
let { data } = $props()
let { countries } = $derived(data)
</script>

<h1>Welcome to Supabase!</h1>
<ul>
{#each countries as country}
<li>{country.name}</li>
{/each}
{#each countries as country}
<li>{country.name}</li>
{/each}
</ul>
```

Expand Down Expand Up @@ -408,26 +408,31 @@ export const actions: Actions = {

```svelte src/routes/auth/+page.svelte
<form method="POST" action="?/login">
<label>
Email
<input name="email" type="email" />
</label>
<label>
Password
<input name="password" type="password" />
</label>
<button>Login</button>
<button formaction="?/signup">Sign up</button>
<label>
Email
<input name="email" type="email" />
</label>
<label>
Password
<input name="password" type="password" />
</label>
<button>Login</button>
<button formaction="?/signup">Sign up</button>
</form>
```

```svelte src/routes/auth/+layout.svelte
<script>
let { children } = $props()
</script>

<header>
<nav>
<a href="/">Home</a>
</nav>
<nav>
<a href="/">Home</a>
</nav>
</header>
<slot />

{@render children()}
```

```svelte src/routes/auth/error/+page.svelte
Expand Down Expand Up @@ -512,25 +517,25 @@ To ensure that `hooks.server.ts` runs for every nested path, put a `+layout.serv

```svelte src/routes/private/+layout.svelte
<script>
export let data;
$: ({ supabase } = data);

$: logout = async () => {
const { error } = await supabase.auth.signOut();
if (error) {
console.error(error);
}
};
let { data, children } = $props()
let { supabase } = $derived(data)

const logout = async () => {
const { error } = await supabase.auth.signOut()
if (error) {
console.error(error)
}
}
</script>

<header>
<nav>
<a href="/">Home</a>
</nav>
<button on:click={logout}>Logout</button>
<nav>
<a href="/">Home</a>
</nav>
<button onclick={logout}>Logout</button>
</header>
<main>
<slot />
{@render children()}
</main>
```

Expand Down Expand Up @@ -561,55 +566,54 @@ using ((select auth.uid()) = user_id);
```

```svelte src/routes/private/+page.server.ts
import type { PageServerLoad } from './$types';
import type { PageServerLoad } from './$types'

export const load: PageServerLoad = async ({ depends, locals: { supabase } }) => {
depends('supabase:db:notes');
const { data: notes } = await supabase.from('notes').select('id,note').order('id');
return { notes: notes ?? [] };
};
depends('supabase:db:notes')
const { data: notes } = await supabase.from('notes').select('id,note').order('id')
return { notes: notes ?? [] }
}
```

```svelte src/routes/private/+page.svelte
<script lang="ts">
import { invalidate } from '$app/navigation';
import type { EventHandler } from 'svelte/elements';
import { invalidate } from '$app/navigation'
import type { EventHandler } from 'svelte/elements'

import type { PageData } from './$types';
import type { PageData } from './$types'

export let data: PageData;
$: ({ notes, supabase, user } = data);
let { data } = $props()
let { notes, supabase, user } = $derived(data)

let handleSubmit: EventHandler<SubmitEvent, HTMLFormElement>;
$: handleSubmit = async (evt) => {
evt.preventDefault();
if (!evt.target) return;
const handleSubmit: EventHandler<SubmitEvent, HTMLFormElement> = async (evt) => {
evt.preventDefault()
if (!evt.target) return

const form = evt.target as HTMLFormElement;
const form = evt.target as HTMLFormElement

const note = (new FormData(form).get('note') ?? '') as string;
if (!note) return;
const note = (new FormData(form).get('note') ?? '') as string
if (!note) return

const { error } = await supabase.from('notes').insert({ note });
if (error) console.error(error);
const { error } = await supabase.from('notes').insert({ note })
if (error) console.error(error)

invalidate('supabase:db:notes');
form.reset();
};
invalidate('supabase:db:notes')
form.reset()
}
</script>

<h1>Private page for user: {user?.email}</h1>
<h2>Notes</h2>
<ul>
{#each notes as note}
<li>{note.note}</li>
{/each}
{#each notes as note}
<li>{note.note}</li>
{/each}
</ul>
<form on:submit={handleSubmit}>
<label>
Add a note
<input name="note" type="text" />
</label>
<form onsubmit={handleSubmit}>
<label>
Add a note
<input name="note" type="text" />
</label>
</form>
```

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/guides/database/extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ In addition to the pre-configured extensions, you can also install your own SQL

</Admonition>

### Upgrade Extensions
### Upgrade extensions

If a new version of an extension becomes available on Supabase, you need to initiate a software upgrade in the [Infrastructure Settings](https://supabase.com/dashboard/project/_/settings/infrastructure) to access it. Software upgrades can also be initiated by restarting your server in the [General Settings](https://supabase.com/dashboard/project/_/settings/general).

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/guides/database/extensions/rum.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ drop extension if exists rum;

### Syntax

#### For type: tsvector
#### For type: `tsvector`

To understand the following you may need first to see [Official PostgreSQL documentation on text
search](https://www.postgresql.org/docs/current/functions-textsearch.html)
Expand Down Expand Up @@ -116,7 +116,7 @@ SELECT id, d, d `<=>` '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER B
(5 rows)
```

#### For type: anyarray
#### For type: `anyarray`

`rum_anyarray_ops`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PostgreSQL's [Row Level Security (RLS)](https://www.postgresql.org/docs/current/
roles.
</Admonition>

## Policies at the Row Level
## Policies at the row level

Policies in Row Level Security (RLS) are used to restrict access to rows in a table. Think of them like adding a `WHERE` clause to every query.

Expand All @@ -35,7 +35,7 @@ update

However, this gives the post owner full access to update the row, including all of the columns.

## Privileges at the Column Level
## Privileges at the column level

To restrict access to columns, you can use [Privileges](https://www.postgresql.org/docs/current/ddl-priv.html).

Expand Down Expand Up @@ -80,7 +80,7 @@ You can view and edit the privileges in the [Supabase Studio](https://supabase.c

![Column level privileges](/docs/img/guides/privileges/column-level-privileges-2.png)

## Manage column privileges in Migrations
## Manage column privileges in migrations

While you can manage privileges directly from the Dashboard, as your project grows you may want to manage them in your migrations. Read about database migrations in the [Local Development](https://supabase.com/docs/guides/getting-started/local-development#database-migrations) guide.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/guides/database/postgres/roles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ When you created your project you were also asked to enter a password. This is a

Changing the password does not result in any downtime. All connected services, such as postgrest, pgbouncer, and other Supabase managed services, are automatically updated to use the latest password to ensure availability. However, if you have any external services connecting to the Supabase database using hardcoded username/password credentials, a manual update will be required.

## Granting Permissions
## Granting permissions

Roles can be granted various permissions on database objects using the `GRANT` command. Permissions include `SELECT`, `INSERT`, `UPDATE`, and `DELETE`. You can configure access to almost any object inside your database - including tables, views, functions, and triggers.

Expand Down
10 changes: 6 additions & 4 deletions apps/docs/content/guides/database/postgres/timeouts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ title: Timeouts
subtitle: Extend database timeouts to execute longer transactions
---

Requests made through the Supabase API and Dashboard have a timeout of 60 seconds. The database also has a global default timeout of 2 minutes.
<Admonition type="note">

To execute longer transactions, connect to your database using [Supavisor](/docs/guides/database/connecting-to-postgres#connection-pooler) or the [direct connection string](/docs/guides/database/connecting-to-postgres#direct-connections), and change the timeout settings.
Dashboard and [Client](/docs/guides/api/rest/client-libs) queries have a max-configurable timeout of 60 seconds. For longer transactions, use [Supavisor or direct connections](/docs/guides/database/connecting-to-postgres#quick-summary).

</Admonition>

## Change Postgres timeout

Expand Down Expand Up @@ -124,9 +126,9 @@ language sql;

The Supabase Dashboard contains tools to help you identify timed-out and long-running queries.

### Using the Log Explorer
### Using the Logs Explorer

Go to the [Log Explorer](/dashboard/project/_/logs/explorer), and run the following query to identify timed-out events (`statement timeout`) and queries that successfully run for longer than 10 seconds (`duration`).
Go to the [Logs Explorer](/dashboard/project/_/logs/explorer), and run the following query to identify timed-out events (`statement timeout`) and queries that successfully run for longer than 10 seconds (`duration`).

```sql
select
Expand Down
Loading
Loading