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

Supabase? #93

Open
nelsonic opened this issue May 24, 2022 · 21 comments
Open

Supabase? #93

nelsonic opened this issue May 24, 2022 · 21 comments
Labels
discuss Share your constructive thoughts on how to make progress with this issue question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies

Comments

@nelsonic
Copy link
Member

Been watching the progress on Supabase for a while but not opened an issue! πŸ€¦β€β™‚οΈ
https://github.com/supabase/supabase

https://supabase.com/
image

@nelsonic nelsonic added question A question needs to be answered before progress can be made on this issue discuss Share your constructive thoughts on how to make progress with this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies labels May 24, 2022
@nelsonic
Copy link
Member Author

@nelsonic nelsonic mentioned this issue Aug 19, 2022
@nelsonic
Copy link
Member Author

nelsonic commented Aug 26, 2022

#073 Thinking Elixir Podcast: Elixir at Supabase with Paul Copplestone November 16, 2021
https://thinkingelixir.com/podcast-episodes/073-elixir-at-supabase-with-paul-copplestone/
via: https://elixirforum.com/t/anyone-used-phoenix-supabase/44095

@nelsonic
Copy link
Member Author

@nelsonic
Copy link
Member Author

@LuchoTurtle please speed run this: https://supabase.com/docs/guides/getting-started/tutorials/with-flutter
and drop a comment here with your experience. πŸ™

@nelsonic
Copy link
Member Author

@LuchoTurtle dwyl/supabase-flutter-demo#1 looks promising. 🀞
Please do your best to follow instructions though. πŸ™
No comment. No work done. I'm left scratching my head. πŸ€·β€β™‚οΈ

Note: not saying you didn't do the work. Just that I cannot see it ... 😞

@nelsonic
Copy link
Member Author

Currently doing a Deep Dive into the https://github.com/supabase/supabase code. πŸ‘€ πŸ‘¨β€πŸ’» ⏳

@nelsonic
Copy link
Member Author

https://supabase.com/pricing
image

Depending on the availability/reliability, $25/month is either cheap or expensive ... πŸ’­
If you look at the size of the DB you get to to host 8Gb is not very much ...
But it's enough for an MVP.
5GB file uploads / month and 100GB of File Storage is also not a lot ...

image

OK, this pricing has a healthy margin over their cloud/infra provider.
But I don't find it offensive like some other PaaS providers.

@nelsonic
Copy link
Member Author

When you first look at this repo: https://github.com/supabase/supabase

image

What is your intuition as to what the "entry point" for understanding the code is ...? πŸ€·β€β™‚οΈ
if you were to try and run Supabase on your localhost:
https://github.com/supabase/supabase/blob/master/DEVELOPERS.md#local-development

supabase-no-postgres

No mention of Postgres in the dev guide ... πŸ€·β€β™‚οΈ
But in their Architecture section, Postgres is the data store:

image

So where is the data being stored on localhost? πŸ”

And if you wanted to host it yourself to have control over the data,
https://supabase.com/docs/guides/self-hosting
image

There are quite a few moving parts ...

@nelsonic
Copy link
Member Author

The questions I want to answer before considering using Supabase for our App are:

  1. What is the average round trip response time for an HTTP Request
  2. How efficient is the websocket/realtime socket, does it send large amounts of data or just the diff?
  3. Does it have presence built-in so we can see "Who's online"?

Looks like it's just a Phoenix 1.6.12 server: https://github.com/supabase/realtime/blob/f89117850839af76ef0648d7e8bfde6450515745/mix.exs#L44
So presence is available. πŸ’­

Having watched all the official Supabase Auth videos:
https://supabase.com/docs/guides/auth/overview

My conclusion is that what they have built is good...
But definitely more complex than it needs to be.
And I've spotted several areas that we can substantially improve.

@nelsonic
Copy link
Member Author

My next question is: how does the Supabase Flutter SDK work when the person/device is offline?
Reading: supabase/supabase#357 I conclude that it's not implemented.
So ... we would need to wrap the SDK to check for connectivity, save the item, tags & timer data offline and then create our own conflict resolution & sync code. πŸ’­

One of the non-negotiables we must have in our Native Mobile App is Offline First.

@nelsonic
Copy link
Member Author

nelsonic commented Jan 29, 2023

How are table definitions and schema migrations version controlled in Supabase? πŸ€·β€β™‚οΈ
My reading of https://supabase.com/docs/guides/database/tables
Is that schemas are created in the Dashboard (Web UI): Watch: https://youtu.be/TKwF3IGij5c
image

πŸ€·β€β™‚οΈ

https://www.google.com/search?q=supabase+schema+migration
How to Manage Database Migration Using Supabase CLI - SupabaseTips: https://youtu.be/Kx5nHBmIxyQ
image

image

The top comment for this video is the following question:
image

