Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/project restructure #11

Merged
merged 7 commits into from
Oct 5, 2023
Merged

Conversation

zoedsoupe
Copy link
Collaborator

Problem

The first version of the project was a PoC of the architecture of Supabase.Client and the old Supabase.Connection modules.

The old structure of this library was to split Supabase integrations completely different and independent applications. That idea wasn’t discarded but somehow put in the “backlog”. Indeed, a “monolith” implementation of all-in-one library makes more sense for the current project status as somethings are not well defined, for example the Supabase.Phoenix.UI future module. So i took the decision to splliting applications as soon as they grow and maybe become an underwhelmed library as the same time that you want to use Supabase.Storage it will download and compile all Phoenix stuff. That doesn’t make sense for all. To sum: until the library could coexist in single package it will, but in the future it will be splitted.

Solution

  • merge again all umbrella apps
  • discard the idea of multiple Supabase.Connection and prefer only multiple Supabase.Client, that now owns a :conn field
  • Use a Registry by default to organize and make it simple to lookup for Supabase.Client PIDs
  • refactor Storage implementation to use Supabase.Client and handle errors in a better way
  • improve documentation

It’s imoprtant to note that the “base API” or the main API that this library exposes didn’t change for compatibility reasons and the “upgrade” from those apps spllited to this all-in-one will be easy peasy like lemon squeez.

The higher and most important chenge is the absence of Supabase.Connection for the current version as it is part of Supabase.Client struct/Agent. That means that the Supabase.init_connection/2 was discarded and Supabase.init_client/2 does not receive a list of connections anymore, as you can pass connection details directly to the Supabase.init_client/1:

Supabase.init_client(%{conn: %{base_url: “”, api_key: “"}})

There’s also a bang version of the Supabase.init_client!/1 that will try to fetch connection details from the :supabase application config, that can be set up on a config.exs or runtime.exs. If it fails on fetching an error will be raised and documentation will be printed on how to find these connection details.

@zoedsoupe zoedsoupe self-assigned this Oct 5, 2023
@zoedsoupe zoedsoupe merged commit 040c469 into main Oct 5, 2023
3 checks passed
@zoedsoupe zoedsoupe deleted the refactor/project-restructure branch October 5, 2023 20:29
zoedsoupe added a commit that referenced this pull request Oct 5, 2023
* feat: remove umbrella project

* refactor: use client to storage

* fix: credo

* refactor: documentation

* feat: add bang option to init_client/1

* fix: improve ci

* feat: supabase basic tests
zoedsoupe added a commit that referenced this pull request Oct 5, 2023
* feat: remove umbrella project

* refactor: use client to storage

* fix: credo

* refactor: documentation

* feat: add bang option to init_client/1

* fix: improve ci

* feat: supabase basic tests
zoedsoupe added a commit that referenced this pull request Oct 10, 2023
* feat: remove umbrella project

* refactor: use client to storage

* fix: credo

* refactor: documentation

* feat: add bang option to init_client/1

* fix: improve ci

* feat: supabase basic tests
zoedsoupe added a commit that referenced this pull request Oct 10, 2023
* main:
  Refactor/project restructure (#11)
zoedsoupe added a commit that referenced this pull request Oct 10, 2023
* Refactor/project restructure (#11)

* feat: remove umbrella project

* refactor: use client to storage

* fix: credo

* refactor: documentation

* feat: add bang option to init_client/1

* fix: improve ci

* feat: supabase basic tests

* feat: split supabase storage
zoedsoupe added a commit that referenced this pull request Oct 10, 2023
* Refactor/project restructure (#11)

* feat: remove umbrella project

* refactor: use client to storage

* fix: credo

* refactor: documentation

* feat: add bang option to init_client/1

* fix: improve ci

* feat: supabase basic tests

* feat: split supabase storage
zoedsoupe added a commit that referenced this pull request Oct 10, 2023
* Refactor/project restructure (#11)

* feat: remove umbrella project

* refactor: use client to storage

* fix: credo

* refactor: documentation

* feat: add bang option to init_client/1

* fix: improve ci

* feat: supabase basic tests

* feat: split supabase storage
zoedsoupe added a commit that referenced this pull request Oct 11, 2023
* Refactor/project restructure (#11)

* feat: remove umbrella project

* refactor: use client to storage

* fix: credo

* refactor: documentation

* feat: add bang option to init_client/1

* fix: improve ci

* feat: supabase basic tests

* feat: split supabase storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant