Skip to content

Conversation

@kjrocker
Copy link

@kjrocker kjrocker commented Feb 26, 2025

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

V1 of the utilities, leaning SolidStart as I go

Register middleware

Actions, Pages, Components

WIP - Struggling with Sessions

Start over

Still in the untested stage

finishing up the initial code

Delete old version

Testing

Improving styles, accepting broken navigation

Pulling out signOut and getUser

Trying things with navigatiotn
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2025

⚠️ No Changeset found

Latest commit: 6db23b8

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

@netlify
Copy link

netlify bot commented Feb 26, 2025

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

Name Link
🔨 Latest commit 4feaf44
🔍 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.

@kjrocker kjrocker marked this pull request as ready for review February 26, 2025 20:42
@kjrocker kjrocker changed the title Supabase Auth Example feat: Supabase Auth Example Mar 1, 2025
@atilafassina
Copy link
Member

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 #1984

You're feedback is definitely much appreciated.

💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants