Sandy
Sandy11mo ago

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.
No description
10 Replies
ian
ian11mo ago
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?
Sandy
SandyOP11mo ago
Gotcha, so when I initially share the app through github and they run npx convex dev it creates their own dev instance?
ian
ian11mo ago
That way everyone can be working with their own schema and functions.
Sandy
SandyOP11mo ago
Thank you, that makes sense, my only question then is how do you resolve conflicts when deploying separate dev instances to prod?
ian
ian11mo ago
When you deploy to prod you are replacing the functions and schema. So you should probably just deploy from origin/main or something
Sandy
SandyOP11mo ago
And also are env keys shared across dev instances or do those need to be manually added each time
ian
ian11mo ago
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
Sandy
SandyOP11mo ago
Sweet, thank you!
ian
ian11mo ago
Enjoy!
sshader
sshader11mo ago
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

Did you find this page helpful?