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
+52-58Lines changed: 52 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,13 @@ This monorepo houses the collection of Elixir SDK packages for integrating with
6
6
7
7
## Packages Overview
8
8
9
-
-**Supabase**: Main entrypoint for the Supabase SDK library, providing easy management for Supabase clients and connections.
10
-
-**Supabase Connection**: Handles individual connections to Supabase, encapsulating the API endpoint and credentials.
11
-
-**Supabase Storage**: Offers developers a way to store large objects like images, videos, and other files.
12
-
-**Supabase PostgREST**: Directly turns your PostgreSQL database into a RESTful API using PostgREST.
13
-
-**Supabase Realtime**: Provides a realtime websocket API, enabling listening to database changes.
14
-
-**Supabase Auth**: A comprehensive user authentication system, complete with email sign-in, password recovery, session management, and more.
15
-
-**Supabase UI**: UI components to help build Supabase-powered applications quickly.
16
-
-**Supabase Fetcher**: Customized HTTP client for making requests to Supabase APIs.
9
+
-**Supabase**: Main entrypoint for the Supabase SDK library, providing easy management for Supabase clients and connections. [Guide](#usage).
10
+
-**Supabase Storage**: Offers developers a way to store large objects like images, videos, and other files. [Guide](./guides/storage.md)
11
+
-**Supabase PostgREST**: Directly turns your PostgreSQL database into a RESTful API using PostgREST. [Guide](#)
12
+
-**Supabase Realtime**: Provides a realtime websocket API, enabling listening to database changes. [Guide](#)
13
+
-**Supabase Auth**: A comprehensive user authentication system, complete with email sign-in, password recovery, session management, and more. [Guide](#)
14
+
-**Supabase UI**: UI components to help build Supabase-powered applications quickly. [Guide](#)
15
+
-**Supabase Fetcher**: Customized HTTP client for making requests to Supabase APIs. [Guide](./guides/fetcher.md)
17
16
18
17
## Getting Started
19
18
@@ -29,81 +28,70 @@ def deps do
29
28
end
30
29
```
31
30
32
-
Or, install specific packages as needed:
33
-
34
-
```elixir
35
-
defdepsdo
36
-
[
37
-
{:supabase_storage, "~> 0.1"},
38
-
{:supabase_realtime, "~> 0.1"},
39
-
# ... add other packages
40
-
]
41
-
end
42
-
```
43
-
44
-
### Clients vs Connections
31
+
### Clients
45
32
46
33
A `Supabase.Client` is an Agent that holds general information about Supabase, that can be used to intereact with any of the children integrations, for example: `Supabase.Storage` or `Supabase.UI`.
47
34
48
-
Also a `Supabase.Client` holds a list of `Supabase.Connection` that can be used to perform operations on different buckets, for example.
49
-
50
35
`Supabase.Client` is defined as:
51
36
52
37
-`:name` - the name of the client, started by `start_link/1`
53
-
-`:connections` - a list of `%{conn_alias => conn_name}`, where `conn_alias` is the alias of the connection and `conn_name` is the name of the connection.
38
+
-`:conn` - connection information, the only required option as it is vital to the `Supabase.Client`.
39
+
-`:base_url` - The base url of the Supabase API, it is usually in the form `https://<app-name>.supabase.io`.
40
+
-`:api_key` - The API key used to authenticate requests to the Supabase API.
41
+
-`:access_token` - Token with specific permissions to access the Supabase API, it is usually the same as the API key.
54
42
-`:db` - default database options
55
-
-`:schema` - default schema to use, defaults to `"public"`
43
+
-`:schema` - default schema to use, defaults to `"public"`
56
44
-`:global` - global options config
57
-
-`:headers` - additional headers to use on each request
45
+
-`:headers` - additional headers to use on each request
58
46
-`:auth` - authentication options
59
-
-`:auto_refresh_token` - automatically refresh the token when it expires, defaults to `true`
60
-
-`:debug` - enable debug mode, defaults to `false`
61
-
-`:detect_session_in_url` - detect session in URL, defaults to `true`
62
-
-`:flow_type` - authentication flow type, defaults to `"web"`
63
-
-`:persist_session` - persist session, defaults to `true`
64
-
-`:storage` - storage type
65
-
-`:storage_key` - storage key
66
-
47
+
-`:auto_refresh_token` - automatically refresh the token when it expires, defaults to `true`
48
+
-`:debug` - enable debug mode, defaults to `false`
49
+
-`:detect_session_in_url` - detect session in URL, defaults to `true`
50
+
-`:flow_type` - authentication flow type, defaults to `"web"`
51
+
-`:persist_session` - persist session, defaults to `true`
52
+
-`:storage` - storage type
53
+
-`:storage_key` - storage key
67
54
68
-
On the other side, a `Supabase.Connection` is an Agent that holds the connection information and the current bucket, being defined as:
55
+
## Usage
69
56
70
-
-`:base_url` - The base url of the Supabase API, it is usually in the form `https://<app-name>.supabase.io`.
71
-
-`:api_key` - The API key used to authenticate requests to the Supabase API.
72
-
-`:access_token` - Token with specific permissions to access the Supabase API, it is usually the same as the API key.
73
-
-`:name` - Simple field to track the name of the connection, started by `start_link/1`.
74
-
-`:alias` - Field to easily manage multiple connections on a `Supabase.Client` Agent.
75
-
-`:bucket` - The current bucket to perform operations on.
57
+
The Supabase Elixir SDK provides a flexible way to manage `Supabase.Client` instances, which can, in turn, manage multiple `Supabase.Client` instances. Here's a brief overview of the key concepts:
76
58
77
-
In simple words, a `Supabase.Client` is a container for multiple `Supabase.Connection`, and each `Supabase.Connection` is a container for a single bucket.
59
+
### Starting a Client
78
60
79
-
### Establishing a Connection
80
-
81
-
To start a Supabase connection:
61
+
You can start a client using the `Supabase.Client.start_link/1` function. However, it's recommended to use `Supabase.init_client!/1`, which allows you to pass client options and automatically manage `Supabase.Client` processes.
This will automatically adds the Connection instance to a `DynamicSupervisor` that can be found in the [`Supabase.Connection`](./apps/supabase_connection/lib/supabase/connection_supervisor.ex) specific module documentation.
68
+
## Supabase Services
88
69
89
-
For manually Connection creation and management, please refer to the corresponding documentation:
70
+
The Supabase Elixir SDK allows you to interact with various Supabase services:
Supabase Storage is a service for storing large objects like images, videos, and other files. It provides a simple API with strong consistency, similar to AWS S3.
PostgREST is a web server that turns your PostgreSQL database into a RESTful API. It automatically generates API endpoints and operations based on your database's structure and permissions.
79
+
80
+
### Supabase Realtime
81
+
82
+
Supabase Realtime offers a realtime WebSocket API powered by PostgreSQL notifications. You can use it to listen to changes in your database and receive updates instantly as they happen.
100
83
101
-
This will automatically adds the Client instance to a `DynamicSupervisor` that can be found in the [`Supabase.ClientSupervisor`](./apps/supabase/lib/supabase/client_supervisor.ex) specific module documentation.
84
+
### Supabase Auth
102
85
103
-
For manually Client creation and management, please refer to the corresponding documentation:
86
+
Supabase Auth is a comprehensive user authentication system that includes features like email and password sign-in, email verification, password recovery, session management, and more, out of the box.
Supabase UI provides a set of UI components to help you build Supabase-powered applications quickly. It's built on top of Tailwind CSS and Headless UI, and it's fully customizable. The package even includes `Phoenix.LiveView` components!
91
+
92
+
### Supabase Fetcher
93
+
94
+
Supabase Fetcher is a customized HTTP client for Supabase, mainly used in Supabase Potion. It gives you complete control over how you make requests to any Supabase API.
107
95
108
96
## Configuration
109
97
@@ -112,7 +100,8 @@ Ensure your Supabase configurations are set:
@@ -127,6 +116,7 @@ If you want to track integration-specific roadmaps, check their own README.
127
116
128
117
-[x] Fetcher to interact with the Supabase API in a low-level way
129
118
-[x] Supabase Storage integration
119
+
-[ ] Supabase UI for Phoenix Live View
130
120
-[ ] Supabase Postgrest integration
131
121
-[ ] Supabase Auth integration
132
122
-[ ] Supabase Realtime API integration
@@ -154,3 +144,7 @@ This SDK is a comprehensive representation of Supabase's client integrations. Th
154
144
## License
155
145
156
146
[MIT](LICENSE)
147
+
148
+
---
149
+
150
+
With the Supabase Elixir SDK, you have the tools you need to supercharge your Elixir applications by seamlessly integrating them with Supabase's powerful cloud services. Happy coding! 😄
0 commit comments