Recipes
Working wiring examples with the sharp edges annotated — each recipe is a complete, compiling setup for one capability, plus the mistakes that look right but aren't. The same content is served to coding agents by the MCP server (get_recipe <name>) from @modularityjs/manifest; these pages and the MCP tool share one source, so they never drift apart.
If you're starting from zero, do the Tutorial first — it walks one app from scaffold to verified CRUD API. Recipes are the reference you come back to per capability.
Orientation
- Minimal App — the smallest complete boot: one controller, one service,
createApp. - Project Structure — the layered domain blueprint
pnpm modularity generate domainscaffolds. - Best Practices — the habits that keep an app aligned with the framework's grain.
- Anti-Patterns — code that compiles but is semantically wrong here (NestJS habits, pool misuse, wrong wrap layer).
Wiring by capability
- Audit —
AuditService.record/find, store drivers, PII discipline - Auth — resolver chain, HTTP authenticators,
@RequireAuth - Cache —
CacheService, TTLs, tag invalidation, atomic operations - Database — entities pool, repositories, migrations
- Transactions —
@Transactional, propagation, transaction-aware handles - Email Verification — hashed single-use tokens,
markEmailVerified, enumeration safety - Events — typed bus,
@OnEvent, runtime subscription - File Uploads — multipart limits,
@UploadedFile, sanitization - GraphQL — SDL pool, resolvers, mercurius mounting
- Health — liveness vs readiness probes,
/health/*endpoints, k8s config - Idempotency —
@Idempotentreplay, 409 concurrency, retryable failures - Jobs —
@JobDefinitionclasses, dispatch-by-class over any queue driver - Outbox — reliable event publication with stores and dispatchers
- Search — index declaration, portable query union
- Serialization —
Resourceclasses,@SerializeWith, groups - Session — session stores and the HTTP extension
- Storage — the storage contract and drivers
- Tenancy — tenant resolution, scope chain, per-tenant config
- Validation —
Validator,@ValidatedBody, schema registry - WebSocket — gateways, message handlers, connection lifecycle