The customer portal
The signed-in half of the web app, and what grit generate resource writes into it. Your operators get the admin panel. Your customers get this.
Why it exists
Generating a resource has always produced a complete screen for the operator and a React Query hook for the customer. For an internal tool that is the whole job. For a product with customers it is half of one, and the half that is missing is the half people pay for.
The Expo generator already writes a list screen, a detail screen, a form and a create and an edit screen, and links them from the app's navigation. The desktop client does the same. The browser was the one surface that did not.
Turning it on
One question at scaffold time, recorded in grit.json:
grit new keep --saas# or answer the wizard: "Does this app have customers?"
That writes the signed-in customer area (sign-in, guards, the account pages and the shell they render in), then asks two follow-ups: whether customers belong to organizations, and whether you charge them. Both are plugins that already existed. On an older project, the same thing by hand:
grit add web-auth # the customer areagrit plugin add multitenant # organizations, if customers have teamsgrit plugin add stripe # billing, if you charge them
What a resource writes
In a SaaS project, a resource that belongs to somebody gets both halves:
grit generate resource Note --fields "title:string,body:text" --owned-by user
apps/admin/... the operator's screen, as alwaysapps/web/app/(app)/notes/page.tsx the customer's listapps/web/app/(app)/notes/new/page.tsx createapps/web/app/(app)/notes/[id]/page.tsx edit and deleteapps/web/components/portal/note-form.tsx the formapps/web/lib/portal/notes.ts the resource as dataapps/web/app/(app)/layout.tsx an entry in the customer sidebar
Cards rather than a data table, deliberately. An operator is auditing every row of a shared dataset; a customer is looking at their own handful of things, and the generated screen should look like that before anybody edits it.
The rows are scoped by the API, not by the page. --owned-by scopes every query to the signed-in user, and --tenant-owned to their organization. The list asks for everything and receives only what it may have. There is no filter in the page doing that job, and there should not be: a check that lives in a page is a check an API client walks past.
Three levels
| Level | What you get | When |
|---|---|---|
| screens | Pages, a form, a sidebar entry | The default in a SaaS. Invoices, documents, anything list-shaped |
| headless | The descriptor and the hooks. No JSX | The product's own surface, which you are designing yourself |
| off | The hook alone | Everywhere else. What every version before v3.584.0 wrote |
grit generate resource Note --owned-by user --portal headless
The headless level
Nobody building a note-taking app wants a generated table, and nobody building one wants to hand-write the members screen either. The split is the point: the furniture is the same in every SaaS, and the product's own surface is not.
Headless writes the resource as data and stops. Build your screen against it and a column added to the Go model turns up without an edit; hard-code the fields in a component and it will not.
// apps/web/lib/portal/notes.ts, generatedexport const notePortal = {resource: "notes",label: "Notes",path: "/notes",api: "/api/notes",scope: "user", // or "organization"display: "title",subtitle: "body",fields: [{ name: "title", label: "Title", kind: "text", required: true },{ name: "body", label: "Body", kind: "textarea" },{ name: "colour", label: "Colour", kind: "select", options: ["yellow", "green", "blue"] },],} as const;
What it leaves out matters as much: the owner column is never on the customer's form, because a customer setting user_id would be giving their row away, and the service stamps it from the session anyway. Nothing in the descriptor is a permission check. It describes what to render, never what is allowed.
Your pages are yours
A generated page is written once and never overwritten. Run the generator again to add a field and the field reaches the form through the descriptor, while your layout, your copy and your ordering stay exactly as you left them. The same is true of the shared kit in components/portal/: edit it and later runs leave it alone.
What comes with the plugins
Two screens nobody should have to write, both inside the same shell and both in the sidebar:
- /organization from the multitenant plugin: members, invitations, roles, the organization profile and its logo.
- /billing from the Stripe plugin: the plan, whether it is paid up, when it renews, cancel and resume, and the billing portal. No invoice table, because Stripe's portal already has one and a copy would drift.
