convex-typegen

Crates.ioconvex-typegen
lib.rsconvex-typegen
version
sourcesrc
created_at2023-12-03 20:23:26.033764
updated_at2024-11-14 15:15:25.084241
descriptionType safe bindings for ConvexDB in Rust
homepagehttps://github.com/JamalLyons/convex-typegen
repositoryhttps://github.com/JamalLyons/convex-typegen
max_upload_size
id1057065
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
CodingWithJamal (ThatGuyJamal)

documentation

https://docs.rs/convex-typegen

README

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

  1. Add dependencies using cargo:
cargo add convex-typegen
cargo add --build convex-typegen
  1. Add the following to your build.rs file:
use convex_typegen::generate;

fn main() {
    generate().unwrap();
}
  1. 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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built for use with ConvexDB
  • Powered by oxc for TypeScript parsing

Related Projects

Commit count: 118

cargo fmt