romany
romany3mo ago

Convex in multiple frontend projects.

Hello guy, have anyone tried using a single convex backend in multiple projects (Nextjs web-dashboard and React-Native mobile-app)? Is it possible, will the schema and functions in my convex folder be synchronized across my different frontend projects?
7 Replies
Hmza
Hmza3mo ago
Yes - Answer is a Turbo Repo
romany
romanyOP3mo ago
Thank you @Hmza, I think a Turbo Repo will be an excellent approach. But I saw this post on convex blog, it’s about using convex-helpers and generating an api.ts file in the second or other project(s). Here’s the link to the blog post https://stack.convex.dev/multiple-repos#using-convex-within-multiple-repositories. what do you think about their recommended approach?
Hmza
Hmza3mo ago
Yes, this approach can work if your goal is simply to reuse APIs or functions from your Convex deployment in another project. However, keep in mind: This won't give you a single source of truth for your logic. You'll need to manage and deploy your Convex functions separately. Anytime you add or change a function, you'll have to regenerate the API definitions to keep things in sync.
romany
romanyOP3mo ago
You’re absolutely right. Again, I agree with the Turbo Repo approach. The recommended approach from convex blog post requires too many work and doesn’t have a good developer experience.
Hmza
Hmza3mo ago
Sure for your use-case its better to go with turbo repo. Although API definition through convex helpers is still a great way if: You're Working with external teams or contractors who you don't want to share whole convex codebase with or you just want to publish an npm package and don't want to pack the whole convex codebase with.
romany
romanyOP3mo ago
Yes. Thank you very much @Hmza . I appreciate you taking time to share your insight.
Hmza
Hmza3mo ago
No problem

Did you find this page helpful?