Build a simple web app with Sapper using Supabase for authentication

Getting started with Supabase and Sapper

# create a default sapper app
npx degit "sveltejs/sapper-template#rollup" my-app
# navigate to your app folder
cd my-app
# install dependencies
npm install
npm i @supabase/supabase-js
npm i --D @rollup/plugin-json
import json from '@rollup/plugin-json';
json({compact: true})

Adding Supabase to Sapper

Create config/settings.js and config/supabase.js
import { createClient } from ‘@supabase/supabase-js’;import { supabaseConfig } from ‘./settings’;export const supabase = createClient(supabaseConfig.url, supabaseConfig.key, supabaseConfig.options);
export const supabaseConfig = {url: ‘https://your-project-unique-url.supabase.co',key: `anon-public-key`options: []};
Grab the API key and URL and put them into the settings.js
<script>
import supabase import { supabase } from ‘../config/supabase’;
</script>

Building register and login views

Building additional logic

Aaand that’s it! 👏👏

--

--

--

I build complex things on the web and share my findings to help others learn too.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Day 14: jQuery

All You Need To Know About CSS-in-JS

https://xtsupport.zendesk.com/hc/en-us/articles/4417091457945-XT-Will-List-ERON-ERON

“safe-cast” for TypeScript

Strings and Template Literals in JavaScript

PSA: Immutable Data can Help You Avoid Pesky Bugs

WordPress 5.5 Breaking Sites, Here’s How to Fix It

The Problem of the day — Reduction operations to equalise array

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mika S.

Mika S.

I build complex things on the web and share my findings to help others learn too.

More from Medium

How to convert an i18n Google Sheets to iOS Localizable.strings and Android strings.xml?

GitActions For Flutter Desktop Applications

Host your website on Firebase

Long-running Cloud Run functions