Froge
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Froge on 4/24/2023 in #questions
tRPC, Prisma, Discord Bot and tracking mass messages
Currently rebuilding building an app which is using NextJS (on Vercel), tRPC, Prisma, PlanetScale with a Discord bot all housed in a nice little Turborepo.
Now, you can create posts from the web app that get posted to fairly large number of Discord Servers (~700, and growing).
When the post gets approved by an admin (in the web app), it updates the post to approved through tRPC, tRPC calls the Discord bots little Express API to tell it to get the approved post and start sending the messages.
Then the messages are being sent out to the Discord servers via the bot, which will create an entry in the DB to track the status.
This is where I'm unsure, should the bot be creating those entries directly with Prisma initialized on the bot itself, or be going through tRPC on Next/Vercel.
I suppose if I'm batch creating all those entries from the Discord Bot, and then making a single call back to tRPC, but again it'll likely be ~700 entries to create and I'm unsure on the efficiencies here, as if there's 10 posts, that's 7K entries just to track which messages have been sent...
Or maybe there is a better way to track which messages have been sent?
68 replies