Using drizzle in monorepo

I am building a project where I have 2 next.js applications. Let's call them admin and web. The admin is responsible for CRUD operations to database and allows the admin user to manage content on their website, while web interacts with the database in a read-only way, displaying the content for the user. I want to share a single drizzle db client between both projects because this keeps types for both projects synced and I don't have to write changes in 2 places whenever I want to modify something schema related. How can I achieve such a thing in a turbo monorepo or any other way?
2 Replies
DoggeSlapper
DoggeSlapper3mo ago
https://github.com/LeonAlvarez/local-first-starter/tree/main/lib/db U can do it that way, not the repo is WIP but that part is covered already
GitHub
local-first-starter/lib/db at main · LeonAlvarez/local-first-starter
Get started quickly with Postgresql and localfirst - LeonAlvarez/local-first-starter
DoggeSlapper
DoggeSlapper3mo ago
Also I have some extra stuff there because im using pglite on the browser, etc. You can just check index of that package and schemas folder
Want results from more Discord servers?
Add your server