typestack/class-transformer

Decorator-based transformation, serialization, and deserialization between objects and classes.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 23 minutes ago
Added to GitGenius on September 9th, 2026
Created on February 9th, 2016
Open Issues & Pull Requests: 268 (+0)
GitHub issues: Enabled
Number of forks: 526
Total Stargazers: 7,341 (+0)
Total Subscribers: 42 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

class-transformer is a TypeScript library that transforms, serializes, and deserializes between plain objects and class instances using decorators.

The library solves the problem of converting between plain JavaScript objects and typed class instances, which is essential when working with data from APIs, databases, or user input that arrives as plain objects but needs to be used as instances of specific classes with methods and type safety. It uses a decorator-based approach that lets you annotate class properties to control how transformation happens, supporting operations like plainToInstance to convert plain objects into class instances, instanceToPlain to extract plain objects from class instances, and serialize/deserialize methods for controlled output based on criteria like groups or versioning.

The tool suits both frontend and backend TypeScript projects that need to bridge the gap between untyped data sources and typed class hierarchies. It is particularly useful when receiving JSON from APIs and needing to instantiate domain objects, or when preparing objects for serialization to JSON with selective property inclusion. The library handles nested objects, allows you to expose getters and computed properties, supports renaming properties during transformation, can skip specific properties or entire classes, and provides grouping and versioning mechanisms to control which properties are included in different contexts.

Development activity shows consistent maintenance with regular updates addressing issues and adding features. The project maintains active test coverage tracking and responds to community contributions. The codebase demonstrates attention to both core functionality and edge cases like circular reference handling and implicit type conversion.