Monorepo + Hono
@Ping basically i don't want to manually write fetch for all better auth endpoints, would prefer using the auth.api method
any ideas on how to go about this pls
I have a setup with Hono + Better Auth on the backend and Next.js on the frontend.
Backend Better Auth config (running on Hono, port 3000):
This is in my backend folder
/lib/auth.ts
which i then exported using exports in the package.json and imported in my frontend
On the Next.js frontend (running on port 3001), I’m importing the auth object from the Hono backend to make server-related queries.
Problem:
When I run
inside a Next.js server component, it always returns null.
But when I use authClient.useSession
on a client component, the session works fine.
IG the first thing to confirm is that is it possible to use the exported auth from the hono app1 Reply
@iatomic.btc From what I heard it is better to write endpoints by yourself using
auth.api
I believe it is more performant