The @domusjs/core
module provides the foundational building blocks for implementing Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) in TypeScript applications.
📚 Full documentation: @domusjs/core Docs
- ✅ Command and Query Buses (CQRS)
- ✅ Domain Events and Entities
- ✅ Value Objects and Repositories
- ✅ Result wrapper and rich error types
- ✅ Interfaces to decouple infrastructure
- ✅ Logging
npm install @domusjs/core
import { Command, Result, CommandHandler } from '@domusjs/core';
class SayHelloCommand implements Command {
constructor(public readonly name: string) {}
}
class SayHelloHandler implements CommandHandler<SayHelloCommand> {
async execute(command: SayHelloCommand): Promise<Result<void>> {
console.log(`Hello, ${command.name}`);
return Result.ok();
}
}
For advanced patterns, dependency injection, and more, check out the full documentation: