3 unstable releases
new 0.2.0 | Jan 16, 2025 |
---|---|
0.1.1 | Nov 14, 2024 |
0.1.0 | Nov 14, 2024 |
0.0.1 |
|
#253 in Database interfaces
55KB
1K
SLoC
convex-typegen
A blazing fast Rust type generator for ConvexDB schemas and functions.
Features
- 🚀 Blazing Fast: Efficient AST parsing and type generation using oxc
- 🔄 Auto-regeneration: Types automatically update when schema or function files change
- 🛠️ Complete Type System:
- Full schema type generation (tables, columns, unions)
- Function argument types for queries, mutations, and actions
- Support for all Convex types (arrays, objects, records, literals)
- Proper handling of optional fields and complex types
- 🔒 Type Safety:
- Compile-time type checking
- Automatic serialization/deserialization
- Zero runtime overhead
- 🎨 Developer Experience:
- Clean, idiomatic Rust code generation
- Smart function path resolution (e.g., "auth:login")
- Detailed documentation for generated types
Quick Start
- Add dependencies using cargo:
cargo add convex-typegen serde serde_json
cargo add --build convex-typegen
- Add the following to your
build.rs
file:
use convex_typegen::generate;
fn main() {
generate().unwrap();
}
- Run
cargo build
to generate the types.
You can watch a demo video here to learn more.
Supported Types
- Basic Types:
string
,number
,boolean
,null
,int64
,bytes
- Complex Types:
array
,object
,record
,union
,optional
- Special Types:
any
,literal
,id
- Custom Types: Automatic enum generation for union types
Acknowledgments
Related Projects
- convex rust sdk - Official Rust client for ConvexDB
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first.
Versioning
This project follows Semantic Versioning (SemVer) to manage releases. The versioning format is:
- MAJOR version is incremented for incompatible API changes or breaking changes.
- MINOR version is incremented for adding new features in a backward-compatible manner.
- PATCH version is incremented for backward-compatible bug fixes or minor changes that don't add new features.
For more details, refer to the CHANGELOG.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~20–28MB
~422K SLoC