Is it possible to create the backend of a dashboard with discord JS?

Like the title says. Im wondering if its possible and yes, if it is recommended. Most of the avaibale tutorials on YT are not made with Discord JS so before investing time in it, i would like to know if its even possible.
8 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
treble/luna
treble/luna10mo ago
yes
Nachdeule
Nachdeule10mo ago
Are there any pros and cons i should know about ? The dashboard should be used to configure the guilds and channels that my bot is in. I already started coding one can already do some api calls to the discord api and fetch data. But one of my mates told me to switch because its easier in the long run Switching from basic js to discord js So basically i could write an api for my bot and fetch the data directly from there instead of fetching data from another api which is basically doing the same? Did i get that right? Because that would make more sense, yeah
nothingg
nothingg10mo ago
Is this how most dashboards are setup? I guess the advantage is that I'd be able to use cached data and the discord.js library to build an api that the dashboard front end talks to. Then I could avoid writing separate code to interact with the discord api. Would a disadvantage be that, if the bot goes down, the bot's api is also down with it? Also, wouldn't this open up more attack vectors if the api isn't properly protected against ddos? This would be an issue either way but at least a separated api wouldn't also take down the bot. Forgive the ignorance, learning about dashboards as well and appreciate any response
Trojxn
Trojxn10mo ago
if you host the api on a different server I'm sure you could reject/drop any request not coming from the dashboard ip and therefore negate any attack vectors on the api. However if ddos attacks are something you're worried about, the dashboard is just as equally likely to get ddosed.
nothingg
nothingg10mo ago
if the dashboard api is sending data from the bot websocket process, an attack on the api could now take down both the bot and the dashboard api. I know this probably isn't very likely but it seems to me that running the dashboard api with the bot would add a new attack vector to the bot since it now needs to handle both traffic.
Trojxn
Trojxn10mo ago
no matter what if you're publishing a website to the internet it's going to have ddos attack vectors, you just simply have to get good ddos protection
nothingg
nothingg10mo ago
I agree. My thought was that by combining the bot and the dashboard api, the bot gains a new attack vector that it previously didn't have I was curious what most dashboard devs do. Combine the bot and dashboard api which shares cache and can use the gateway? Or separate the processes and have the dashboard api make calls directly to the discord api? The tutorial I watched did the latter Thanks for the info! The tutorial is using a bearer token from oauth makes sense when considering size