Current section
Files
Jump to
Current section
Files
supabase_potion
README.md
README.md
# Supabase Elixir
Supabase Community Elixir SDK
<!-- x-release-please-start-version -->
```elixir
def deps do
[
{:supabase_potion, "~> 0.8.0"}, # base SDK
{:supabase_storage, "~> 0.4"}, # storage integration
{:supabase_auth, "~> 0.6"}, # auth integration
{:supabase_postgrest, "~> 1.0"}, # postgrest integration
{:supabase_functions, "~> 0.1"}, # edge functions integration
{:supabase_realtime, "~> 0.1"}, # realtime integration
]
end
```
<!-- x-release-please-end -->
Individual product client documentation:
- [PostgREST](https://github.com/supabase-community/postgrest-ex)
- [Storage](https://github.com/supabase-community/storage-ex)
- [Auth](https://github.com/supabase-community/auth-ex)
- [Functions](https://github.com/supabase-community/functions-ex)
- [Realtime](https://github.com/supabase-community/realtime-ex)
### Clients
A `Supabase.Client` holds general information about Supabase that can be used to interact with any of the children integrations, for example: `Supabase.Storage` or `Supabase.UI`.
### Usage
To create a `Supabase.Client`:
```elixir
iex> Supabase.init_client("https://<supabase-url>", "<supabase-api-key>")
iex> {:ok, %Supabase.Client{}}
```
Any additional config can be passed as the third argument as an [Enumerable](https://hexdocs.pm/elixir/Enumerable.html):
```elixir
iex> Supabase.init_client("https://<supabase-url>", "<supabase-api-key>",
db: [schema: "another"],
auth: [flow_type: :pkce],
global: [headers: %{"custom-header" => "custom-value"}]
)
iex> {:ok, %Supabase.Client{}}
```
Initialized clients are Elixir structs without any managed state.
### HTTP Client Configuration
By default, `supabase_potion` starts a Finch pool named `Supabase.Finch`. You can customize this behavior with three application config keys:
#### `:http_client`
Replace the default Finch adapter with a custom HTTP client module:
```elixir
config :supabase_potion, http_client: MyApp.CustomHTTPClient
```
When set, no Finch pool is started automatically.
#### `:finch_name`
Use your own Finch instance instead of the default `Supabase.Finch`:
```elixir
config :supabase_potion, finch_name: MyApp.Finch
```
When set, no Finch pool is started automatically — you are responsible for starting the named Finch process.
#### `:finch_pool`
Customize the pool configuration for the default `Supabase.Finch` instance:
```elixir
config :supabase_potion, finch_pool: %{default: [size: 25, count: 4]}
```
Only takes effect when using the default Finch pool (i.e. neither `:http_client` nor `:finch_name` are set). Defaults to `%{default: [size: 10]}`.