Revamped Auth Helpers for Supabase (with SvelteKit support)

2022-07-13

3 minute read

We've been hard at work making an Auth experience that is as smooth as possible for Supabase developers. One of the challenges has been creating a simple experience for server-side rendering (SSR) environments. We previously released our Auth Helpers libraries with support for React and Next.js, and today we’re announcing some exciting updates.

What are Auth Helpers?

Auth Helpers are a collection of framework-specific utilities for Supabase Auth. They allow you to implement secure applications with little effort. These libraries include functions for protecting API routes and pages in your applications.

SvelteKit support

Today, we’re adding support for SvelteKit. We’ve tried to keep the library’s interface similar to the other frameworks. This makes transitioning between frameworks seamless. You can follow our step by step guide on how to get this setup.

Name change

We’ve changed the name from @supabase/supabase-auth-helpers to @supabase/auth-helpers. With this change we:

  • Reset to a sub 0.x version number. This makes sense given that SvelteKit itself is still pre-1.0. And being pre-1.0 helps to manage expectations for future breaking changes.
  • Removed an extra “supabase”. We realized that the namespace already contained supabase in it and we didn’t want to double up (naming is hard!).

GitHub structure

We’ve moved the Auth Helpers into a monorepo so that we can publish packages individually rather than using the same package name for every framework. Each package only includes relevant dependencies - (eg, Next.js helpers don’t include SvelteKit dependencies).

We use Turborepo for managing our monorepo pipelines and have been incredibly pleased with its caching and performance. For packaging, we use changesets and GitHub Actions to create the release and publish to the npm registry. Each library lives in its own directory inside of the packages directory, with accompanying example applications making use of the library inside the examples directory.

Migration path

We minimized the breaking changes as much as possible, but there were a few that were necessary. With that in mind we have provided a guide for migrating away from the old @supabase/supabase-auth-helpers library over to the new @supabase/auth-helpers library.

Examples available

Having good documentation is great, especially when there are examples to augment. We’re always looking for community support in expanding our list of examples. If you have an interesting use case that you thing others may benefit from please consider contributing it.

Coming soon

Remix Auth Helpers are in the works. You can follow the development of this on our GitHub repo, or subscribe to our Supabase YouTube channel as we build it live on air.

Contribute

Contributors are welcome! You can help by creating pull requests, reporting bugs, writing documentation, replying to issues on our GitHub issue tracker, and helping others with questions they may have about using the library. If you’re already an active contributor to Supabase or any associated open source projects, consider applying to join the SupaSquad.

Big shoutout to Willow aka GHOST for her help with the Svelte/SvelteKit auth helper libraries.

Resources

Share this article

Build in a weekend, scale to millions