Home / Companies / Convex / Blog / Post Details
Content Deep Dive

Convex in Multiple Repositories

Blog post from Convex

Post Details
Company
Date Published
Author
Jordan Hunt
Word Count
1,386
Language
English
Hacker News Points
-
Summary

Convex has introduced a feature that allows developers to use Convex functions across multiple repositories with type safety by generating a TypeScript API specification from function metadata. This is particularly useful for scenarios such as collaborating with frontend developers or managing separate repositories for different product surfaces. To implement this, developers need to install the "Convex Helpers" library, generate a TypeScript API file, and use it in other repositories by installing the Convex package. This process facilitates the integration of frontend and backend code in separate repositories, ensuring type-safe communication via Convex functions. The approach includes setting environment variables for connecting to the correct Convex deployment and using the generated API file to call functions. Convex validators play a crucial role in providing runtime validation and type-safe APIs, and it's recommended to define argument and return value validators for optimal API specification. The process of updating the API file should be integrated into the deployment workflow to reflect any backend changes.