Modules, Features and Slices
Module
Section titled “Module”The module is the top-level namespace and maps to a bounded context. One module per file is the convention but not enforced.
module <Name> [description "<text>"]
[<screen templates>] [<dialog templates>] [<features>]Screen templates and dialog templates declared at module level are described in Layouts and templates.
Features
Section titled “Features”Features are vertical slice groupings. They nest arbitrarily deep for sub-features.
feature <Name> [description "<text>"] [feature <Name>]* ← sub-features [slice <type> <Name>]+Slices
Section titled “Slices”The slice is the atomic unit of behavior, aligned with Event Modeling. A slice has a type and a name, and contains the constructs that implement the behavior.
slice <SliceType> <Name> [description "<text>"] [file <path>] <constructs>The optional file line names the repository relative file this declaration is realized by, so a document can be navigated back to the code it describes. It is additive - it never stands in for any part of the declaration. See File references.
Descriptions
Section titled “Descriptions”Modules, features, slices, personas, and commands take an optional description as their first body line — a human-readable summary consumers such as Prologue surface when presenting the model. At most one per declaration.
module Invoicing description "Everything related to invoicing customers"
feature InvoiceManagement description "Registering and managing the lifecycle of invoices"
slice StateChange RegisterInvoice description "Registers a new invoice"When one line is not enough, use a fenced block — the same ``` convention as inline code blocks. The fenced text is kept verbatim:
module Invoicing description ``` Everything related to invoicing customers. Registration, lifecycle and payment tracking of invoices. ```Slice types
Section titled “Slice types”| Type | Description |
|---|---|
StateChange | A command → events flow; something that changes the system |
StateView | A query + projection + screen; something that reads the system |
Automation | A reaction or reducer; something that runs when something happens |
Translate | A capture; converts external data into events |
What goes in a slice
Section titled “What goes in a slice”| Construct | Typical slice type | Page |
|---|---|---|
event | any | Events |
command | StateChange | Commands |
constraint | StateChange | Constraints |
query | StateView | Queries |
readmodel | StateView | Read models |
projection | StateView | Projections |
reducer | StateView | Read models |
screen | StateView | Screens |
reaction | Automation | Reactions |
capture | Translate | Captures |
Every one of these may appear as many times as the behavior needs — several events, several commands, several projections. Only description is limited to one. A slice is one behavior, not one artifact of each kind.
Example
Section titled “Example”module Invoicing
feature InvoiceManagement
slice StateChange RegisterInvoice command RegisterInvoice ... event InvoiceRegistered ...
slice StateView InvoiceList query ListInvoices => InvoiceListReadModel[] projection InvoiceList => InvoiceListReadModel ... screen InvoiceList ...