Monorepo with multiple Next.js apps
Hey guys, I have a monorepo (turborepo) with two nextjs apps like this (both consuming content from convex) :
I originally had just the landing app I was deploying everything to vercel with this command :
cd ../../packages/backend && bun convex deploy --cmd 'cd ../../apps/landing && turbo run build' --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL
.
Now how should I do this for each app ? Also I create a script to seed some data on the database that I always need (wheter is dev,preview or prod) (it checks if it exists and if not adds it), I do it in dev now like this "dev": "convex dev --run seed:seed",
how should I do this in production ?
Also I am planning to deploy my apps under domain names myapp.com (for the landing) and dashboard.myapp.com (for the dashboard) is there any extra configuration needed ?
Sorry for the very long message, and thank's in advance to anyone who can provide some help or advice.
Best regards, Ali1 Reply
You can run convex deploy on both of them, it shouldn't redeploy unchanged files, so should be fine, and that way you still get injected framework prefixed environment variables. For seeding, maybe just run your seed command in one of them for production, as I assume both get deployed when there's a change to your repo? For previews you'll want to run the seed command for both projects. Domains shouldn't present any problems.