Skip to content

bytaesu/better-auth-separate-backend

Repository files navigation

Better Auth Separate Backend Example

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.

Structure

  • Hono: API server that includes the Auth instance
  • Next.js: Client app that interacts with the API server using the Auth Client instance

Idea

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.

About

Example: Better Auth on a separate backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published