How implement in separate Backend-API & NextJS?

Hi everyone, I have an application with a separate backend using nodejs and a nextjs frontend. Currently I am using passportjs (JWT) for auth in the backend API, then from the frontend consumes the token and stores it in a cookie. I am interested in better-auth & plan to migrate using better-auth. How do I implement better-auth in a separate application such as (separate backend, frontend)? For example, I want to set my better-auth in the backend API, then the frontend consumes the session or something else? Does anyone have an example of the implementation? Thanks
4 Replies
Ping
Ping3mo ago
You can take a look at integrations in the docs. but for example, you can use nodejs backend, and react frontend, and it will work. https://www.better-auth.com/docs/integrations/node
Node Integration | Better Auth
Integrate Better Auth with Node.
4_Hidayat_
4_Hidayat_OP3mo ago
Nah, currently I've already front-end using nextjs? When I use node. Can i combine node integration with nextjs as fronte?
Ping
Ping3mo ago
Can i combine node integration with nextjs as frontend?
yes
4_Hidayat_
4_Hidayat_OP3mo ago
Okay, I'll try. Thanks!

Did you find this page helpful?