Commit Graph

24 Commits

Author SHA1 Message Date
Tom Moses 107458887e examples(with-supabase): fix import statement in tutorial (#83605)
Fixed import statements in tutorial code to point to files in the
correct folders.

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-09-09 11:59:00 +00:00
Karthikeya Thatipamula 76ebbb9768 docs: add missing RLS step to Next.js tutorial (#82714)
## What
This PR updates
`examples/with-supabase/components/tutorial/fetch-data-steps.tsx` to
include a missing step about enabling Row Level Security (RLS) and
creating a simple read policy for the `notes` table.

Fixes: #82218

## Why
Currently, the tutorial shows how to:
- create a `notes` table
- insert data
- query data from Next.js

However, since RLS is enabled by default in Supabase, new users will get
`permission denied` errors when querying data unless they configure
policies.
The official Supabase Next.js quickstart docs already mention this:  
https://supabase.com/docs/guides/getting-started/quickstarts/nextjs

Adding this step will help newcomers understand why RLS is required and
how to set it up.

## Changes
- Added a new `<TutorialStep>` in `fetch-data-steps.tsx`:
  - Explains that RLS is enabled by default
  - Shows SQL snippet to enable RLS + create a public read policy
  - Links to the Supabase RLS docs

## Checklist
- [x] Added RLS tutorial step
- [x] Verified formatting matches other tutorial steps
- [x] Added links to relevant Supabase docs

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-20 22:46:26 +00:00
Stojan Dimitrovski 8659d47c09 chore: Update with-supabase example to use getClaims() (#81383)
Updates the `with-supabase` example to use the new and much faster (when
project is configured with asymmetric JWT support)
`supabase.auth.getClaims()` function instead of `getUser()`.

---------

Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
2025-07-15 15:31:46 -07:00
Ivan Vasilov 2b7a259169 chore: Update the with-supabase example to use the Supabase Auth block (#78913)
This PR updates the `with-supabase` template to better auth pages,
Tailwind v4 and newest `components.json` for full compatibility with
shadcn/ui.

The `(auth-pages)` folder has been removed. For auth, the template is
now using the [password based auth
block](https://supabase.com/ui/docs/nextjs/password-based-auth) from the
Supabase UI Library which makes it easier to update it and keep it
up-to-date.

---------

Co-authored-by: Lee Robinson <lee@leerob.com>
2025-05-28 12:19:55 -05:00
Terry Sutton c919f09a1c examples: fix supabase example for v15 (#76567) 2025-02-26 15:50:00 -06:00
Ivan Vasilov 703d276ecb examples: Update with-supabase to be compatible with Nextjs 15 (#71631)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-10-22 13:10:04 -05:00
sekai 25c114e507 fix: button className in with_supabase example (#70121)
fix: https://github.com/vercel/next.js/issues/69525

## What 

I fixed an issue in the with-supabase example where duplicate className
in deploy-button.tsx was causing a Tailwind CSS error.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-09-16 19:08:35 +00:00
Terry Sutton 5493d873ab Remove stores params (#69796)
Remove stores param as new integration does not support initializing a
schema. This change basically reverts back to the url that was used
prior to the new integration last week, which still works just fine.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-09-12 21:06:50 +00:00
Lee Robinson b9b9d68e67 examples: Supabase follow up fixes (#69392) 2024-09-03 22:02:01 -05:00
Jonathan Summers-Muir d66ea6ad50 examples: further supabase improvements (#69407)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-08-28 09:51:31 -05:00
Jonathan Summers-Muir 7da39c77e0 examples: fix supabase build (#69394) 2024-08-27 23:37:24 -05:00
Jonathan Summers-Muir 00f70f2052 examples: improve Supabase example (#69308)
Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2024-08-27 22:09:10 -05:00
Jordi Enric 6afe80efc2 examples: Improve Supabase example login (#69066)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-08-21 10:35:11 -05:00
Jon Meyers 5b48db23b1 Add protected page and pending state to with-supabase example (#62211)
### What?

[1] Add protected page
[2] Add pending state

### Why?

[1] People using incorrect ways to protect pages
[2] No feedback that the login page is doing anything when buttons
clicked

### How?

[1] Redirect user to protected page after successful authentication
[2] Use useFormStatus to determine whether the form is in a pending
state

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-19 01:12:58 +00:00
Jon Meyers 1da90c2756 Clean up with-supabase example (#61799)
### What?

[1] Clean up `with-supabase` example following patterns from @leerob's
recent video on authentication
[2] Add images to matcher to reduce number of times a session is
refreshed
[3] Move instantiation of `cookieStore` into Supabase server helper

### Why?

[1] Make template easier to understand and use
[2] Reduce likelihood users will receive Auth Rate Limit Exceeded error
[3] Makes creating a Supabase client much simpler in Server Components,
Route Handlers and Server Actions

### How?

[1] Refactor middleware and its helper function
[2] Add image extensions to middleware matcher
[3] Call `cookies()` function from `createClient` helper - this should
still be in the [same execution
context](https://nextjs.org/docs/messages/dynamic-server-error) and
appears to work from my testing, but would be good to get the 👍 from
someone at Vercel
2024-02-08 19:07:57 +00:00
Steven 4466ba436b chore(examples): use default prettier for examples/templates (#60530)
## Description
This PR ensures that the default prettier config is used for examples
and templates.

This config is compatible with `prettier@3` as well (upgrading prettier
is bigger change that can be a future PR).

## Changes
- Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will
be needed upgrading to prettier@3)
- Added `examples/.prettierrc.json` with default config (this will
change every example)
- Added `packages/create-next-app/templates/.prettierrc.json` with
default config (this will change every template)

## Related

- Fixes #54402
- Closes #54409
2024-01-11 16:01:44 -07:00
Jon Meyers c3bf735263 Chore: refactor to use server actions in with-supabase example (#57858)
### What?
[1] Use Server Actions for auth
[2] Use Geist font
[3] Address warning about `metadataBase` in console

### Why?
[1] The co-location of Login page and authentication logic is simpler for beginners
[2] Looks nice
[3] Avoid confusing people with the starter template printing warnings

### How?
[1] Refactor Route Handlers to Server Actions
[2] Install font and set to `html`
[3] Explicitly declare the default value for `metadataBaseUrl`
2023-11-01 14:58:33 +00:00
Jon Meyers 75958bbc46 Chore: simplify with-supabase example (#57562)
### What?

[1] Simplify example
[2] Refactor `delete` method to use `cookies.set`

### Why?

[1] Make it easier to follow
[2] Fix build errors

### How?

[1] Adding comments and abstracting code into helper functions
[2] Setting cookie to empty value when removed

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2023-10-31 18:33:55 -05:00
Jon Meyers b9dd6c4ff6 Fix: Call cookies function from route to flag as dynamic (#57494)
### What?

Move calling the `cookies` function up to the route

### Why?

This flags the route as `dynamic`, meaning we don't need to explicitly declare `export const dynamic = 'force-dynamic'`

### How?

Passing the returned `cookieStore` into Supabase helper functions, rather than the `cookies` function itself
2023-10-26 16:18:17 +00:00
Jon Meyers 4bc549bf95 Fix: catch expected error in with-supabase example (#57378)
### What?

[1] Use camelCase for SVG properties
[2] Catch expected error in cookie functions

### Why?

[1] Prints error to the console
[2] If the cookies `set` or `delete` methods are called in a Server Component, an error is thrown

### How?

[1] Change property names from kebab-case to camelCase
[2] Catch error
2023-10-26 04:37:32 +00:00
Jon Meyers d0e92b19af chore: Refactor with-supabase example to use ssr package (#57100)
### What?

[1] Refactors `with-supabase` example to use new `@supabase/ssr` package
[2] Makes landing page dynamic steps to connect Next.js to Supabase
[3] Fixes a range of small bugs

### Why?

[1] Simplifies creating a Supabase client
[2] People were not understanding how to connect this template to Supabase
[3] People don't like bugs

### How?

[1] Declares a separate `createClient` function for client and server. Client version is used in Client Components, server version is used every where else - Server Components, Route Handlers, Server Actions, Middleware
[2] Makes landing page a dynamic list of next steps to guide the user to success
[3] Writing code to squash the bugs!
2023-10-23 23:34:10 +00:00
Jonathan Summers-Muir 06705a4815 Chore/update with supabase demo deploy button (#52483)
### What?

- added correct deploy button urls
  - uses new supabase integration
- updated readme for local development, more clearer instructions
- added opengraph image

### Why?

- old supabase integration is buggy
- readme is more clear for local development

---------

Co-authored-by: Steven Tey <stevensteel97@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-09-27 17:36:17 -07:00
Jon Meyers 269114b5cc examples: implement server side auth with supabase (#53372)
### What?

1. Refactor `with-supabase` example to use server-side auth

### Why?

1. It is the recommended path for Next.js, and can serve as an example for the authentication docs

### How?

1. Move authentication methods from Client Component to Route Handlers
2023-08-02 16:41:05 +00:00
Francesco Sansalvadore b636d3d755 [examples] Update styling for with-supabase example (#51751)
### Adding or Updating Examples

Improve styling for the `with-supabase` example.

<img width="2048" alt="Screenshot 2023-06-24 at 15 07 46"
src="https://github.com/vercel/next.js/assets/25671831/0bba9a0a-a660-411e-b960-ea933aa2750a">
<img width="2048" alt="Screenshot 2023-06-24 at 15 07 58"
src="https://github.com/vercel/next.js/assets/25671831/00f70c8b-e6ea-47ac-8a2e-829b4b808280">

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-28 21:11:13 -07:00