For the complete documentation index, see llms.txt. This page is also available as Markdown.

Model

Model

A model (document / DTO) is the persistence shape of your data — how a record looks in the database. It's kept separate from the domain Entity so storage concerns never leak into your business model; a Mapper converts between them. Write it by hand in the feature's data/ folder:

// data/character.dto.ts — the MongoDB document shape
export interface CharacterDocument {
  _id: string;
  name: string;
  universe: string;
  alignment: string;
  createdAt: Date;
  updatedAt: Date;
}

Entity vs Model

Entity
Model (document/DTO)

Layer

domain/

data/

Purpose

business rules + behavior

storage shape

Knows the DB?

no

yes (e.g. _id)

Defined as

class

interface / type

Last updated