Prisma Domain Mapper Generator
CommunityIsolate domain from DB, map entities with precision.
Software Engineering#DDD#Prisma#persistence#mappers#database abstraction#repositories#domain entities
AuthorRomualdP
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill solves the problem of coupling the Domain Layer to the database technology (Prisma) by generating robust bidirectional mappers, ensuring the core business logic remains pure, testable, and independent of persistence details.
Core Features & Use Cases
- Bidirectional Mapping: Creates static
toDomain()(Prisma Model → Domain Entity) andtoPrisma()(Domain Entity → Prisma Input) methods for seamless data conversion. - Value Object Reconstruction: Guides on correctly reconstructing Value Objects from primitive database values when mapping to the domain.
- Relation Handling: Provides patterns for mapping 1-to-1 and 1-to-many relations, including handling nullable fields and nested creates.
- Use Case: When fetching a
Clubfrom the database, theClubRepositoryusesClubMapper.toDomain()to convert the raw PrismaClubmodel into a richClubdomain entity with its associatedClubNameValue Object, ready for business logic.
Quick Start
To create a mapper, define static toDomain(prismaModel: PrismaModel): DomainEntity and static toPrisma(domainEntity: DomainEntity): PrismaCreateInput methods. Ensure toDomain() reconstructs Value Objects and toPrisma() extracts primitives.
Dependency Matrix
Required Modules
@prisma/client
Components
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: Prisma Domain Mapper Generator Download link: https://github.com/RomualdP/hoki/archive/main.zip#prisma-domain-mapper-generator Please download this .zip file, extract it, and install it in the .claude/skills/ directory.