Contract Patterns

The contract examples in vara-dapp-patterns/contracts focus on small, production-oriented Sails patterns that solve one architectural problem at a time.

Included patterns

PatternProblem it solvesSource
Delayed Self-Messages with Version GuardsSafe deferred actions when delayed messages may arrive after state changedcontracts/delayed-self-message
Factory Pattern for Child Program InstantiationCreating many isolated program instances from one template CodeIdcontracts/factory
Service Wrapper PatternInjecting policy into a reusable base service without rewriting domain logiccontracts/module-toggles
Signless & Gasless SessionsDelegated execution with action allowlists and temporary session keyscontracts/signless-gasless

What makes these examples useful

Each example stays small enough to audit quickly, but still shows the moving parts that matter in a real app: storage ownership, explicit error boundaries, internal scheduling, service composition, and delegation flow.

Why this section matters

These patterns are most useful when you are not looking for a full product template, but for one reliable building block you can transplant into a larger program.

On this page