#you have to add the message in a
1 messages · Page 1 of 1 (latest)
you have to connect your nextjs app to a database, the most common thing people use to interact with databases is prisma
how to capture each messages
wym
you have to add a message to a database using prisma, then when you want to get the messages for a chat back, you make a query using prisma
so you write into a database everytime a message is in?
that's a lot DB writting, what if thousands of messages are sent each min
doesnt rly change anything, just gotta make your queries efficient and have a good hosting service for your db
have you worked with a database before?
yeah
normally it limits how many connections at certain time right?
yeah usually, not sure the specifics of how prisma handles it
so the performance won't have any issue if thousands of messages need to be written into db at the same time?
plenty of platforms have high usage databases, you just have to have good hosting and efficient code
and you should have fine performance
Thanks, do you have some code examples?
no, efficient code saving high frequent data into db
lmao efficient code varies on what youre trying to do, your performance will be fine even if youre using your db a lot