Hey guys, it's my first time making a fullstack application with Bun and Drizzle. Right now I'm struggling with the architecture choice. I have a server (for auth), a turso database, and a Telegram bot files. Both the server and the bot need access to the database. Right now the bot and the server run separately. Recently I even made them separate processes but it seems that was the wrong choice. I tried to find new ways I can architecture this.
I started looking at the opencode source code. They have a namespace for the database that they share across app. On the other hand TypeScript docs says namespace is legacy so I shouldn't use it; use separate methods instead. I don't really know. LLM can't help me either so maybe you know the best way I can organize my project to share the database and methods like getUser, updateUser, deleteSession etc. across the application without one file blocking db for other ones.