I can't believe it, but it's finally here. Woohoo! Celebrate party time. Oh, wait. You're asking why are we celebrating? You know, nothing big. You know, just the thing that everyone's been complaining about for Convex for like [music] forever and the thing that I have yet to make a proper video on. That's right, it's off, baby. The V2 version is finally here and it's now finally a proper official nonBA forever version that I can unquestionably recommend for everyone. Asterisk. The Giga Chad engineering team here at Convex have been working on it for many months now and have built the entire thing from scratch using the latest and greatest Convex best principles like components, type safety, etc. [music] So you can just drop it into your next project and never have to think about or ever [music] again. I'm excited to take you through all of it. So, make sure you grab yourself a lovely cup of tea [music] and let's check out the brand new Convex Orth V2. So, if you aren't familiar, Convex [music] orth is orth that lives inside of your Convex back end. So, there's no additional third party service to sign up for and you know, no per user billing like you might get from Clerk or Work OS, but more on that a little bit later. [music] out of the box, it does passwords, pass keys, and you know, the usual social login like Google and GitHub, etc. Actually, you know what? I think the best way to show it off is just to have an agent add it to an existing app. [music] So, here's a little notes app that I had my agent cook up for me. Very simple, very ugly, but yeah, going to add a notes in here, like and sub. And you can see that it shows up on the other side. And if I refresh it, yeah, there's no author here. So, anybody can go onto the site and add a note at any time, which [music] is obviously not ideal. So, I'm just going to open up my favorite Aentic development environment. This one's a threadbear. If you're interested, there's a whole video on it in a link somewhere. But basically, I'll say, okay, go ahead and [music] add or v2 to it now, please. and it's going to go ahead and [music] just add it. So, it's going to go off obviously and read the lovely new docs for the convex or v2 [music] and implement um whatever orth we agreed before this video. And huzzah, here we go. We now have orth working in two sections hopefully. [music] Let me create an account. Mike super secure password. Ah, okay. in Dave. Okay, we're in. So, we've got two separate users and we can [music] put two separate sets of notes in. Very nice. It works. So, the way this is going to work is it's going to add components to your project. Basically, there's one for the core of convex or and there's [music] one for each bit of the project, each kind of or section you want, whether username and passwords or pass keys or whatever. It does this. So each one keeps its own data in its own tables, nicely separated and [music] inaccessible from the rest of your application, but still visible in the dashboard if you want to inspect it. So for example, the passwords live over here in the passwords component and they're hashed and your own code can't actually read them. So all you can do is ask the component to set a password or check [music] one. So it's one less thing that you need to worry about that your application code can get access [music] to the sensitive authentication information. And in the orth config, there's just this one line you add. And basically [music] it's that simple. There's there's no keys to generate to paste into environment variables or anything like that like we had to do with [music] comx or von which was a nightmare. The comx deployment itself just signs the tokens which [music] is just really nice if you ask me. Now, next up is this create user mutation. And I'm not going to get into the the details of the code too much because I mean, who reads the code anymore, right? But I do just want to point it out because of a core thing that or v2 does different compared to [music] the others out there. So when a user signs up to your application, comx author is going to call this [music] function. So then you can you can yourself create a user in your own table in your application [music] schema and you get to decide what lives alongside each user added in there. Right now there's nothing in there but ids but if you want something like I don't know display name or nickname or birthday or whatever you can just add it to that table yourself. [music] And it's all done in the same transaction as the signup itself. So if something goes wrong halfway through you don't end up with half a user hanging around which is great. So yeah, if you've used Clerk or Work OS or another third party or provider before, you might remember having to set up [music] web hooks from their system into ComX. So you have a copy of that data [music] in your own database. Well, you don't need that anymore with V2 because the users are and all the information is already in the [music] database. Oh, and because sessions are just convex data, it's all reactive like everything else. So, if I sign out of this tab, then the other one is going to sign out straight [music] away if they're logged into the same account. Very nice, right? So, remember that little asterisk I said at the start? Asterisk. So, V2 doesn't do everything quite yet. I mean, there's no multiffactor authentication [music] or magic links to emails for now, and it only works with React and Nex.js [music] at the moment, but I'm told all of that extra good stuff is coming very, very soon. [music] If there's something that you want to see ASAP, drop me down in a comment down below and I'll pass it on. Now, you might be wondering with Clerk Works, better off than the old Convex V1 and now with this Convex V2, which one of these should I actually be using and for what purpose? [music] So, here's where I'm currently sitting with this. If you're starting a new Convex app, just go with Convex or V2. [music] It's the best. It's going to be the thing that we support going forward the most. It's going to have all the new features. It's going to have all the security goodness, etc. inside [music] of it. If you're already on the convex or v1, the old one, there currently is no migration explicit migration tooling yet, but probably your agent could probably work out how to upgrade you. [music] As for better or better component, better was kind of built for traditional databases, unlike not really for convex. So, it had a bunch of things that never really quite fit in the convex model. So I personally wouldn't start a new app using the better orth convex component and the team are currently working on a way to help users migrate away from that to the new convex or v2. [music] And as for clerk and work OS they're both still great if you need like the big enterprisey features like SSO and things like that. But yeah, I'd say for the vast majority of apps that you're probably going to be building, Convex all 2 is where to go. But anyways, I think that's all I got for you guys for now. Don't forget to drop me a like and sub. And until next time, thanks for watching. Cheerio. [music]
I can't believe it, but it's finally here! You know, nothing big, just the thing everyone has been complaining about Convex lacking for like... forever, and the thing I have yet to do a proper video or post on. That's right, it's auth!
People asking about auth on Convex over the years: GitHub issues, a Reddit comment and a post from our CEO
Convex Auth v2 is out, and it's our proper, official, non-beta-forever version that I can now recommend for everyone (well, with a little asterisk, which I'll get to at the end 😉).
The Convex Auth docs: "These are the docs for Convex Auth v2, the current stable release"
The team have been working on it for many months now and rebuilt the whole thing from scratch on the latest Convex goodness like components and end to end type safety. Let's take a look.
What is Convex Auth?
If you aren't familiar, Convex Auth is auth that lives right inside your Convex backend. So there's no additional third party service to sign up for, and no per user billing like you might get with Clerk or WorkOS (more on those a little later).
Clerk's pricing page: 50,000 monthly retained users included, then $0.02 per user per month
Out of the box it does passwords, passkeys and the usual social logins like Google, Apple and GitHub:
The sign-in methods in the Convex Auth docs
The old Convex Auth (v1) sat in beta for about two years, with this warning on it the whole time:
The old docs: "Convex Auth is in beta"
So it's really nice to finally see that go.
Having my agent add it
Actually you know what, I think the best way to show it off is to just have an agent add it to an existing app. So here's a little notes app I had my agent cook up for me. Very simple, very ugly, but you can add a note in one window and it shows up in the other:
0:00 / 0:00
There's no auth in here at all, so anybody can go onto the site and add a note at any time, which is obviously not ideal.
So I opened up my favourite agentic development environment (Threadbear, if you're interested) and asked it to add Convex Auth v2, something like this:
Add username + password and passkey sign-in to this app with Convex Auth v2,
following the docs at https://docs.convex.dev/auth/convex-auth. Each user's
notes should be private to them.
It goes off and reads the lovely new docs, and then starts wiring it all up. Here's a run of the same prompt, sped up:
0:00 / 0:00
A few minutes later, huzzah! We have auth. I created an account with a username and password in the left window, and a second account in the right one, and each of them only sees their own notes:
0:00 / 0:00
Very nice, it works.
How it works
So the way this works is it adds components to your project. There's one for the core of Convex Auth, and then one for each kind of sign-in you want, whether that's username and password, passkeys, or whatever:
It does this so each one keeps its own data in its own tables, nicely separated and inaccessible from the rest of your app, but still visible in the dashboard if you want to inspect it. So for example, the passwords live over here in the password component, and they're hashed:
The authPassword component's passwords table in the Convex dashboard, showing a hashed password
And your own code can't actually read them. All it can do is ask the component to set a password or check one, so that's one less thing to worry about your application code getting its hands on.
No more keys
Then there's the auth config, and that's it, just one line:
There are no keys to generate and paste into your environment variables or anything like that. With v1 you had to run a script to make a private key and a JWKS:
The v1 setup docs: a generateKeys.mjs script that prints JWT_PRIVATE_KEY and JWKS
and then copy the whole output into your deployment's environment variables, which was a bit of a nightmare:
The v1 setup docs: "Copy the whole output and paste it into your Convex dashboard deployment's Environment Variables"
Now your Convex deployment just signs the tokens itself, which is really nice if you ask me.
Your users, in your own table
Next up is the createUser mutation. I'm not going to go into the code too much, but I do want to point it out because it's a core thing that v2 does differently to the other options out there.
When someone signs up to your app, Convex Auth calls this so that you create the user in your own users table, in your own schema, and you get to decide what lives alongside each user in there. Right now there's nothing in it but the ids:
The users table in the Convex dashboard: two users with only _id and _creationTime
But if you want something like a display name, a nickname or a birthday, you just add it to that table yourself.
And it's all done in the same transaction as the sign up itself. So if something goes wrong halfway through, you don't end up with half a user hanging around:
0:00 / 0:00
Which is great.
If you've used Clerk, WorkOS or another third party auth provider before, you might remember having to set up webhooks from their system into Convex, so you have a copy of your users in your own database. Well, we don't need that any more with v2, because the users are already in your database:
0:00 / 0:00
It's reactive
Oh, and because sessions are just Convex data, it's all reactive like everything else. If I sign out in one tab, the other tab signed into the same account signs out straight away:
0:00 / 0:00
Noice.
That asterisk
Right, so remember that little asterisk from the start? v2 doesn't do everything quite yet. Right now:
there's no multi-factor authentication
there's no magic links or one-time codes by email
it works with React and Next.js only
I'm told the extra good stuff is on its way, and if there's something you'd like to see sooner, let us know on Ship.
So which one should you use?
With Clerk, WorkOS, Better Auth, the old Convex Auth v1 and now v2, you might be wondering which one you should actually be using. Here's where I'm sitting:
A table comparing Convex Auth v2, Convex Auth v1, the Better Auth component, and Clerk and WorkOS, for a new app, an app already using it, and needing SSO
If you're starting a new Convex app, just go with Convex Auth v2. It's the one we'll be supporting going forward, so it's going to get all the new features and all the security goodness.
If you're already on Convex Auth v1, there's no migration tooling just yet, though your agent can probably work out how to upgrade you, and the docs have a guide for coming from v1. v1 is still getting security updates for now.
As for Better Auth and the Better Auth component: Better Auth was built for traditional databases rather than for Convex, so a bunch of things never quite fit the Convex model. I personally wouldn't start a new app on it, and the team are working on a way to help people move from it to Convex Auth v2.
And Clerk and WorkOS are both still great if you need the big enterprise-y features like SSO:
WorkOS's pricing page: free up to 1 million users, then $2,500 a month per extra million
Conclusion
So just to recap: Convex Auth v2 lives right inside your backend as components, one per sign-in method. There are no keys to generate, your users are a normal table in your app, sign up happens in one transaction, and sessions are reactive like everything else in Convex.
I love this because it feels very Convex'y. It's all just code and data in your own deployment, which also makes it really easy for your agent to set up, like we saw above. For the vast majority of apps you're probably going to be building, I'd say Convex Auth v2 is where to go.
Until next time, cheerio! 👋
All gas, no breakages
Convex is the reactive backend platform that keeps up with you and your agents. Database, functions, workflow, sync, search, file storage, and more. All TypeScript, zero glue.