Trouble understanding team workflow using Convex.
I've created the project in my team and invited all members. How can we work on the project at the same time if we all share the same dashboard? I read an answer from @ian that says "You might want to be collaborating around the "Prod" instance instead, so you can locally develop and he can work off of the last backend functions you pushed" I'm just a bit confused about what this means and how to go about using the prod/dev workflow.
10 Replies
Every team member has their own dev deployment. There is a single prod deployment. Running
npx convex dev
syncs to your dev. npx convex deploy
deploys to prod
Make sense?Gotcha, so when I initially share the app through github and they run npx convex dev it creates their own dev instance?
That way everyone can be working with their own schema and functions.
Thank you, that makes sense, my only question then is how do you resolve conflicts when deploying separate dev instances to prod?
When you deploy to prod you are replacing the functions and schema. So you should probably just deploy from origin/main or something
And also are env keys shared across dev instances or do those need to be manually added each time
If the data doesn’t match the schema you are pushing it will reject the push and tell you a document that doesn’t match
Env variables are separate. You can set defaults for preview deploys though. And you can copy from prod to dev on your own
So you can be working with different api keys etc
There’s now a cli command to get and set env variables too
Sweet, thank you!
Enjoy!
Linking to our docs on default environment variables: https://docs.convex.dev/production/environment-variables#project-environment-variable-defaults
You can set default environment variables for a project that get synced to new preview deployments and new dev deployments. So setting a default env variable with a shared API key means that when new team members join and get a dev instance, they'll automatically have that env variable without having to copy it from somewhere else.
Environment Variables | Convex Developer Hub
Store and access environment variables in Convex