solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

feat: Supabase Auth Example

Open kjrocker opened this issue 10 months ago • 2 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [ ] Addresses an existing open issue: fixes #000
  • [ ] Tests for the changes have been added (for bug fixes / features)

What is the current behavior?

There is no complete example for how to use Supabase in SolidStart.

What is the new behavior?

Create a "complete" example of Supabase Auth with the following features

  1. A mixture of server-side and browser-side behavior
  2. Sign in, make a new account, sign out, forget password, reset password.
  3. A way to protect authenticated pages.
  4. A way to conditionally render UI based on authentication

Other information

This is actually my first non-trivial work with SolidStart, so I'm sure there are some non-idiomatic things I can improve.

One of the biggest problems I encountered was the inability to create an isomorphic Supabase client. I had a lot of unpredictable behavior until I strictly separated the server and client code. I blame this one line in the docs:

Note that Vinxi HTTP helpers do not treeshake so you can only import them in files that do not contain client or isomorphic code. (https://docs.solidjs.com/solid-start/advanced/request-events#nativeevent)

Since I use Vinxi functions when instantiating a Server Supabase client, the normal isomorphic pattern of isServer ? doServerThing() : doClientThing() didn't work. Maybe dynamic imports are the answer. This is just my theory on why I had to strictly seperate "use client" actions from "use server" actions.

image image

kjrocker avatar Feb 26 '25 00:02 kjrocker

⚠️ No Changeset found

Latest commit: 6db23b837b282ff780a59153fb87309ca41d24e3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Feb 26 '25 00:02 changeset-bot[bot]

Deploy Preview for solid-start-landing-page ready!

Name Link
Latest commit 4feaf442ab2cad7c9d7ba39b24a09e36fa62e7ec
Latest deploy log https://app.netlify.com/sites/solid-start-landing-page/deploys/67c235e57edd2600081cf120
Deploy Preview https://deploy-preview-1830--solid-start-landing-page.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Feb 26 '25 00:02 netlify[bot]

Hello.

First of all, sorry it took us so long to look at this.

Part of this is the issue is that we've been looking at how to better server the community with our templates and ongoing repo work. Because of that we have decided to move templates to [solidjs/templates](https://github.com/solidjs/templates).

You're much welcome to recreate this template there, and read more on the new architecture in the discussion https://github.com/solidjs/solid-start/issues/1984

You're feedback is definitely much appreciated.

:blue_heart:

atilafassina avatar Sep 28 '25 13:09 atilafassina