So ... basically if you use the Supabase cloud service for building your App you cannot connect to the DB from your localhost and run the schema diff in order to store the schema in your project on GitHub.
So ... version control of schema and data is not a solved problem.

Supabase is looks great for a single dev working by themself but the "Team" workflow is not well-defined at all.

I still think this is immensely promising!
I just think that manually defining schema in a Web UI and not having a clear migration path from one instance to another e.g Dev -> CI -> Staging / Review Apps -> Production
Is a bit of a non-starter for people building an App as a Team.
The opportunity for conflicts and the resulting time-wasting is not even slightly appealing to me. πŸ˜•

@nelsonic
Copy link
Member Author

Reading: https://www.slip.so/tutorials/database-migrations-in-supabase-with-migra

image

https://databaseci.com/docs/migra
image

Indeed ... πŸ™„
Maybe I shouldn't be doing this at 04:55 on a Sunday during the traditional "maintenance window" ... πŸ’­

@nelsonic
Copy link
Member Author

Quick Google and we find: https://github.com/djrobstep/migra
image

Project URL matches the one above that is "Down for maintenance" so looks like we're in the right place. πŸ‘Œ

Docs point to: https://databaseci.com/docs/migra
image

Which as we established above is "Down for maintenance". ...

Their tutorial requires you to run a docker container to use migra ...

Last commit da6671a on Sep 18, 2022 ... ⏳

Apparently the docs site has been down for at least 2 weeks: djrobstep/migra#225

@nelsonic
Copy link
Member Author

Official discussion: supabase/supabase#134 marked as "Answer":
image

Yes, it's Postgres under-the-hood. But "go use one of the available tools" isn't a great answer ... πŸ€·β€β™‚οΈ
I need an end-to-end example of how to do this before I commit resources to pursing this route. πŸ’­

@nelsonic
Copy link
Member Author

nelsonic commented Feb 1, 2023

Had a conversation with @SimonLab on Standup this morning regarding Supabase.
I agree that it looks good, at least superficially. They're building an open source clone of Firebase

I did a deep dive into the code and watched all the (relevant) videos on their channel on YT: https://www.youtube.com/@Supabase/videos
I'm still optimistic about using it.
I just don't think we need it it for our MVP or even for our App.
Supabase is a good scaffolding for people who don't have Phoenix.
The key selling point is the "Realtime" sync of data: https://github.com/supabase/realtime
And that is just Phoenix!! Which is good "validation" of the Tech Stack we're already using.
the Supabase team dont' appear to care about running the tests for the realtime app on GitHub CI:
github.com/supabase/realtime/tree/main/.github/workflows
image

All of these CI workflows are related to deployment. None are testing that the features work as expected.
I tried to run the project on localhost "as is" and it simply doesn't run: 4kd/realtime#1

Seriously, try running it yourself:

git clone [email protected]:supabase/realtime.git && cd realtime
mix setup
** (Mix) Could not start application realtime: exited in: Realtime.Application.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (FunctionClauseError) no function clause matching in String.split/3
            (elixir 1.14.1) lib/string.ex:479: String.split(nil, "-", [parts: 2])
            (realtime 2.1.1) lib/realtime/helpers.ex:100: Realtime.Helpers.short_node_id/0
            (realtime 2.1.1) lib/realtime/monitoring/prom_ex.ex:145: Realtime.PromEx.set_metrics_tags/0
            (realtime 2.1.1) lib/realtime/application.ex:33: Realtime.Application.start/2
            (kernel 8.5.1) application_master.erl:293: :application_master.start_it_old/4

Obviously that doesn't work. Why would it be that easy/simple? πŸ’­
Reading the "Server Setup" section: https://github.com/supabase/realtime#server-setup
I'm no closer to being up-and-running with this in less than 5 minutes.
It's just a malaise of poor documentation.
We could fill-in the gaps in the docs but then we're just working for a Venture-funded Startup for Free. πŸ€·β€β™‚οΈ

Note: Realtime server is tightly coupled to Fly.io at the moment.

supabase-realtime-tightly-coupled-fly io

i.e. they are using the infra that we are already using.
But adding a layer of their own on top so there's more latency.
Why would we want that? 🐌
It's like taking a wagyu steak and mincing it up to make burgers! πŸ”
Why not just eat the steak!? πŸ₯©

The "Pros" are obvious; they're listed on the features/pricing pages. #93 (comment)
I've tried to highlight the "Cons" above in my comments. πŸ’¬

