Is there any downsides to using better Auth WITHOUT the handler and client?

Are there any meaningful downsides/issues that could arise without using the handler and just calling the API Directly other than DX with having to create all the routes ETC? Will hooks still work same with all the plugins etc? Example Repo to with sign up/in/out without the handler: https://github.com/lonelyplanetdev/better-auth-without-handler
GitHub
GitHub - lonelyplanetdev/better-auth-without-handler
Contribute to lonelyplanetdev/better-auth-without-handler development by creating an account on GitHub.
25 Replies
Sithu Khant
Sithu Khant•2mo ago
I think maybe the downside will be you have to keep manage two api inside your client codes one for your normal api and one for better-auth
lonelyplanet
lonelyplanetOP•2mo ago
Im not adding the handler at all Check out the repo and have a look there is no /api/auth catch all for better auth
Sithu Khant
Sithu Khant•2mo ago
I checked your repo, and I see you used ssr code inside your page.tsx
lonelyplanet
lonelyplanetOP•2mo ago
Im just using the better auth callable api
Sithu Khant
Sithu Khant•2mo ago
that is what I mean
lonelyplanet
lonelyplanetOP•2mo ago
Hmm? By removing the better auth api handler for like nextjs or node and just using the the callable functions from better auth saves me from that hassle? I don't plan on using provided client
Sithu Khant
Sithu Khant•2mo ago
either me too
Sithu Khant
Sithu Khant•2mo ago
GitHub
better-auth-without-handler/src/lib/auth.ts at main · lonelyplanetd...
Contribute to lonelyplanetdev/better-auth-without-handler development by creating an account on GitHub.
Sithu Khant
Sithu Khant•2mo ago
but I am wondering how can I merge hono app and that auth together!
lonelyplanet
lonelyplanetOP•2mo ago
I haven't mounted the handle i have skipped step 7 and and 8 https://www.better-auth.com/docs/installation#mount-handler
Installation | Better Auth
Learn how to configure Better Auth in your project.
Sithu Khant
Sithu Khant•2mo ago
wait! I think you still need step 7, because they create routes for auth, isn't? otherwise, it won't work
lonelyplanet
lonelyplanetOP•2mo ago
No you dont that is for client thats what i believe The better-auth.api are basically just functions thats what im asking in the thread 😅
Sithu Khant
Sithu Khant•2mo ago
no..... it is for server
lonelyplanet
lonelyplanetOP•2mo ago
Give the repo a run
Sithu Khant
Sithu Khant•2mo ago
It said:
7. Mount Handler
To handle api requests, you need to set up a route handler on your server.
7. Mount Handler
To handle api requests, you need to set up a route handler on your server.
lonelyplanet
lonelyplanetOP•2mo ago
better auth uses #better-call under the hood which means a better call endpoint is a function and you use a handler to mount that function to the framework api routes
Sithu Khant
Sithu Khant•2mo ago
does this repo work?
lonelyplanet
lonelyplanetOP•2mo ago
yes
Sithu Khant
Sithu Khant•2mo ago
I think it shouldn't!
lonelyplanet
lonelyplanetOP•2mo ago
Load it up on stackblitz
Sithu Khant
Sithu Khant•2mo ago
I won't! I am pretty surprised that works because when I forgot to create server side auth, it doesn't work It returned me: 404 not found 😄
lonelyplanet
lonelyplanetOP•2mo ago
GitHub
GitHub - Bekacru/better-call: a tiny web framework for typescript
a tiny web framework for typescript. Contribute to Bekacru/better-call development by creating an account on GitHub.
Sithu Khant
Sithu Khant•2mo ago
I think, it worked because there is no other routes inside your codebase, maybe!
lonelyplanet
lonelyplanetOP•2mo ago
Its working because better auth is just better-call but with authentication routes and logic, "Better call is a tiny web framework for creating endpoints that can be invoked as a normal function or mounted to a router to be served by any web standard compatible server (like Bun, node, nextjs, sveltekit...) and also includes a typed RPC client for typesafe client-side invocation of these endpoints." Specifically: invoked as a normal function OR mounted to a router to be served by any web standard compatible server The main drawback is you don't get the better-auth client, which has some addtional logic for thing like passkeys which use @simplewebauthn/browser
Sithu Khant
Sithu Khant•2mo ago
sorry man! good talk, but I have to still work on my product

Did you find this page helpful?