Calling convex mutations / queries from other repo
I'm curious what the best practice is for if I have my convex project in 1 repo, but I want to invoke just a single query or mutation from another repo using the node sdk? Is there a way to achieve this?
3 Replies
I don't want to setup a mono repo
my current approach is to just make an http endpoints and invoke it
and then create some type of secret API key I can use from my other service to invoke that private http endpoint
There's some additional tooling coming here but this is indeed the best practice, using a separate secret.
You could give that other repo an API key with which it could do everything (call any internal function, etc.) but that's too much power. Instead creating a public HTTP endpoint or a public query/mutation/action and using the Convex HTTP client https://docs.convex.dev/api/classes/browser.ConvexHttpClient or ConvexClient to call it makes sense.
ok cool, I'll use this approach for now