This repository was created to share a personal convention for using Better Auth on a separate backend. Since using the Auth Client on the server-side requires a bit of extra setup, this approach shows a convenient way to separate the usage.
- Hono: API server that includes the Auth instance
- Next.js: Client app that interacts with the API server using the Auth Client instance
In frameworks like Next.js, the server-side and client-side are separated, so we manage the Auth Client instance separately for each side. When performing auth checks on the server side, you can protect resources without dealing with loading states. This approach is my preferred way of using Better Auth, and this repository reflects that convention.