Web Dev Cody
Web Dev Cody5mo ago

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
Web Dev Cody
Web Dev CodyOP5mo ago
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
ballingt
ballingt5mo ago
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.
Web Dev Cody
Web Dev CodyOP5mo ago
ok cool, I'll use this approach for now

Did you find this page helpful?