database

Implement repository-based persistence with TypeORM and domain-to-ORM mapping.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mthang1801/go-domain-driven-design --skill database-mthang1801
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database
Source: https://github.com/mthang1801/go-domain-driven-design/tree/main/.claude/skills/database
Command: npx skills add https://github.com/mthang1801/go-domain-driven-design --skill database-mthang1801

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured guide to implementing repository-based persistence in the infrastructure layer of a Domain-Driven Design context, focusing on the base repositories, domain-to-ORM mapping, and clean separation of concerns between domain logic and data access.

Core Features & Use Cases

  • Domain repository interface definitions to decouple domain logic from data access.
  • Infrastructure repository implementations that extend a generic BaseRepository and map Domain <-> Orm.
  • Transactional persistence guidance using TypeORM transactions and injected repositories.
  • Mapping conventions and BaseOrmRepository patterns to streamline data access across services.
  • Use cases include implementing repositories for forms, aggregates, and other domain objects.

Quick Start

Implement a FormRepository that extends BaseRepository<Form, FormOrm> using a DataSource to map Domain to Orm.

Frequently Asked Questions about database

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

FAQPage Schema
How do I implement domain-to-ORM mapping in a NestJS TypeORM repository?

Implement domain-to-ORM mapping in a TypeORM repository by extending a generic BaseRepository and using an IMapper interface. This decouples domain logic from data access by converting Domain objects to Orm entities within the infrastructure layer.

What is the best way to manage TypeORM transactions in a Domain-Driven Design architecture?

Manage TypeORM transactions in a DDD architecture by utilizing a TypeOrmTransaction pattern and injecting transactional repositories. This ensures clean separation of concerns while maintaining transactional persistence across domain services.

How do I decouple domain logic from infrastructure repositories in TypeScript?

Decouple domain logic from infrastructure repositories in TypeScript by defining domain repository interfaces. Infrastructure implementations then extend BaseRepository to handle data access, keeping domain services independent of data access mechanisms.

Does this repository pattern support separating domain aggregates from data access?

Yes, this repository pattern supports separating domain aggregates from data access. By extending BaseRepository for aggregates like forms, it maps domain objects to TypeORM entities while enforcing clean architectural boundaries.

When should I use a BaseRepository pattern for TypeORM persistence?

Use a BaseRepository pattern for TypeORM persistence when you need structured domain-to-ORM mapping and transactional support in a Domain-Driven Design context. It streamlines data access across services while enforcing clean separation of concerns.

Can I use BaseOrmRepository patterns to streamline data access across multiple domain services?

Yes, you can use BaseOrmRepository patterns to streamline data access across multiple domain services. It provides a structured mapping convention that standardizes how infrastructure repositories interact with TypeORM DataSources.