Master Guides

Generators

Write less boilerplate — generate it, wired up and ready.

Master’s generators are idempotent and wiring-aware: they create files and also register routes (in routes.js) and models (in AppContext.js) for you.

scaffold — a full vertical slice#

The headline generator. One command produces a model, a REST controller, routes, and a Next.js page.

terminal
$ master g scaffold post title:string body:text

Creates and wires:

  • backend/app/models/Post.js — entity, registered in AppContext
  • backend/app/controllers/postsController.js — RESTful JSON controller
  • frontend/app/posts/page.tsx — a list page that fetches /posts
  • 5 routes (index/show/create/update/destroy) appended to routes.js
generated Post.js
export default class Post {
  id(db)    { db.integer().primary().auto(); }
  title(db) { db.string(); }
  body(db)  { db.text(); }
}

controller#

terminal
$ master g controller users index show profile

Creates a controller with one action per name (default index) and a GET route for each.

model#

terminal
$ master g model Comment body:text author:string created_at:datetime

Creates a MasterRecord entity and registers its dbset. Field types map to native columns — see the field-type reference.

page#

terminal
$ master g page about

Creates frontend/app/about/page.tsx, a Next.js App Router server component.

socket / middleware / component#

terminal
$ master g socket chat message typing # app/sockets/chatSocket.js
$ master g middleware auth # middleware/NN-auth.js
$ master g component billing # components/billing/...
Field syntax
Pass name:type pairs. Types: string, text, integer, bigint, float, decimal, boolean, date, datetime, timestamp, json, uuid, binary.