T3 - How to create a User record on Clerk signin (i.e. proper way of keeping track of user info)
Hello, is there a way to creat/upsert a User into a User schema when someone logs into your app via Clerk? I'm thinking of creating a User model with similar functionality of typical social media uses e.g. upvotes, likes, posts, etc.
I know that with Clerk, people have said you can omit having a User model since you can make queries from your other models (e.g. showing all likes with the desired userId, showing all posts with the userId, etc.), but if you want to show several rows of different databases (posts, likes, etc), wouldn't it make more sense to have a User database so you can just run one query? I've been able to create a function that makes the user, but haven't seen how to run this on signing in, so there's the tedious process of having the user click a button or something else
Open-ended question on what is best practice overall and how to best proceed with conventional T3 stack for this functionality- Prisma, Clerk, TRPC, Next
1 Reply
I think you can use Clerk Webhook