Supabase.Fable
1.1.1
dotnet add package Supabase.Fable --version 1.1.1
NuGet\Install-Package Supabase.Fable -Version 1.1.1
<PackageReference Include="Supabase.Fable" Version="1.1.1" />
<PackageVersion Include="Supabase.Fable" Version="1.1.1" />
<PackageReference Include="Supabase.Fable" />
paket add Supabase.Fable --version 1.1.1
#r "nuget: Supabase.Fable, 1.1.1"
#:package Supabase.Fable@1.1.1
#addin nuget:?package=Supabase.Fable&version=1.1.1
#tool nuget:?package=Supabase.Fable&version=1.1.1
Supabase.Fable
Supabase.Fable
F# bindings for Supabase JavaScript libraries via Fable.
Installation
For Fable projects
- Install the F# package:
dotnet add package Supabase.Fable
- Install the JavaScript dependency:
npm install @supabase/supabase-js
Usage
In F# (Fable) projects
open Supabase.Fable.Client
// Create a client
let client = createSimple "YOUR_SUPABASE_URL" "YOUR_SUPABASE_ANON_KEY"
// Use authentication
let! result = client.Auth.SignUp("user@example.com", "password")
// Query data
let! data = client.From<MyRecord>("my_table").Select("*").Execute()
In Oxpecker.Solid components
open Oxpecker.Solid
open Supabase.Fable.Client
let supabaseUrl = "YOUR_SUPABASE_URL"
let supabaseKey = "YOUR_SUPABASE_ANON_KEY"
[<SolidComponent>]
let MyComponent() =
let client = createSimple supabaseUrl supabaseKey
let data, setData = createSignal [||]
onMount(fun () ->
promise {
let! result = client.From<MyRecord>("my_table").Select("*").Execute()
match result with
| Ok records -> setData(records)
| Error err -> console.error(err)
} |> ignore
)
div() {
For(each = data()) {
yield fun item _ ->
div() { item.Name }
}
}
Dependencies
This library requires:
@supabase/supabase-js(JavaScript dependency)Fable.Core(F# dependency)Fable.Promise(F# dependency)
API
The library provides F# bindings for:
- Authentication (
client.Auth) - Database queries (
client.From<'T>()) - Storage (
client.Storage) - Realtime (
client.Realtime)
See the Supabase documentation for detailed API usage.
Features
- Type-safe F# bindings for the complete Supabase JavaScript API
- Promise-based async operations using F# async workflows
- Comprehensive coverage of Authentication, Database, Storage, and Realtime APIs
- Fable.Core integration for seamless JavaScript interop
- Complete examples and test suite
Installation
Add this library and the Fable package references to your project:
<PackageReference Include="Fable.Core" Version="4.5.0" /> <PackageReference Include="Fable.Promise" Version="3.2.0" /> <PackageReference Include="Supabase.Fable" Version="[1.0.0, 2.0.0)" />Install the required npm dependencies:
npm install @supabase/supabase-js
Quick Start
open Supabase.Fable.Client
// Create a Supabase client
let supabaseUrl = "https://your-project.supabase.co"
let supabaseKey = "your-anon-key-here"
let client = createSimple supabaseUrl supabaseKey
// Example: Authentication
let signUpUser() = promise {
let! result = client.Auth.SignUp("user@example.com", "password123")
match result.data with
| Some data -> printfn $"User created: {data.user.email}"
| None -> printfn "Sign up failed"
}
// Example: Database query
let getUsers() = promise {
let! response = client.From("users").Select("*").Execute()
match response.data with
| Some users -> printfn $"Found {users.Length} users"
| None -> printfn "Query failed"
}
API Coverage
Authentication (client.Auth)
SignUp(email, password)- Create new user accountSignInWithPassword(email, password)- Sign in with email/passwordSignInWithOAuth(provider)- Sign in with OAuth providerSignOut()- Sign out current userGetUser(jwt)- Get current userGetSession()- Get current sessionRefreshSession()- Refresh current sessionResetPasswordForEmail(email)- Send password reset email
Database (client.From(table))
Query Builder:
Select(columns)- Select specific columnsInsert(data)- Insert new recordsUpdate(data)- Update existing recordsDelete()- Delete recordsUpsert(data)- Insert or update records
Filters:
Eq(column, value)- Equals filterNeq(column, value)- Not equals filterGt(column, value)- Greater than filterGte(column, value)- Greater than or equal filterLt(column, value)- Less than filterLte(column, value)- Less than or equal filterLike(column, pattern)- Pattern matching filterIn(column, values)- Value in list filter
Modifiers:
Order(column, ascending)- Sort resultsLimit(count)- Limit number of resultsRange(from, to)- Range paginationSingle()- Get single recordExecute()- Execute query
Storage (client.Storage)
Bucket Management:
ListBuckets()- List all bucketsGetBucket(id)- Get bucket detailsCreateBucket(id, options)- Create new bucketDeleteBucket(id)- Delete bucketEmptyBucket(id)- Empty bucket contents
File Operations: (client.Storage.From(bucket))
Upload(path, file, options)- Upload fileDownload(path)- Download fileRemove(paths)- Delete filesList(path, options)- List filesGetPublicUrl(path)- Get public URLCreateSignedUrl(path, expiresIn)- Create signed URL
Realtime (client.Realtime)
Channel(topic)- Create realtime channelSubscribe(callback)- Subscribe to changesUnsubscribe()- Unsubscribe from changesGetChannels()- Get active channels
Examples
The examples/ directory contains comprehensive examples showing:
- Authentication flows - Sign up, sign in, session management
- Database operations - CRUD operations with type-safe queries
- Storage management - File upload, download, and bucket management
- Realtime subscriptions - Live updates and change notifications
Run the examples:
cd examples
dotnet build
# For browser: compile with Fable and open in browser
# For Node.js: run with Node.js after Fable compilation
Testing
The tests/ directory contains unit tests using Fable.Mocha:
cd tests
dotnet build
# Compile with Fable and run in test environment
Project Structure
src/
├── Types.fs # Supabase type definitions
├── Bindings.fs # JavaScript interop bindings
├── SupabaseClient.fs # Main client interface
├── Auth.fs # Authentication module
├── Database.fs # Database query builder
├── Storage.fs # Storage management
└── Realtime.fs # Realtime subscriptions
examples/
└── Examples.fs # Comprehensive usage examples
tests/
└── Tests.fs # Unit test suite
Type Safety
All Supabase operations are wrapped in F# types for compile-time safety:
// Responses are wrapped in Result-like types
type SupabaseResponse<'T> = {
data: 'T option
error: SupabaseError option
}
// User-defined types are preserved
type User = {
id: int option
name: string
email: string
created_at: string option
}
// Type-safe database operations
let getUser (id: int) = promise {
let! response = client.From("users").Select("*").Eq("id", id).Single()
return response.data // User option
}
Browser vs Node.js
This library works in both browser and Node.js environments:
- Browser: Use with Fable.React, Elmish, or any Fable web framework
- Node.js: Use for server-side F# applications with Supabase
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all projects build:
dotnet build - Submit a pull request
Dependencies
- Fable.Core 4.5.0+ - Core Fable compilation support
- @supabase/supabase-js 2.57.4+ - Supabase JavaScript client
- Fable.Promise 3.2.0+ - Promise-based async operations (optional)
- Fable.Mocha 2.17.0+ - Testing framework (dev dependency)
License
MIT License - see LICENSE file for details
Supabase Resources
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Fable.Core (>= 4.5.0)
- Fable.Promise (>= 3.2.0)
- FSharp.Core (>= 9.0.303)
-
.NETStandard 2.1
- Fable.Core (>= 4.5.0)
- Fable.Promise (>= 3.2.0)
- FSharp.Core (>= 9.0.303)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|