Better Auth implementation with Next.js with my current backend setup

Hi everyone,

I already have a custom backend with working auth APIs:

POST /api/auth/login → expects { email, password } (or sometimes { phone, password }) and returns an access_token.

POST /api/auth/signup → creates a new user and returns an access_token.

When I hit these endpoints directly with fetch or axios, everything works fine.

But when I try to integrate Better Auth on the frontend with createAuthClient, it always tries to call /api/auth/sign-in/email or /api/auth/sign-up/email. That gives me a 404 because my backend doesn’t have those routes.

I tried overriding paths like this:
endpoints: {
signIn: {
email: { path: "/login" },
},
signUp: {
email: { path: "/signup" },
},
}


But Better Auth still ends up calling /sign-in/email instead of my /login.

So my questions are:

Can Better Auth’s frontend client work with a custom backend that already has its own /login and /signup endpoints?

Or is Better Auth meant to be used only if I also set up the Better Auth backend (with its expected routes)?

If I can integrate with my own backend, what’s the correct way to configure createAuthClient so it maps my /login and /signup endpoints?

Thanks in advance — I’m stuck between using my backend as-is vs replacing it with Better Auth’s backend setup. Any guidance would be really appreciated!
Was this page helpful?