Skip to content

haskell-miso/supabase-miso

⚑ 🍜 supabase-miso

Made with Supabase

A Haskell miso client library for supabase. This is a Haskell front-end library, meant for use with the JS, or Web Assembly backend with GHC.

Warning

This is a work in-progress, many things are not implemented. Please consider contributing.

Usage

For local development with miso you can include supabase as a JavaScript module.

-----------------------------------------------------------------------------
{-# LANGUAGE LambdaCase        #-}
{-# LANGUAGE OverloadedStrings #-}
-----------------------------------------------------------------------------
module Main (main) where
-----------------------------------------------------------------------------
import Supabase.Miso.Auth
-----------------------------------------------------------------------------
main :: IO ()
main = run $ startApp myComponent
  { scripts =
     [ Module
        """
        import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm'
        const supabase = createClient('https://<app-id>.supabase.co', '<anon-key>');
        globalThis['supabase'] = supabase;
        console.log('Supabase Instance: ', supabase)
        """
     ]
  }
-----------------------------------------------------------------------------
data Action
  = SuccessfullyRegistered AuthResponse
  | ErrorRegistering MisoString
  | NewUserWithEmail SignUpEmail
  | NewUserWithPhone SignUpPhone
  deriving (Show, Eq)
-----------------------------------------------------------------------------
update :: Action -> Effect parent model Action
update = \case
  SuccessfullyRegistered response ->
    io_ $ do 
      consoleLog "success"
      consoleLog $ ms (show response)
  ErrorRegistering errorMessage ->
    io_ (consoleError errorMessage)
  NewUserWithEmail email ->
    signUpEmail email SuccessfullyRegistered ErrorRegistering
  NewUserWithPhone phone ->
    signUpPhone email SuccessfullyRegistered ErrorRegistering
-----------------------------------------------------------------------------

Build

$ cabal build

API Coverage

Auth

Realtime

Edge

Storage

Database

About

⚑ 🍜 Haskell miso bindings to supabase

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published