create-t3-app icon indicating copy to clipboard operation
create-t3-app copied to clipboard

feat: Better Auth

Open koohz opened this issue 1 year ago β€’ 30 comments

Is your feature request related to a problem? Please describe.

Although still in beta (like next-auth), another good auth package would be better-auth

Describe the solution you'd like to see

Better Auth

Describe alternate solutions

Better Auth

Additional information

No response

koohz avatar Nov 02 '24 08:11 koohz

Any updates on this? Better Auth hit v1 a few months ago (on Nov 2023) and is such a good auth solution. Clears NextAuth/Auth.js imo and does everything better. Here are some things I can think of off the top of my head:

I'm only glazing on Better Auth this much because it'd be a good fit for create-t3-app cus it's also:

Would love to see this added in! If this is something the maintainers would be open to, I'd love to work on the PR to get this added in!

aryanprince avatar Jan 06 '25 13:01 aryanprince

I would like to see this also

c2b247 avatar Jan 14 '25 13:01 c2b247

I would also be down to work on this

aidansunbury avatar Jan 15 '25 04:01 aidansunbury

Hey Hey here an fork from the guy that work on better-auth lib: https://github.com/Bekacru/create-t3-turbo/tree/main

CarlosZiegler avatar Jan 20 '25 12:01 CarlosZiegler

Hey Hey here an fork from the guy that work on better-auth lib: https://github.com/Bekacru/create-t3-turbo/tree/main

Do you know how to run CLI generate app from the fork?

michaltaberski avatar Feb 06 '25 13:02 michaltaberski

Want to second this. Would love to try T3 stack but been using better-auth lately and refuse to go back to authjs

gavgrego avatar Feb 19 '25 18:02 gavgrego

As another option to consider, there is also Stack Auth which looks promising.

GermanJablo avatar Mar 06 '25 10:03 GermanJablo

If someone is good with BetterAuth, why not contribute ? πŸ˜„

MuellerMarvin avatar Mar 14 '25 16:03 MuellerMarvin

@MuellerMarvin kind notice: better-auth is far less mature than nextauth. don't waste the time : )

CatStudioApp avatar Mar 21 '25 20:03 CatStudioApp

@MuellerMarvin kind notice: better-auth is far less mature than nextauth. don't waste the time : )

I already transferred the entire T3 template to BetterAuth.

It's a blessing, NextAuth is kind of dead to me. πŸ˜…

MuellerMarvin avatar Mar 21 '25 20:03 MuellerMarvin

Open to PRs adding this. Ping me on Discord when you have something up, sometimes my Github notifications gets overwhelmed and I don't check this project on a daily basis

juliusmarminge avatar Mar 21 '25 23:03 juliusmarminge

@MuellerMarvin kind notice: better-auth is far less mature than nextauth. don't waste the time : )

I already transferred the entire T3 template to BetterAuth.

It's a blessing, NextAuth is kind of dead to me. πŸ˜…

saying this just to save your time in production. you're welcome.

CatStudioApp avatar Mar 22 '25 00:03 CatStudioApp

@MuellerMarvin kind notice: better-auth is far less mature than nextauth. don't waste the time : )

I already transferred the entire T3 template to BetterAuth. It's a blessing, NextAuth is kind of dead to me. πŸ˜…

saying this just to save your time in production. you're welcome.

It's the first time I've heard a negative thing about BetterAuth, but if there really is a major problem with the library, it would probably help mentioning what that problem is.

Maybe consider even opening an issue there, from the feature-set, quality of the docs and structure of the API, it seems to be the best Auth library out there right now, if you're okay with building your own UI around it.

The problem with AuthJS, the missing, missing password auth, difficult to replace sign in pages, among a few. The advantage of it of course having all the pages already in place and being a 3 minute set up, none of your own work needed.

Open to PRs adding this. Ping me on Discord when you have something up, sometimes my GitHub notifications gets overwhelmed and I don't check this project on a daily basis

Might shoot you a PR 🀞 Thanks for answering on this !

MuellerMarvin avatar Mar 22 '25 01:03 MuellerMarvin

Now that PR is welcome, @CarlosZiegler can you please kindly create a PR to the repo https://github.com/t3-oss/create-t3-turbo ?

