Skip to content

Domain.Model reference

Source: packages/domain/src/Model.ts

The aggregates, views and policies you host together. layer(policies) builds them all on the Platform you provide, and provides each aggregate and view as a service.

import * as Domain from "@alchemy.run/domain";
import * as Layer from "effect/Layer";
import { Account } from "./Account.ts";
import { AccountSummary } from "./AccountSummary.ts";
import { Customer } from "./Customer.ts";
import { MainAccountProvisioning, MainAccountProvisioningLive } from "./MainAccountProvisioning.ts";
export class Bank extends Domain.Model("Bank", {
aggregates: [Account, Customer],
views: [AccountSummary],
policies: [MainAccountProvisioning],
}) {}
export const BankInMemory = Bank.layer(MainAccountProvisioningLive).pipe(
Layer.provide(Domain.InMemory),
);