#you have to add the message in a

1 messages · Page 1 of 1 (latest)

rose saffron
#

Thanks, how should it done normally?

torpid hill
#

you have to connect your nextjs app to a database, the most common thing people use to interact with databases is prisma

rose saffron
#

how to capture each messages

torpid hill
#

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

rose saffron
#

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

torpid hill
#

doesnt rly change anything, just gotta make your queries efficient and have a good hosting service for your db

torpid hill
rose saffron
#

yeah

torpid hill
#

aight cool

#

just go on the prisma docs, it shows you how to set up your db models

rose saffron
#

normally it limits how many connections at certain time right?

torpid hill
#

yeah usually, not sure the specifics of how prisma handles it

rose saffron
#

so the performance won't have any issue if thousands of messages need to be written into db at the same time?

torpid hill
#

plenty of platforms have high usage databases, you just have to have good hosting and efficient code

#

and you should have fine performance

rose saffron
#

Thanks, do you have some code examples?

torpid hill
#

of what?

#

prisma?

rose saffron
#

no, efficient code saving high frequent data into db

torpid hill
#

lmao efficient code varies on what youre trying to do, your performance will be fine even if youre using your db a lot