adonisjs-dtos

Define typed DTOs from VineJS-validated payloads for HTTP controllers and services.

2|1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/omakei/adonisjs-architecture-skill --skill adonisjs-dtos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adonisjs-dtos
Source: https://github.com/omakei/adonisjs-architecture-skill/tree/main/adonisjs/skills/adonisjs-dtos
Command: npx skills add https://github.com/omakei/adonisjs-architecture-skill --skill adonisjs-dtos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

DTOs provide a typed contract between the HTTP layer and domain, ensuring safe data transfer and predictable behavior across controllers, actions, and services.

Core Features & Use Cases

  • Interface-based DTOs for simple payloads that require no construction logic
  • Class-based DTOs for normalization, static factories, and nested DTOs
  • Clear mapping from validated payloads to domain inputs, aiding testability and separation of concerns

Quick Start

Create a DTO from your validated payload in the controller and pass it to the action to start using typed DTOs.

Frequently Asked Questions about adonisjs-dtos

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I transfer validated data between AdonisJS controllers and services?

Use Data Transfer Objects (DTOs) to move validated data between HTTP controllers, actions, and services. Build DTOs from VineJS-validated payloads in the controller and pass a single typed DTO to actions to maintain a clean domain boundary.

When should I use class-based DTOs instead of interfaces in TypeScript?

Use class-based DTOs when you need normalization, static factories, or nested DTO structures. Use interface-based DTOs for simple payloads that require no construction logic, ensuring a typed contract between the HTTP layer and your domain.

What is the best way to map HTTP payloads to domain inputs in AdonisJS?

The best way to map payloads is creating a DTO from your validated VineJS payload in the controller. Passing this DTO to domain actions provides clear mapping, aids testability, and ensures safe data transfer across layers.

Does this DTO approach support nested structures and data normalization?

Yes, class-based DTOs support both nested DTO structures and data normalization. This allows you to transform and structure complex validated payloads before passing them across your architectural layers.

How do I maintain a clean domain boundary when passing data to actions?

Maintain a clean domain boundary by constructing a typed DTO from your validated controller payload and passing only that single DTO to your actions. This ensures predictable behavior and separates HTTP concerns from domain logic.