Ajay
Ajay
CCConvex Community
Created by Ajay on 5/24/2025 in #support-community
Deploying Convex in a Turborepo
Thanks! The build command:
cd ../../packages/backend && npx convex deploy --cmd 'cd ../../apps/web && turbo run build' --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL
cd ../../packages/backend && npx convex deploy --cmd 'cd ../../apps/web && turbo run build' --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL
Was critical. Of note it is important to replace the
../../apps/app
../../apps/app
with
../../apps/web
../../apps/web
in my specific case.
9 replies
CCConvex Community
Created by Ajay on 5/24/2025 in #support-community
Deploying Convex in a Turborepo
Further reading ... ok, so the PRODUCTION_DEPLOY_KEY is just so that I don't have to authenticate to write the convex functions?
9 replies
CCConvex Community
Created by Ajay on 5/24/2025 in #support-community
Deploying Convex in a Turborepo
If I'm understanding this:
How it works

In Vercel, we overrode the Build Command to be npx convex deploy --cmd 'npm run build'.

npx convex deploy will read CONVEX_DEPLOY_KEY from the environment and use it to set the CONVEX_URL (or similarly named) environment variable to point to your production deployment.

Your frontend framework of choice invoked by npm run build will read the CONVEX_URL (or similarly named) environment variable to point your deployed site (via ConvexReactClient) at your production deployment.

Finally, npx convex deploy will push your Convex functions to your production deployment.

Now, your production deployment has your newest functions and your app is configured to connect to it.

You can use --cmd-url-env-var-name to customize the variable name used by your frontend code if the deploy command cannot infer it, like

npx convex deploy --cmd-url-env-var-name CUSTOM_CONVEX_URL --cmd 'npm run build'
How it works

In Vercel, we overrode the Build Command to be npx convex deploy --cmd 'npm run build'.

npx convex deploy will read CONVEX_DEPLOY_KEY from the environment and use it to set the CONVEX_URL (or similarly named) environment variable to point to your production deployment.

Your frontend framework of choice invoked by npm run build will read the CONVEX_URL (or similarly named) environment variable to point your deployed site (via ConvexReactClient) at your production deployment.

Finally, npx convex deploy will push your Convex functions to your production deployment.

Now, your production deployment has your newest functions and your app is configured to connect to it.

You can use --cmd-url-env-var-name to customize the variable name used by your frontend code if the deploy command cannot infer it, like

npx convex deploy --cmd-url-env-var-name CUSTOM_CONVEX_URL --cmd 'npm run build'
Basically the CONVEX_DEPLOY_KEY is just an automatic way to set the CONVEX_URL (which I can just grab from the dashboard, right?) and then run convex deploy?
9 replies
CCConvex Community
Created by Ajay on 5/24/2025 in #support-community
Deploying Convex in a Turborepo
Some related questions I have are: - In addition to the PRODUCTION_DEPLOY_KEY do I need the DEPLOY_URL? - Is this something that goes into my web application as an environment variable? - Why don't I need a deploy key for dev?
9 replies