class-transformer is a TypeScript library used alongside class-validator in NestJS’s ValidationPipe. Its key function plainToInstance() transforms a plain JavaScript object (the deserialized request body) into an instance of a typed class, restoring the decorator metadata needed for validation.

This transformation is necessary because the underlying HTTP platform (Express/Fastify) deserializes request bodies without type information. Without plainToInstance(), class-validator decorators would not be applied.