You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+95-14Lines changed: 95 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,9 @@
2
2
3
3
Where the magic starts!
4
4
5
+
> [!WARNING]
6
+
> This project is still in high development, expect breaking changes.
7
+
5
8
## Getting Started
6
9
7
10
### Installation
@@ -11,7 +14,28 @@ To install the base SDK:
11
14
```elixir
12
15
defdepsdo
13
16
[
14
-
{:supabase_potion, "~> 0.4"}
17
+
{:supabase_potion, "~> 0.5"}
18
+
]
19
+
end
20
+
```
21
+
22
+
### General installation
23
+
24
+
This library per si is the base foundation to user Supabase services from Elixir, so to integrate with specific services you need to add each client library you want to use.
For more information on the available options, see the [Supabase.Client](https://hexdocs.pm/supabase_potion/Supabase.Client.html) module documentation.
89
+
90
+
> There's also a bang version of `Supabase.init_client/3` that will raise an error if the client can't be created.
91
+
92
+
#### Self managed clients
93
+
94
+
Self managed clients are clients that are created and managed by a separate process on your application. They are useful for long running applications that need to interact with the Supabase API.
95
+
96
+
If you don't have experience with processes or is a Elixir begginner, you should take a deep look into the Elixir official getting started section about processes, concurrency and distribution before to proceed.
-`supabase_base_url`: The base URL of your Supabase project! More information on how to find it can be seen on the [next section](#how-to-find-my-supabase-base-url?)
55
-
-`supabase_api_key`: The secret of your Supabase project! More information on how to find it can be seen on the [next section](#how-to-find-my-supabase-api-key?)
122
+
Then, you can start the client process in your application supervision tree:
56
123
57
-
Make sure to set the environment variables `SUPABASE_BASE_URL` and `SUPABASE_API_KEY`.
> Note that if you already set up supabase potion options on your application config, you can safely use `Supabase.init_client/0` or `Supabase.init_client!/0`
146
+
For more examples on how to use the client, check clients implementations docs:
Copy file name to clipboardExpand all lines: lib/supabase.ex
+21-78Lines changed: 21 additions & 78 deletions
Original file line number
Diff line number
Diff line change
@@ -2,71 +2,23 @@ defmodule Supabase do
2
2
@moduledoc"""
3
3
The main entrypoint for the Supabase SDK library.
4
4
5
-
## Installation
6
-
7
-
The package can be installed by adding `supabase_potion` to your list of dependencies in `mix.exs`:
8
-
9
-
def deps do
10
-
[
11
-
{:supabase_potion, "~> 0.3"}
12
-
]
13
-
end
14
-
15
-
## Usage
16
-
17
-
After installing `:supabase_potion`, you can easily and dynamically manage different `Supabase.Client`!
18
-
19
-
### Config
20
-
21
-
The library offers a bunch of config options that can be used to control management of clients and other options.
22
-
23
-
- `manage_clients` - whether to manage clients automatically, defaults to `true`
24
-
25
-
You can set up the library on your `config.exs`:
26
-
27
-
config :supabase, manage_clients: false
28
-
29
-
### Clients
30
-
31
-
A `Supabase.Client` holds general information about Supabase, that can be used to intereact with any of the children integrations, for example: `Supabase.Storage` or `Supabase.UI`.
32
-
33
-
`Supabase.Client` is defined as:
34
-
35
-
- `:conn` - connection information, the only required option as it is vital to the `Supabase.Client`.
36
-
- `:base_url` - The base url of the Supabase API, it is usually in the form `https://<app-name>.supabase.co`.
37
-
- `:api_key` - The API key used to authenticate requests to the Supabase API.
38
-
- `:access_token` - Token with specific permissions to access the Supabase API, it is usually the same as the API key.
39
-
- `:db` - default database options
40
-
- `:schema` - default schema to use, defaults to `"public"`
41
-
- `:global` - global options config
42
-
- `:headers` - additional headers to use on each request
43
-
- `:auth` - authentication options
44
-
- `:auto_refresh_token` - automatically refresh the token when it expires, defaults to `true`
45
-
- `:debug` - enable debug mode, defaults to `false`
46
-
- `:detect_session_in_url` - detect session in URL, defaults to `true`
47
-
- `:flow_type` - authentication flow type, defaults to `"web"`
48
-
- `:persist_session` - persist session, defaults to `true`
49
-
- `:storage` - storage type
50
-
- `:storage_key` - storage key
51
-
52
-
53
5
## Starting a Client
54
6
55
-
You then can start a Client calling `Supabase.init_client/1`:
7
+
You then can start a Client calling `Supabase.init_client/3`:
Supabase Realtime provides a realtime websocket API powered by PostgreSQL notifications. It allows you to listen to changes in your database, and instantly receive updates as soon as they happen.
82
34
83
-
### Supabase Auth
35
+
### Supabase Auth/GoTrue
84
36
85
37
Supabase Auth is a feature-complete user authentication system. It provides email & password sign in, email verification, password recovery, session management, and more, out of the box.
0 commit comments