[HN Gopher] Supabase Local Dev: migrations, branching, and obser...
       ___________________________________________________________________
        
       Supabase Local Dev: migrations, branching, and observability
        
       Author : kiwicopple
       Score  : 143 points
       Date   : 2023-08-09 06:40 UTC (16 hours ago)
        
 (HTM) web link (supabase.com)
 (TXT) w3m dump (supabase.com)
        
       | rrgok wrote:
       | I hate to be this guy, really. I would like to adopt Supabase in
       | my company, but I cannot yet.
       | 
       | I commented on a HN post almost a year ago about how hard is to
       | do custom Auth with Supabase. I still haven't find a good
       | solution about it. For example, LDAP Auth is quite crucial in
       | most enterprise settings, yet I have no idea how to do it with
       | Supabase. I can find a workaround for PostgREST by putting a
       | secondary API written in some other language and fiddling with
       | reverse proxies. But how to do with Supabase, such that all other
       | services (realtime,...) works nicely? Is it so hard to provide a
       | function that accept a custom strategy given the HTTP request
       | data?
       | 
       | I created an issue[0] almost a year ago on Supabase, which was
       | transferred to Gotrue. I even provided some code examples from
       | Laravel. Even if it is not specifically for LDAP, make some API
       | available to do so, please.
       | 
       | [0] https://github.com/supabase/gotrue/issues/904
        
         | kiwicopple wrote:
         | > Even if it is not specifically for LDAP, make some API
         | available to do so, please.
         | 
         | Based on the issue (title and comment), it seems that you have
         | asked specifically for LDAP support rather than a generic API.
         | 
         | Feel free to share some more details in the github issue, so
         | the Auth team can figure out how best to support you. It looks
         | like they have followed up asking for the use-case and they are
         | just waiting for some clarifying details.
        
           | ilrwbwrkhv wrote:
           | One killer feature from Firebase is anonymous authentication
           | https://firebase.google.com/docs/auth/web/anonymous-auth
           | 
           | This allows for a frictionless onboarding process for
           | startups.
           | 
           | Are there plans for Supabase to support that?
        
             | kiwicopple wrote:
             | that's on the roadmap - definitely one of our most
             | requested Auth features. I don't have a timeline yet, but I
             | know it's somewhere at the top of the (kanban) list for the
             | Auth team
        
               | ilrwbwrkhv wrote:
               | Thanks
        
       | fosterfriends wrote:
       | Cool to see dev-ex improvements around local Postgres testing. At
       | Graphite we use pg-mem for fast unit tests, but it's not ideal.
       | It's extremely fast, but certain advanced queries aren't
       | supported. Curious about what others do for unit testing Postgres
       | operations?
       | 
       | https://github.com/oguimbal/pg-mem
        
       | kiwicopple wrote:
       | hey hn, supabase ceo here
       | 
       | a few months ago one of customers migrated away from supabase and
       | they wrote a blog post about it. That blog post appeared here[0]
       | on hacker news. many of the issues they encountered were related
       | to local development. we made several promises to improve based
       | on that feedback and the various comments in the HN thread
       | 
       | today's launch delivers on many of those promises. We've added
       | better support for database migrations, seeding, backups,
       | debugging, and documentation.
       | 
       | we have a lot of work ahead, this is just the first step. our
       | next major step forward is "branching", which we're rolling out
       | today for development partners and alpha testers.
       | 
       | we've coupled the branching functionality to GitHub for now.
       | whenever you create a new PR we launch a new instance, run the
       | database migrations in your version control, and seed the
       | database for reproducible test environments. we're using
       | Firecracker[1] for every preview environment. This environment
       | automatically pauses when it's not in use. we're seeing some very
       | impressive startup times, even though we're stuffing a lot of
       | services inside the VM. We looked at making full-production
       | clones but decided against that for now until we have a robust
       | strategy for anonymizing production data and mocking out calls to
       | external services. Ultimately we want to offer both options, it's
       | just easier and safer to start with seed data.
       | 
       | since supabase offers a few services beyond the Postgres
       | database, we still have a few questions to work through with our
       | alpha testers. for example, we also store images/videos/files for
       | our customers. Do these need to be anonymized in preview
       | environments? we don't have all the answers yet, but we're moving
       | in the right direction. As hard as it was to have a customer
       | migrate away so publicly, I'm proud of the work the team have
       | done to improve on feedback
       | 
       | [0] https://news.ycombinator.com/item?id=36006018
       | 
       | [1] Firecracker: https://firecracker-microvm.github.io/
        
         | soultrees wrote:
         | Respect. This is how you build a winning product and make your
         | users feel heard. Take note upcoming class.
        
         | thewataccount wrote:
         | I checked a little bit ago but I might have missed it so please
         | correct me.
         | 
         | Are there plans to expand self-hosting support? The migrations
         | are a big step forward.
         | 
         | Are you intending to fill the roll of being a framework akin to
         | a "super django" type of deal? Again the migrations help a ton,
         | but I've been hesitant to use Supabase for random projects
         | because I don't want to rely on the platform, and I don't want
         | random people on github who want to try or contribute to
         | require a supabase account.
         | 
         | I'd love to use it more as a modular ORM for miscellaneous
         | projects instead of the current "hosted platform", currently
         | none of the tutorials (or github projects) seem to explain this
         | route at all.
         | 
         | I think you actually do work for this purpose, and I think the
         | docs mostly cover the bare minimum for self hosting, and I
         | understand your business kinda relies on the hosted platform,
         | but I'd love to see further tutorials and thorough explinations
         | of all the features - currently some like the AI features
         | aren't really explained if they work in the self-hosted or not,
         | or if you have to do anything special for that.
         | 
         | EDIT: Also I do appreciate your business being opensource, and
         | contributing to postgres so much! Sorry for the rambling, and I
         | apologize if I'm blind and missed some obvious docs.
        
           | kiwicopple wrote:
           | > _Are you intending to fill the roll of being a framework
           | akin to a "super django" type of deal?_
           | 
           | We don't plan to replace any specific framework. We simply
           | want to make Postgres easier to use. You can use Django (or
           | any other framework) and Supabase together. We provide some
           | additional tooling on top, but we aim to make this tooling
           | 100% compatible with other tools. As an example, here[1] is a
           | change we made recently so that our Storage service works
           | better with Clerk (a popular Auth service, which is a good
           | alternative to our own Auth service). We plan to document
           | this better - it was one of the promises I made in the OP.
           | 
           | > _Are there plans to expand self-hosting support?_
           | 
           | we made a few updates[0] this week to improve self-hosting
           | based on the common feedback. if there is anything missing
           | just let me know and i will do another round of improvements.
           | 
           | > _currently some like the AI features aren 't really
           | explained if they work in the self-hosted or not, or if you
           | have to do anything special for that._
           | 
           | nothing is feature-gated so everything works on self-hosted.
           | That said, I agree that we can be better at explaining the
           | self-hosting. We are putting a lot more effort into improving
           | our docs in general. For self-hosting we can certainly be
           | clearer about the boundaries where you are responsible (eg,
           | you need to take care of your own backups, the AI features
           | will require external acconts). we're working on this, but
           | feel free to open issues where it's unclear we can address
           | anything specific
           | 
           | [0] https://github.com/supabase/supabase/pull/16097
           | 
           | [1] https://github.com/supabase/storage-api/pull/340
        
         | fosterfriends wrote:
         | Love the candor and follow-up on community feedback! Sounds
         | like y'all are working hard, keep it up :)
        
         | CSSer wrote:
         | Thank you so much for taking the initiative to learn and grow
         | from that experience. My team is in the fledging stages of
         | using Supabase to rebuild a mission-critical application for
         | our company. We were initially disappointed with what we found
         | in terms of CI/CD and local development but we liked Supabase
         | enough for other reasons to keep moving forward with it. I'm
         | really glad we did because I think this has the potential to be
         | a major boon for the productivity and efficiency of building
         | and maintaining our project over time. I get the impression
         | that you're making really good calls as it relates to your
         | roadmap, and I'm really looking forward to exploring these
         | workflows and sharing what I find with my team. Thanks again!
        
           | kiwicopple wrote:
           | > _I get the impression that you 're making really good calls
           | as it relates to your roadmap_
           | 
           | we receive feedback from a lot of channels so it's often hard
           | to figure out what to build. In the early days it was about
           | reaching feature-parity with other tools. now we have a bit
           | more breathing-room to focus on "day 2" problems. I think our
           | team is excited about this phase since it means we get an
           | opportunity to build something new/innovative
        
         | nathancahill wrote:
         | Massive congrats on shipping this. Will really improve the
         | DevEx. Are you hiring?
        
           | kiwicopple wrote:
           | I don't think we have any positions open currently
           | unfortunately, although we're always looking for talented
           | SREs & support to keep up with the platform growth. feel free
           | to reach out (my details are in my profile)
        
         | swyx wrote:
         | really impressive how you responded to that criticism -
         | listening to feedback and then building out a full product
         | suite. looking forward to try out everything here, particularly
         | branching, because just yesterday i was looking thru the docs
         | recommending staging/dev/prod instances and wondering if there
         | was a better way!
        
         | jadbox wrote:
         | After being burned by other DaaS providers (looking at you AWS
         | Amplify/Cognito), I've been skeptical to use anything other
         | than rolling my own solutions. Supabase updates does continue
         | to impress, and I do really appreciate these improvements to
         | local development.
        
           | kiwicopple wrote:
           | > _rolling my own solutions_
           | 
           | I would love to hear what solutions you're choosing.
           | 
           | one of our goals is to provide only the tools/tech/features
           | that you'd choose yourself or need to build to get started.
           | If you're skeptical based on our technology choices then it's
           | useful to receive that feedback
        
           | [deleted]
        
       | random_kris wrote:
       | I cannot decide what to do on my project. Use drizzle as orm and
       | supabase just as a nice wrapper around my PG db.
       | 
       | Or go fully into supabase ecosystems and also use their types and
       | their built in migrations and types
        
         | kiwicopple wrote:
         | they should be compatible, so I don't think you need to see it
         | as an either/or. If you choose to use both however, then you
         | should use drizzle to scaffold your database.
         | 
         | Our clients will work with the drizzle-generated tables (since
         | they use PostgREST).
        
       | yesimahuman wrote:
       | Huge congrats for shipping some of these features. I know many of
       | us have been wanting them for a while. In particular, migration
       | squashing will be super helpful. I'm a little iffy on the
       | branching stuff, since I like the solution of having two separate
       | Supabase projects to act as different environments (though that's
       | certainly not as powerful as actual branching, but it's simpler
       | to reason about). Really excited to try some of the things on
       | this list that seem new today (several of them have been out for
       | a while as far as I can tell?)
        
         | kiwicopple wrote:
         | > _I like the solution of having two separate Supabase projects
         | to act as different environments_
         | 
         | This won't be going away. Branching will just be another option
         | 
         | fwiw, I've also heard from a few enterprise companies that the
         | git-based branching model isn't as suitable for them, because
         | every other tool in their stack works in a prod/stage/dev type
         | model, and there is no simple way to make it work with (for
         | example) ~30 different environments
         | 
         | The branching model is really an "all-in" solution. It works
         | particularly well if you're using something like Vercel/Netlify
         | for your frontend. If you're using a serverside framework
         | (Django, Rails, Phoenix, etc) then it's not as simple. That
         | said, I think it's the way the world is moving, and with the
         | advent of cheap VMs then it makes it very plausible even for
         | these serverside frameworks
        
       | theultdev wrote:
       | Wow, these are very useful.
       | 
       | Is there an example project that demos the best way to setup
       | these features?
       | 
       | edit: I see TFA links to the docs where most things are covered
       | (https://supabase.com/docs/guides/cli)
        
         | kiwicopple wrote:
         | Here is an example project: https://github.com/supabase-
         | community/vercel-ai-chatbot
         | 
         | You'll see there is a "supabase" folder inside it so you can
         | clone it and run "supabase start" to get started immediately.
         | 
         | You can also hit the blue deploy button and you'll have a full
         | application deployed in ~1 minute (frontend on Vercel, backend
         | on Supabase)
        
           | theultdev wrote:
           | This doesn't include any of these newly announced features...
        
       | majestic5762 wrote:
       | Are you considering releasing an ORM or providing better support
       | for Prisma?
        
         | kiwicopple wrote:
         | We provide libraries for PostgREST, which auto-generates an API
         | from your Postgres tables. Is that sufficient or are you
         | looking for something else?
         | 
         | Prisma is already well-supported in supabase (since it's just
         | Postgres and prisma already works with Postgres)
         | 
         | edit: here is the prisma guide
         | -https://supabase.com/partners/integrations/prisma
        
         | cpursley wrote:
         | Supabase is basically the anti-ORM. Set everything up and just
         | start using it:
         | 
         | https://supabase.com/docs/reference/javascript/select
        
       | phillipcarter wrote:
       | For the Observability tools for Postgres category, are there
       | plans to bring some of this information into things like trace
       | data via OpenTelemetry? Would love to capture this info
       | continuously instead of needing to dig in with a CLI tool when
       | monitoring notes something is awry.
        
         | chasers wrote:
         | yes otel across all of Supabase in on our radar for sure. we
         | just added ingest support for otel payloads to Logflare (docs
         | coming soon) so when we have that you'll get them on the
         | platform and locally.
         | 
         | if you haven't seen the metrics endpoint we do have an endpoint
         | you can scrape for all your Supabase metrics, and we just
         | improved the example repo quite a bit on how to ship those
         | somewhere: https://github.com/supabase/grafana-agent-fly-
         | example/
        
       | klysm wrote:
       | One of the reasons I avoid services like this typically is the
       | local dev story so glad to see work going into it
        
       ___________________________________________________________________
       (page generated 2023-08-09 23:01 UTC)