Using drizzle in monorepo
Answered
Sun bear posted this in #help-forum
Sun bearOP
I am building a project where I have 2 next.js applications. Let's call them
I want to share a single drizzle
How can I achieve such a thing in a turbo monorepo or any other way?
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?
Answered by "use php"
So assuming this is the file structure:
You can create the DB on
and import it.
The same is being used by the bot @Oriental .
you can view src at https://github.com/rafaelalmeidatk/nextjs-forum
apps/webapps/adminYou can create the DB on
packages/botand import it.
The same is being used by the bot @Oriental .
you can view src at https://github.com/rafaelalmeidatk/nextjs-forum
5 Replies
@Sun bear 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?
So assuming this is the file structure:
You can create the DB on
and import it.
The same is being used by the bot @Oriental .
you can view src at https://github.com/rafaelalmeidatk/nextjs-forum
apps/webapps/adminYou can create the DB on
packages/botand import it.
The same is being used by the bot @Oriental .
you can view src at https://github.com/rafaelalmeidatk/nextjs-forum
Answer
Sun bearOP
thank you very much