contrun avatar Mar 26 '25 03:03 contrun

hey ho, @MuellerMarvin really nice that you implemented that, I will do that @contrun lets wait the PR here to do same into turbo :).

CarlosZiegler avatar Mar 26 '25 05:03 CarlosZiegler

Hey Hey here an fork from the guy that work on better-auth lib: https://github.com/Bekacru/create-t3-turbo/tree/main

This repo is a great template for using better-auth and expo with trpc. I should add that the trpc integration isn't complete and it took me a while to realise why my protectedProcedures were not getting the auth session.

Example: Usage With TRPC

In particular this line was missing

const cookies = authClient.getCookie(); if (cookies) { headers.set("Cookie", cookies); }

Hope this helps anyone who is facing the same problem I had

Chipzstar avatar May 02 '25 18:05 Chipzstar

There is another one with Prisma https://github.com/iAskShahram/better-t3-app

And if you use Drizzle git clone -b drizzle --single-branch https://github.com/iAskShahram/better-t3-app.git

koohz avatar May 03 '25 20:05 koohz

Is anyone working on this? If not I am happy to

AlpMimaroglu avatar May 19 '25 10:05 AlpMimaroglu

go ahead @AlpMimaroglu :)

CarlosZiegler avatar May 19 '25 11:05 CarlosZiegler

Any updates on this? I'd love to try out the t3 stack for my project, but I'm waiting for better-auth integration. (I know the turborepo version already has it but that one's stuck on tailwind v3..)

jannisbecker avatar Jul 02 '25 07:07 jannisbecker

I'd love to see this added to the main repo.

laGameTV avatar Aug 04 '25 07:08 laGameTV

+1

maxforbang avatar Aug 09 '25 18:08 maxforbang

I started working on this and got the cli to scaffold the drizzle / prisma schema and auth folder only for app router with trpc (took me a while with help of ai assist). Need to add social and test each combo to make sure they work. I will have some pr up by Monday i believe.

HimanshuKumarDutt094 avatar Aug 23 '25 10:08 HimanshuKumarDutt094

I started working on this and got the cli to scaffold the drizzle / prisma schema and auth folder only for app router with trpc (took me a while with help of ai assist). Need to add social and test each combo to make sure they work. I will have some pr up by Monday i believe.

Edit : I got drizzle + postgres and sqlite working, i am using GitHub o auth instead of discord because i don't use it, I'll test more, tbh I'm shooting in blind and just replicating and creating better-auth variant of variable files and functions (I'm new to this). Edit 2: @CarlosZiegler once I put pr up could you look at it, I am following the variable and file patterns same as current code base. I didn't find any prs with better auth, so I'm doing it blind.

HimanshuKumarDutt094 avatar Aug 23 '25 13:08 HimanshuKumarDutt094

Update: got almost everything working only problem is the e2e test make 512 tests because of better auth option, idk how to approach it. @juliusmarminge I'm new to this GitHub workflow stuff so any point would be appreciated Edit: everything is working, just need review

HimanshuKumarDutt094 avatar Sep 11 '25 05:09 HimanshuKumarDutt094

+1

ArianSha avatar Oct 07 '25 16:10 ArianSha

Update, I got all the combinations to work, just need review, you can test it out on your local end for testing. All feedback welcomed. https://github.com/t3-oss/create-t3-app/pull/2142

HimanshuKumarDutt094 avatar Oct 07 '25 17:10 HimanshuKumarDutt094

+1 be good to see this implemented! πŸ‘

ashley-campbell-wpa avatar Oct 08 '25 09:10 ashley-campbell-wpa

I can offer you guys this template to get a quick tRPC project started with better-auth.

It also comes with Drizzle and shadcn/ui preinstalled.

T3-Better-Auth-Template

I added a brief overview over the differences to the t3-template in the readme.

MuellerMarvin avatar Oct 14 '25 21:10 MuellerMarvin

the issue can be closed as https://github.com/t3-oss/create-t3-app/pull/2142 is merged. In new version you will need to add next cookies plugin for server action in auth client, i have a pr open to update it.

HimanshuKumarDutt094 avatar Nov 12 '25 12:11 HimanshuKumarDutt094