From Supabase to Clerk to Better Auth
97 points
2 hours ago
| 16 comments
| blog.val.town
| HN
BoppreH
9 minutes ago
[-]
> A hard lesson you learn building a complex system is that its reliability is the minimum of the combined reliability of its critical parts.

It's worse than that, the combined availability is the product of all components in the critical path. If your software, the authentication layer, and the cloud provider each have 99% availability, and any one of them can bring your service down, then your final availability is just 97%.

It gets worse the more layers you have, and you probably have a lot more layers than that. If you have eleven components in your critical path, each with "three nines" of availability, your final service will have a single nine. That's why reducing components and going for reliable solutions is so important.

reply
tornikeo
21 minutes ago
[-]
Can someone more intelligent then me tell me why should I offload my postgres users table to some 3rd party provider? Like what is so hard about keeping that table in my VM on hetzner that I have to give it off to someone else? It's not payments, it's just a few fields of data
reply
therealpygon
6 minutes ago
[-]
Why pay someone to build a house? I’m sure you could do it yourself…but that doesn’t mean that is the best use of your time in all cases. The analogy is basic but apt; not everyone needs or wants to run (or create) every mechanism. I don’t do all of my own hosting either and it’s not because I couldn’t, it’s that it isn’t worthwhile in my cases.
reply
eddythompson80
13 minutes ago
[-]
Don't you wanna level up your career to become an architect? You can draw a box, call it "User Management" and slap "Clerk" or some other SaaS on it, and assume it's managed for you. This allows you to shove whatever requirements you want in that magic blackbox as you feel "it doesn't bring value" for you to implement.
reply
normie3000
12 minutes ago
[-]
AuthN is hard and generic, authZ is easy and specific. Offload authN, and keep your users table in your Hetzner.
reply
mvkel
14 minutes ago
[-]
Start any greenfield project, hand-coded auth takes up 50% of the development time of the entire MVP
reply
awestroke
5 minutes ago
[-]
It takes like an hour. So that's a quick mvp then
reply
transitorykris
2 minutes ago
[-]
Social logins, email logins, password resets, multi-tenant, organizations, many to many users to organizations, etc etc. Not necessary for MVP, but can definitely be painful hacking in later if the MVP hits.
reply
oompydoompy74
14 minutes ago
[-]
BetterAuth is users in your own database. So you don’t have to!
reply
bekacru
1 hour ago
[-]
Hey, Bereket from Better Auth here. I started Better Auth to solve this exact issue for myself, and it later turned into a company. It always give me joy to just see others getting the same value from it :) There is a lot to work on, would love to know what we can improve
reply
rbbydotdev
58 minutes ago
[-]
Do you think the complexity of auth in the browser, is because browsers don't do enough?
reply
bekacru
49 minutes ago
[-]
I think auth is complicated outside of browsers too. But browsers do make some things uniquely confusing, especially cookies and general security primitives are full of footguns
reply
wxw
1 hour ago
[-]
I enjoyed the Supabase migration article from a while ago (https://blog.val.town/blog/migrating-from-supabase) as well. There's a shortage of good, honest writing on long-term engineering decisions, please keep up the blog!
reply
snide
50 minutes ago
[-]
This is why I'm so thankful I went with Lucia early. They sort of sunset their library and replaced it with documentation (and some small utilities) for how to manage and host authentication for yourself. It's always presented as some big, scary thing you can't manage yourself, but I found that taking the week to learn how security and basic salting works, I was able to feel more confident about how everything worked.
reply
lioeters
11 minutes ago
[-]
https://lucia-auth.com/

I remember when they deprecated the library and instead made it a learning resource on implementing auth from scratch. Brilliant decision, much respect to the author.

reply
elAhmo
24 minutes ago
[-]
Using Clerk, quite unhappy with it. No proper RBAC (roles are tied to organizations, not stored on user itself, so you cannot have a concept of global admin or something like that, unless you use metadata for storing arbitrary key value paris), and more than once in the past weeks/months it had a downtime causing the whole app to fail.

Would think twice before using it in the future.

reply
WilcoKruijer
53 minutes ago
[-]
You could almost call the comparison between Clerk and Better Auth unfair. One is a service and one is a library, apples to oranges. Any third-party service integrated into a stack is a liability, libraries as well, but to a lesser degree. It’s about time for more services to be replaced by libraries. Better Auth really shows how to do that imo, it’s a library that integrates on the frontend, backend, and database. This is why it’s so good.
reply
melonpan7
28 minutes ago
[-]
If anything I feel like Clerk adoption is becoming the norm in recent years. I started using it about a year ago and found it to have troublesome reliability.
reply
rbbydotdev
1 hour ago
[-]
Tom's articles are always a good read.

Anyone remember Auth0 and passportjs?

The churn of auth services is never ending, but I suppose so are the standards.

reply
clintonb
57 minutes ago
[-]
OAuth 2.x and OIDC haven’t changed much. I still use Passport.js with Firebase.
reply
kandros
1 hour ago
[-]
Does Better Auth still have the weird design to be everything “request header based”? I remember running admin scripts and tests to be very hacky due to it cause if you skipped that plugins wouldn’t run
reply
zuzululu
1 hour ago
[-]
what do you get from Better Auth btw? When I used it last year, I still found it lacking and it seemed to be run by one guy.
reply
azyc
1 hour ago
[-]
Lol wut? you get all of your auth data in your own db in 1 cli command. You are not tied to any on db provider. On top of that you get hundreds of auth features like oauth providers (I use it to allow users to log in via google, apple, github) and the best part it's free. Not saying Supabase and Clerk are bad, but they cost money. With better auth you pay exactly $0 for all of this.
reply
giancarlostoro
1 hour ago
[-]
Or I could use a web framework that offers that out of the box, and its free and lives in my database, wherever I want.
reply
mchusma
59 minutes ago
[-]
I’ve looked at these auth providers many times over the years and I just don’t get the value. It takes me a couple of minutes to set up auth. Why would I want a dependency? It doesn’t help me with the hardest part which is configuring Google and Apple sign in stuff on Google and Apple. I just don’t get it.
reply
rozap
1 hour ago
[-]
this is sorta the obvious takeaway here. as a postgres/phoenix/elixir enjoyer i am blissfully unaware of all this sort of SaaS churn.
reply
Scarbutt
1 hour ago
[-]
What framework offers all those auth features OOTB?
reply
dsagent
1 hour ago
[-]
reply
giancarlostoro
48 minutes ago
[-]
ASP .NET Core, Ruby on Rails, Django, .... the list goes on and on... The ones that don't usually someone built a package that lets it happen.
reply
lanyard-textile
1 hour ago
[-]
It must have come a long way then -- I'm integrating it into a new product and it is absolutely fantastic. It just works.
reply
cyberax
1 hour ago
[-]
> Some important context is that Clerk is a major success. They just raised 50 million dollars and they have lots of satisfied users.

And even more users who are looking to escape. Clerk is just a mess. They are trying to cram EVERYTHING into their libraries: Web3 crap, Stripe, etc. Clerk's JS blob is now triggering the browser inspectors for being slow to load.

Every time when we upgraded React, Clerk libraries were the biggest pain with their transitive dependencies. We had issues with Stripe libraries with conflicting versions, etc.

And forget about debugging it. The libraries are obfuscated, and the TS code is impenetrable mess of abstractions to support "isomorphic" code that can run transparently on the frontend and backend.

And their platform itself is lacking important functionality, like freaking audit logs and versioning. Somebody (probably) accidentally changed a setting in their console, and we couldn't trace back when it happened or who did it.

Edit: oh yeah, and don't forget their unreliability. I had to wake up on Sunday to deal with Clerk failing the API calls for token refreshes last week.

reply
notbekacru
36 minutes ago
[-]
> And even more users who are looking to escape.

Uhm, companies like Replit and several other large startups are actually adopting Clerk. I guess if your world mainly revolves around X (formerly Twitter), it can seem like everyone is moving away from Clerk.

Also, Better Auth’s X presence is pretty much centered around criticizing every auth provider out there, so the discourse there tends to skew heavily negative.

reply
supermdguy
1 hour ago
[-]
Better auth is great! I love how it's way more hackable than using a something like Clerk. We were able to add a plugin to allow auth via iframe postMessage (embedded in a CRM) and everything worked seamlessly.
reply
cpursley
1 hour ago
[-]
If you're in Elixir-land, I've put together a few packages to help migrating from Supabase (or other stacks):

- https://github.com/agoodway/introspex (generate Ecto Schemas from postgres tables)

- https://github.com/agoodway/pgrest (Supabase/PostgREST compatible query engine)

I also found this helpful in the migration: https://github.com/supabase-community/supabase-ex

Nothing for auth, I basically did a one-off script for that. Phoenix auth stuff that comes out of the box is great.

reply
cpursley
1 hour ago
[-]
Oh, and http://github.com/agoodway/walex if you need the realtime database change stuff.
reply
moomoo11
1 hour ago
[-]
I've just stuck with Auth0 for years now.

Easy to use and high reliability. Some of these other providers are not the best at reliability.

reply
dakolli
46 minutes ago
[-]
The homepage of val.town says "Zapier for know-code engineers".. Is KNOW-code engineer a term?
reply
CharlesW
26 minutes ago
[-]
It's just a play on the phrase "no code".

Maybe you can help me out: I still have no idea what val.town is. I guess it's an alternative to Cloudflare Workers?

reply
dakolli
21 minutes ago
[-]
That's a good question, I was having a hard time figuring that out myself. They call themselves the "zapier" for developers. In reality it seems kinda like a FaaS but idk. They have a code intelligence product that seems like a FIM autocomplete. Very confusing product suite.
reply