with one click
domain-driven-design
Apply Domain-Driven Design patterns. Use when modeling complex business domains, defining bounded contexts, or designing aggregates. Covers entities, value objects, and repositories.
Menu
Apply Domain-Driven Design patterns. Use when modeling complex business domains, defining bounded contexts, or designing aggregates. Covers entities, value objects, and repositories.
Based on SOC occupation classification
Biome 2.x linting and formatting patterns. Use when configuring code quality tools, setting up linting rules, formatting code, or integrating with CI/CD. Covers migration from ESLint/Prettier.
Hono 4.x web framework patterns. Use when building APIs, middleware, routing, or server-side applications. Covers multi-runtime support (Node, Bun, Cloudflare Workers), validation, CORS, and error handling.
Radix UI primitive patterns. Use when building accessible, unstyled UI components like dialogs, dropdowns, tooltips, tabs, and selects. Covers Tailwind styling, keyboard navigation, animations, and portal management.
React development patterns. Use when building React components, managing state, creating custom hooks, or optimizing React applications. Covers React 19 features, TypeScript integration, and composition patterns.
Tailwind CSS 4.x utility-first styling patterns. Use when building UI components, creating responsive layouts, implementing design systems, or customizing themes. Covers CSS-first configuration, @theme directive, and component patterns.
Vite 7.x build tool patterns. Use when configuring build setup, development server, environment variables, asset handling, or optimizing production builds for React applications.
| name | domain-driven-design |
| description | Apply Domain-Driven Design patterns. Use when modeling complex business domains, defining bounded contexts, or designing aggregates. Covers entities, value objects, and repositories. |
Use the same terminology as domain experts. Code should read like business documentation.
A boundary within which a particular domain model is defined and applicable.
Shows how bounded contexts relate to each other.
Has identity that persists over time. Equality based on ID.
class User {
constructor(
public readonly id: UserId,
public email: Email,
public name: string
) {}
}
Immutable, equality based on attributes.
class Email {
private constructor(public readonly value: string) {}
static create(value: string): Email {
if (!value.includes('@')) {
throw new Error('Invalid email');
}
return new Email(value);
}
equals(other: Email): boolean {
return this.value === other.value;
}
}
Cluster of entities and value objects with a root entity.
class Order { // Aggregate Root
private items: OrderItem[] = [];
addItem(product: ProductId, quantity: number): void {
// Business rules enforced here
this.items.push(new OrderItem(product, quantity));
}
get total(): Money {
return this.items.reduce((sum, item) => sum.add(item.subtotal), Money.zero());
}
}
Abstracts data access for aggregates.
interface OrderRepository {
findById(id: OrderId): Promise<Order | null>;
save(order: Order): Promise<void>;
}
Something that happened in the domain.
class OrderPlaced {
constructor(
public readonly orderId: OrderId,
public readonly userId: UserId,
public readonly occurredAt: Date
) {}
}
Translate between your model and external systems.
Shared subset of domain model between contexts.
Upstream provides what downstream needs.