Skip to content

Mapia

Mapia is a lightweight, zero-dependency object mapper for TypeScript. It lets you describe transformations declaratively while staying fully type-safe, even when the input and output shapes diverge slightly.

Watch the demo

Why Mapia?

  • 🧙 IDE-friendly auto-mapping powered by TypeScript inference
  • 🪶 Zero dependencies, 80 kb unzipped bundle size—suitable for browsers and Node
  • 🧪 Type-safe by default, even with classes, generics, and nested structures
  • 🧼 Minimal configuration and predictable output every time
  • Up to ~2000× faster than class-transformer and AutoMapper-TS in production-level tasks

Getting started

Try to run this code snippet in your TypeScript project:

ts
import { compileMapper } from 'mapia';

const userMapper = compileMapper<UserResponse, UserEntity>({
  // id: 'id',
  // email: 'email',
});

const entity = userMapper.mapOne({ id: '1', email: 'alex@example.com' });

If you using VS Code, press Ctrl+. inside the mapper definition to see the auto-completion in action! Quick fix "Add missing properties" will suggest all the mappable fields automatically.

Released under the MIT License