Skip to content

Instantly share code, notes, and snippets.

View lncitador's full-sized avatar
🏡
Working from home

Walaff Fernandes lncitador

🏡
Working from home
View GitHub Profile
@lncitador
lncitador / README.md
Last active June 27, 2025 17:55
AdonisJS Lucid Mapper Utility

This abstract Mapper class provides a flexible and type-safe way to serialize, transform, and label AdonisJS Lucid models and their paginated results. It is designed to help you build clean API responses and DTOs in AdonisJS projects.

Features

  • Supports serialization of single models, arrays, and paginated results.
  • Custom serialization logic via subclassing.
  • Utility for picking specific fields and relations from models.
  • Label mapping mechanism for enums or field names.

Use this utility to keep your API layer clean, consistent, and maintainable when working with AdonisJS and Lucid ORM.