Question about how to apporoach data

Hello, I have a question on how I should approach BetterAuth and handling its data. I am making a website with account features (name, email, address, phone number, etc...) and I don't know to structure my additional fields. 1) Do I put additional fields in User or into a seperate UserProfile? 2) Should I have these fields accessible in useSession or fetch it from Prisma? 3) If I do use Prisma, should I use an API end route or use server side actions and wrap my client components and pass the data in? I know my questions may seem dumb or elementary, but I really need help. I just want to be able to code in the best and most efficient practice. Thanks.
Solution:
1. Anything associated with a user can be in the user table, meaning it's fine to put it in the user additionalFields. 2. Depends on your app and how accessible you want it to be, but also keep in mind that getSession/useSession will be more secure as we check for session validation before returning the data, using your own endpoint to return data might be more work 3. There isn't any difference relating to Better auth on whichever you should use, comes down to preference & situation...
Jump to solution
4 Replies
andrew
andrewOP3mo ago
Also, I am using stripe. Do I still need to include a "Membership" field indicating membership status and expiration date etc when using better-auth/stripe? Thanks.
Solution
Ping
Ping3mo ago
1. Anything associated with a user can be in the user table, meaning it's fine to put it in the user additionalFields. 2. Depends on your app and how accessible you want it to be, but also keep in mind that getSession/useSession will be more secure as we check for session validation before returning the data, using your own endpoint to return data might be more work 3. There isn't any difference relating to Better auth on whichever you should use, comes down to preference & situation
Ping
Ping3mo ago
no, we handle that. If you want to know if a membership is still active or canceled, or any other status, you can just call this endpoint: https://www.better-auth.com/docs/plugins/stripe#listing-active-subscriptions
Stripe | Better Auth
Stripe plugin for Better Auth to manage subscriptions and payments.
andrew
andrewOP3mo ago
thank you :)

Did you find this page helpful?