How should my project be structured?

I've been working on a discord.js bot of considerable size for a long while now, but I'm starting to notice some issues with how I've structured my typescript codebase. I have multiple modules for managing different 'core parts', such as my discord server, the client, logs, etc. I've noticed however that these modules and everything using them often have eachother as dependencies, creating many circle imports. In addition with top-level awaits, this causes great delays in performance and reaction time. I've just learned about dependency injection to avoid circle imports with my logs module, as this was causing most issues, but now I'm wondering how the project should be structured in general. How should logs (discord chat based), clients, event listeners, etc interact with eachother and be initialized? I need a guideline to work towards since my project is currently quite a bit of an import-await spiderweb. Any advice would be greatly appreciated! Source code for reference: https://github.com/phantomeye1931/GLaDOS-Discord-Bot
No description
5 Replies
d.js toolkit
d.js toolkit3w 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! - Marked as resolved by OP
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
PhantomEye
PhantomEyeOP3w ago
right, so I shouldn't ask this here? I thought it would make sense to ask here as I assumed others would have experience with the exact same questions I'm having
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
PhantomEye
PhantomEyeOP3w ago
Alright, I'll move, thanks.

Did you find this page helpful?