rkyv-js-codegen
Generates TypeScript codec bindings from rkyv types, targeting the rkyv-js runtime.
The generator parses Rust sources with syn, extracts every type marked #[derive(Archive)], and emits one export const Archived{Name} codec per type.
TypeScript types are derived from the codecs via r.Infer<typeof ...>, so your Rust source stays the single source of truth. No schema files, no second type declaration to drift.
[]
= "0.1"
use CodeGenerator;
A #[derive(Archive)] struct becomes a self-contained codec:
import * as r from 'rkyv-js';
export const ArchivedPerson = r.struct({
name: r.string,
age: r.u32,
email: r.option(r.string),
scores: r.vec(r.u32),
});
export type Person = r.Infer<typeof ArchivedPerson>;
Documentation
Compatibility
Emitted bindings import from the rkyv-js npm package.
Both halves are developed in the same repository and verified together by a bidirectional conformance suite against a pinned rkyv version (currently 0.8.18), but they are versioned independently - rkyv patch releases can legitimately change wire bytes, so check the project README before mixing versions.
License
MIT