Skip to content
Stack Builder

Add a feature

The table, port, adapter, router and view a new feature adds to the stack, generated live.

A feature is a table, a port, an adapter, a router and a view, and each one is a file in the stack. Adding one means adding each file in turn, in the order below. The todo feature is the worked example: the figure generates it in the preset you pick, and the lines that belong to it are marked.

Two rules

Add a port only when two implementations warrant it

A second ORM, a second API style or a second storage provider is what warrants a port. The builder writes one for each feature because it offers two adapters for it, Drizzle and Prisma; with one implementation, a port is only a layer to read through.

Switching an adapter never edits a page or a router

Switching the ORM rewrites the table, the adapter and the migrations. The view and the feature router keep their code, because they only ever see the port.