The reason I really wanted @LuchoTurtle to do a "Speed Run"
(and git push some code last Friday ⬆️ #93 (comment))
Was so that we could see how far a competent dev without any preconceived ideas and without any distractions
could get in a full day of setting up Flutter with Supabase.

Apparently, not very far ... dwyl/supabase-flutter-demo#1 (comment)
image

if someone without any distractions/meetings can only manage an initial commit in 6 hours πŸ§‘β€πŸ’»
the extrapolation is that we will never get anywhere with it ... ⏳
I know this can seem "harsh", but think about it from the perspective of someone paying by-the-hour ... πŸ’Έ

Imagine you ordered a pizza from a restaurant you know makes superb pies ... πŸ•
You're patient but expect delivery in a reasonable amount of time πŸ›΅
The time for the arrival of your delicious meal comes and goes ⌚ πŸ‘€
What now? πŸ’­

I've spent considerably more time deep-diving into Supabase than I wanted to right now.
I really wanted someone else on the team to do a deep analysis of the platform and present their findings.
I still think it's promising but isn't yet a flawless solution to our tech challenges.
A Firebase Clone with Open Source Tools is very much needed but it's still very much work-in-progress.
Respectfully, I feel they're going about it in totally the wrong way by cobbling it together.

image

They could have built the whole thing in Phoenix and it could run as a single Fly.io instance.
Supabase does not have all the features we need, not even close.

supabase-realtime-presence-beta

if instead of wasting my time on this research I had invested it re-building Auth dwyl/auth#207
I'm 100% sure I would be done with the re-build by now.
Auth v2 will be an Order of Magnitude simpler and easier to setup than Supabase.
Faster for both the Dev and the person using it.
Easy to run on localhost with clear instructions.
But also easy to not have to run on localhost and complete separation of concerns
between storing personal data and app-related data. The way it should be done.

I'm going to build it in the next week. (even though I have an up-coming family long-weekend away... ⏳ )
Meanwhile please take a look at and give feedback on: dwyl/mvp#140 (comment)

If @LuchoTurtle and @SimonLab can focus on the front-end for the next week I can re-build Auth.
Start by updating the code in MVP to match the Figma layout/wireframe.
I use the MVP multiple times a day and it frustrates me every time! dwyl/mvp#221 (comment)

@iteles
Copy link
Member

iteles commented Feb 1, 2023

Purely from this analysis it seems pretty obvious that Supabase isn't ready for us to use.
Thanks for carrying out the research @nelsonic. I feel like this didn't have to be done by you but maybe we can extrapolate a set of questions to be answered as a framework for this kind of research into whether a new technology should be used?

We also can't lose sight of the fact that this is an MVP - although we need to build a solid foundation, we also need to get it Done because every hour is coming out of our own pockets. If what we are already using is actually a better fit for our needs, that should be obvious after a 1 day spike and we can move on πŸ‘ŒπŸ»

@nelsonic
Copy link
Member Author

nelsonic commented Feb 1, 2023

@iteles the "framework" for proposing new tech has existed for years: #18
The whole point of the SPIKE to investigate the viability of Supabase last week was to determine what it could do for us. It can do what we already have with Phoenix. It can do Auth worse and with more setup steps than what we already have. It does have a few other features that are nice-to-have like auto-generating API endpoints from database tables, but as we've seen from our API work: dwyl/mvp#256 we don't actually want a basic endpoint, rather we want a complete query to return all related data similar to a Graph query, but without the unnecessary [sloooooow] response time. We are at the stage where we can hand-craft our API for speed. We want to give the people using our App the fastest experience possible. We will not achieve that with a generic one-size-fits-all solution. We need to be focussed on building something that fits our needs exactly, not trying to shoe-horn Supabase into our stack because it has a cool-sounding name.

I agree with @SimonLab that we could get up-and-running faster with Supabase in the short run ... πŸš€
But then we would very quickly hit a brick wall in terms of our engineering velocity and specifically DevOps.
The features we need are incomplete in Supabase and the ones we don't need are a distraction.

@rubensdemelo
Copy link

My next question is: how does the Supabase Flutter SDK work when the person/device is offline? Reading: supabase/supabase#357 I conclude that it's not implemented. So ... we would need to wrap the SDK to check for connectivity, save the item, tags & timer data offline and then create our own conflict resolution & sync code. πŸ’­

One of the non-negotiables we must have in our Native Mobile App is Offline First.

Does your "non-negotiables" offline first approach documented ? Would like to deep dive into this top. I also read about crdt algorithim

@nelsonic
Copy link
Member Author

@rubensdemelo excellent question. Thanks very much for asking it! πŸŽ‰
I've added it to my/our list to answer it: dwyl/product-roadmap#45 πŸ‘Œ
Meanwhile, how did you discover this thread?! πŸ” 😊

@rubensdemelo
Copy link

@nelsonic sorry for late reply.

I discovered this repo technology-stack from some a search about offline first mobile app.

I also explored some topics and read about elixir/phoenix.

Finally, I found some topics releated with flutter and then dive in.

@nelsonic
Copy link
Member Author

Top of HN this morning:
https://news.ycombinator.com/item?id=36004925

Migrating from Supabase
https://blog.val.town/blog/migrating-from-supabase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Share your constructive thoughts on how to make progress with this issue question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies
Projects
None yet
Development

No branches or pull requests

3 participants