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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 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/).

Check failure on line 8 in apps/docs/content/guides/auth/auth-captcha.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'hCaptcha'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'hCaptcha'?", "location": {"path": "apps/docs/content/guides/auth/auth-captcha.mdx", "range": {"start": {"line": 8, "column": 212}}}, "severity": "ERROR"}

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

<Tabs
scrollable
Expand Down Expand Up @@ -39,13 +39,13 @@
</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
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
4 changes: 2 additions & 2 deletions apps/docs/content/guides/database/postgres/timeouts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@

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`).

Check warning on line 129 in apps/docs/content/guides/database/postgres/timeouts.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Custom.Parens] Use parentheses judiciously. Raw Output: {"message": "[Custom.Parens] Use parentheses judiciously.", "location": {"path": "apps/docs/content/guides/database/postgres/timeouts.mdx", "range": {"start": {"line": 129, "column": 1}}}, "severity": "INFO"}

```sql
select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ connection_string.../postgres?KEY1=VALUE&KEY2=VALUE&KEY3=VALUE

# Errors

{/* supa-mdx-lint-disable-next-line Rule001HeadingCase */}

## ... prepared statement already exists

Supavisor in transaction mode (port 6543) does not support [prepared statements](https://www.postgresql.org/docs/current/sql-prepare.html), which Prisma will try to create in the background.
Expand Down Expand Up @@ -162,7 +164,7 @@ An alternative strategy to reference these tables is to duplicate values into Pr

<details>
<summary>Show/Hide Details</summary>

```sql table_in_public
-- Create the 'profiles' table in the 'public' schema
create table public.profiles (
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/content/guides/database/query-optimization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ limit 10;

In this query, there are several parts that indexes could likely help in optimizing the performance:

### `where` Clause:
### `where` clause:

The `where` clause filters rows based on certain conditions, and indexing the columns involved can improve this process:

Expand All @@ -47,7 +47,7 @@ create index idx_customers_sign_up_date on customers (sign_up_date);
create index idx_orders_status on orders (status);
```

### `join` Columns
### `join` columns

Indexes on the columns used for joining tables can help Postgres avoid scanning tables in their entirety when connecting tables.

Expand All @@ -58,7 +58,7 @@ Indexes on the columns used for joining tables can help Postgres avoid scanning
create index idx_orders_customer_id on orders (customer_id);
```

### `order by` Clause
### `order by` clause

Sorting can also be optimized by indexing:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Deno.serve(async (req) => {
})
```

### 3. Create React Email Templates
### 3. Create React Email templates

Create a new folder `_templates` and create a new file `magic-link.tsx` with the following code:

Expand Down Expand Up @@ -296,7 +296,7 @@ supabase secrets set --env-file supabase/functions/.env

That's it, now your Supabase Edge Function will be triggered anytime an Auth Email needs to be send to the user!

## More Resources
## More resources

- [Send Email Hooks](/docs/guides/auth/auth-hooks/send-email-hook)
- [Auth Hooks](/docs/guides/auth/auth-hooks)
4 changes: 2 additions & 2 deletions apps/docs/content/guides/functions/examples/discord-bot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function hexToUint8Array(hex: string) {
}
```

## Deploy the Slash Command handler
## Deploy the slash command handler

```bash
supabase functions deploy discord-bot --no-verify-jwt
Expand All @@ -154,7 +154,7 @@ Navigate to your Function details in the Supabase Dashboard to get your Endpoint

The application is now ready. Let's proceed to the next section to install it.

## Install the Slash Command on your Discord server
## Install the slash command on your Discord server

So to use the `hello` Slash Command, we need to install our Greeter application on our Discord server. Here are the steps:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Push notifications are an important part of any mobile app. They allow you to se

Find the example code on [GitHub](https://github.com/supabase/supabase/blob/master/examples/user-management/expo-push-notifications/).

## Supabase Setup
## Supabase setup

- [Create a new Supabase project](https://database.new).
- Link your project: `supabase link --project-ref your-supabase-project-ref`
- Start supabase locally: `supabase start`
- Push up the schema: `supabase db push` (schema is defined in [supabase/migrations](https://github.com/supabase/supabase/blob/master/examples/user-management/expo-push-notifications/supabase/migrations/))

## Expo Setup
## Expo setup

To utilize Expo's push notification service, you must configure your app by installing a set of libraries, implementing functions to handle notifications, and setting up credentials for Android and iOS. Follow the official [Expo Push Notifications Setup Guide](https://docs.expo.dev/push-notifications/push-notifications-setup/) to get the credentials for Android and iOS. This project uses [Expo's EAS build](https://docs.expo.dev/build/introduction/) service to simplify this part.

Expand Down Expand Up @@ -126,7 +126,7 @@ Push notifications are an important part of any mobile app. They allow you to se

This guide will show you how to send push notifications to your app when a new row is inserted into a table using FCM, Supabase Edge Functions, and database web hooks.

## Supabase Setup
## Supabase setup

We will create two tables. One to store the user's FCM token and a `notifications` table. The edge function will be triggered when a new row is inserted into the `notifications` table and sends a push notification to the user.

Expand Down Expand Up @@ -258,7 +258,7 @@ Push notifications are an important part of any mobile app. They allow you to se
}
```

## FCM Setup
## FCM setup

1. Follow the official [FCM Setup Guide](https://firebase.google.com/docs/cloud-messaging) to set up FCM for your client side application.
1. Generate a new service account private key from the Firebase console `Project Settings > Service Accounts > Generate new private key`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Deno.serve(async (req) => {
})
```

## Create a Postgres Function and RPC
## Create a Database Function and RPC

With the embeddings now stored in your Postgres database table, you can query them from Supabase Edge Functions by utilizing [Remote Procedure Calls (RPC)](/docs/guides/database/functions?language=js).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ supabase functions deploy sentryfied --no-verify-jwt

Find the complete example on [GitHub](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/sentryfied/index.ts).

## Working With Scopes
## Working with scopes

Sentry Deno SDK currently do not support `Deno.serve` instrumentation, which means that there is no scope separation between requests.
Because of that, when the Edge Functions runtime is reused between multiple requests, all globally captured breadcrumbs and contextual data
Expand Down
10 changes: 5 additions & 5 deletions apps/docs/content/guides/functions/import-maps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

There are two ways to manage your dependencies in Supabase Edge Functions:

### Using deno.json (Recommended)
### Using deno.json (recommended)

Check failure on line 15 in apps/docs/content/guides/functions/import-maps.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'Deno' instead of 'deno'. Raw Output: {"message": "[Vale.Terms] Use 'Deno' instead of 'deno'.", "location": {"path": "apps/docs/content/guides/functions/import-maps.mdx", "range": {"start": {"line": 15, "column": 11}}}, "severity": "ERROR"}

Check warning on line 15 in apps/docs/content/guides/functions/import-maps.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Custom.Parens] Use parentheses judiciously. Raw Output: {"message": "[Custom.Parens] Use parentheses judiciously.", "location": {"path": "apps/docs/content/guides/functions/import-maps.mdx", "range": {"start": {"line": 15, "column": 21}}}, "severity": "INFO"}

<Admonition type="info">

Expand Down Expand Up @@ -50,7 +50,7 @@
└── config.toml
```

### Using Import Maps (Legacy)
### Using import maps (legacy)

Check warning on line 53 in apps/docs/content/guides/functions/import-maps.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Custom.Parens] Use parentheses judiciously. Raw Output: {"message": "[Custom.Parens] Use parentheses judiciously.", "location": {"path": "apps/docs/content/guides/functions/import-maps.mdx", "range": {"start": {"line": 53, "column": 23}}}, "severity": "INFO"}

Import Maps are a legacy way to manage dependencies, similar to a `package.json` file. While still supported, we recommend using `deno.json`. If both exist, `deno.json` takes precedence.

Expand Down Expand Up @@ -112,15 +112,15 @@
- Built-in [Node APIs](https://docs.deno.com/runtime/manual/node/compatibility)
- Third party modules published to [JSR](https://jsr.io/) or [deno.land/x](https://deno.land/x)

### NPM Modules
### NPM modules

Check failure on line 115 in apps/docs/content/guides/functions/import-maps.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'npm' instead of 'NPM'. Raw Output: {"message": "[Vale.Terms] Use 'npm' instead of 'NPM'.", "location": {"path": "apps/docs/content/guides/functions/import-maps.mdx", "range": {"start": {"line": 115, "column": 5}}}, "severity": "ERROR"}

Check warning on line 115 in apps/docs/content/guides/functions/import-maps.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Custom.Acronyms] The first instance of 'NPM' should be spelled out, followed by the acronym in brackets. For example: 'Data Definition Language (DDL)' Raw Output: {"message": "[Custom.Acronyms] The first instance of 'NPM' should be spelled out, followed by the acronym in brackets. For example: 'Data Definition Language (DDL)'", "location": {"path": "apps/docs/content/guides/functions/import-maps.mdx", "range": {"start": {"line": 115, "column": 5}}}, "severity": "INFO"}

You can import npm modules using the `npm:` specifier:

```ts
import { createClient } from 'npm:@supabase/supabase-js@2'
```

### Node.js Built-ins
### Node.js built-ins

For Node.js built-in APIs, use the `node:` specifier:

Expand All @@ -130,7 +130,7 @@

Learn more about npm specifiers and Node built-in APIs in [Deno's documentation](https://docs.deno.com/runtime/manual/node/npm_specifiers).

### Importing from Private Registries
### Importing from private registries

<Admonition type="info">

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/content/guides/functions/logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ Deno.serve(async (req) => {
})
```

## Logging Tips
## Logging tips

### Logging Request Headers
### Logging request headers

When debugging Edge Functions, a common mistake is to try to log headers to the developer console via code like this:

Expand All @@ -88,7 +88,7 @@ The reason behind this behavior is that [Headers](https://developer.mozilla.org/

However, `Headers` objects are iterable. You can utilize this feature to craft a couple of succinct one-liners for debugging and printing headers.

### Convert headers into an object with Object.fromEntries:
### Convert headers into an object with `Object.fromEntries`:

You can use `Object.fromEntries` which is a call to convert the headers into an object:

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/content/guides/functions/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To combine multiple endpoints into a single Edge Function, you can use web appli

Let's dive into some examples.

## Routing with Frameworks
## Routing with frameworks

Here's a simple hello world example using some popular web frameworks.

Expand Down Expand Up @@ -158,7 +158,7 @@ curl --request POST 'https://<project_ref>.supabase.co/functions/v1/hello-world'

We should see a response printing `Hello Foo!`.

## Using Route Parameters
## Using route parameters

We can use route parameters to capture values at specific URL segments (eg: `/tasks/:taskId/notes/:noteId`).

Expand Down Expand Up @@ -415,7 +415,7 @@ Deno.serve(async (req) => {
</TabPanel>
</Tabs>

## URL Patterns API
## URL patterns API

If you prefer not to use a web framework, you can directly use [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) within your Edge Functions to implement routing.
This is ideal for small apps with only couple of routes and you want to have a custom matching algorithm.
Expand Down
2 changes: 2 additions & 0 deletions apps/docs/content/guides/functions/status-codes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ description: 'Edge Functions can return following status codes.'
subtitle: 'Edge Functions can return following status codes.'
---

{/* supa-mdx-lint-disable Rule001HeadingCase */}

## 2XX Success

A successful Edge Function Response
Expand Down
Loading
Loading