Unable to use convex as a submodule
I am using the same convex database for multiple apps and thus sharing the whole convex folder.
Problem 1: should I leave the convex folder to be committed individually in each of the app? I am concerned the functions won't get stored properly because they each have different functions and some overlapping names.
Problem 2: If I do want to share the convex folder across different apps, I couldn't think of a better way than submodule. However, as soon as I try to git init inside the convex folder, I got this error when running 'npx convex dev'
3 Replies
A few options with some threads you can find with search.convex.dev :
1. Monorepo with all of your apps in one repo sharing convex
2. I've used git subtree before, but it was from a nested folder, not making the convex folder the git root. You might try having the nested project having convex in a subfolder. Our CLI may be making some assumptions that the convex folder is in a folder, not in
.
in the git repo it's in
3. We're working on and soon to release a CLI command that will export the types of your API, so you could just copy those into the projects that don't need to be creating functions.
Overall know that when you deploy you are overwriting all functions, so if you only have some functions in each repo it won't work. You need a single place where all the functions are defined that you do your deploys from. Other projects can connect to the backend no problem, but they shouldn't be syncing / deploying to it unless they have all the functions.
There's also an anyApi
option to search for - that lets you use it anywhere but it doesn't have the types associated with it.we have a new option for sharing apis between repos: https://discord.com/channels/1019350475847499849/1019372556693815418/1278869945513545849
Thanks so much! I just read the announcements it’s exciting