Deploying Next.js w/ Drizzle on Vercel with Turborepo

I have a turborepo with Next.js using drizzle-orm as a shared package.

A bit of context - I'm using a monorepo with drizzle and share the tables, types and schemas across all my apps by having a shared packages/database library - that my Next.js app is consuming.

One issue I've had is that in order to get drizzle-orm working in my monorepo I've had to install it globally ie. in my root level package.json.

My package.json at the root level looks like this at the moment:

{
  "name": ...,
  "private": true,
  "scripts": {
    "build": "turbo run build",
    "dev": "turbo run dev",
  },
  "devDependencies": {
    "@ianvs/prettier-plugin-sort-imports": "^3.7.2",
    "@types/pg": "^8.6.6",
    "drizzle-kit": "^0.17.5",
    "eslint": "^7.32.0",
    "prettier": "^2.8.7",
    "turbo": "latest"
  },
  "dependencies": {
    "drizzle-orm": "^0.25.4",
    "drizzle-zod": "^0.4.1",
    "pg": "^8.10.0",
    "pg-native": "^3.0.1",
    "zod": "^3.21.4"
  },
  "workspaces": [
    "apps/*",
    "packages/*"
  ]
}

Note that all of the packages above are not in either my packages/database or apps/next dependencies.
My Next.js app consume my database library like this in the apps/next application's package.json
"database": "1.0.0"
Was this page helpful?