This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is @rustify/serde - a production-ready TypeScript serialization/deserialization library inspired by Rust's serde. The library provides pure structural transformation between types and their serialized forms without validation.
- Uses pnpm as the package manager (defined in
packageManagerfield) - Uses mise for runtime management (Node.js and pnpm versions)
- ESM-only project (
"type": "module"in package.json)
- Vite is used for building the library (see
vite.config.ts) - Builds ESM format only with TypeScript declarations
- Library entry point:
src/index.ts - Output:
dist/directory - Uses
@/alias forsrc/directory imports
- Biome for linting and formatting (configured in
biome.json)- Single quotes, no semicolons where possible
- 2-space indentation, 100 character line width
- Strict rules: no explicit
any, unused variables as errors
- TypeScript with strict configuration
- Vitest for testing with coverage support
The library will be organized into modular components:
src/types/- Core interfaces (Result, Serde, SafeSerde)src/serializers/primitives.ts- String, Number, Boolean, Date, Literal, Enum serializerssrc/serializers/complex.ts- Object, Array, Tuple, Union, Record serializerssrc/serializers/modifiers.ts- Optional, Nullable, Default, Mapped, Lazy serializerssrc/index.ts- Main exports and factory object
Once fully implemented, these commands will be available:
# Development build (watch mode)
pnpm dev
# Production build
pnpm build
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverage
# Lint code
pnpm lint
# Format code
pnpm format
# Pre-publish validation
pnpm prepublishOnly- Pure serialization/deserialization without validation
- Functional, composable API design
- Zero runtime dependencies
- Browser-first approach (no Node-specific APIs)
- Full TypeScript type inference support
- ESM-only for modern environments