Liveview with Supabase and GraphQL

I was wondering about migrating my liveview project to supabase from ecto/postgres. I know there are already some discussions about using supabase in this forum but they are mostly about praising supabase as a good fit for any solo dev project (which is my case), and none about approaches to use it in elixir.

Unfortunately there are no well maintained elixir libraries out there (only found supabase-elixir from 2 years ago) but then I saw that supabase also offers a graphql api on top of the database, so maybe I can just use any graphql client library. Searching for one I found Neuron, so I could use that to talk with supabase from liveview.

Is anyone here using a similar approach? Or what other approaches/stacks are you using with supabase?

I understand that moving the DB/backend to supabase means that liveview is being used only for the frontend but I don’t really want to use other languages or frameworks :sweat_smile: I’d prefer to keep using elixir.

I’m just curious about your thoughts and solutions about this!

Supabase is just postgresql under the hood, you can connect directly to it. If you provide the connection params to your Phoenix app, it will work the same as if it were a local db with no extra work. Ecto, etc, all just work, except operating on a remote db.

In your case, I’m not sure what the benefit of supabase would be as you’re using liveview for frontend. I have one app that is run this way, but it is a primarily backend application which has frontends written in different languages (React/TS, etc) connecting to it. Supabase simplifies the experience for varied frontends.

I was attracted by the extra features of supabase so I wanted to try it (db editor, auth with social logins, serverless functions etc). I don’t know why I defaulted to “I can’t use ecto with it” though! So thanks. I will definitely keep using ecto.

I also would love to expand my app in the future with multiple frontends so I think starting out with a baas system would be the best… although I’m looking at liveview native for the future.

1 Like

Yeah, the management features of supabase are great, db config and editor, etc. Also worth noting that Supabase uses Gotrue for social logins, which you can easily do the same in your phoenix app if that’s a determining factor. Anyway, if you plan to have non-phoenix frontends, I think going the supabase route is a good choice.