#43426·frappe

Desk v2 — the architecture: a report, one picture from the code, and guardrails

Author: shariquerikCreated Sep 28, 2026Updated Sep 29, 2026
Labelswayfinder:map

Child of #42061 (Desk v2 — the root map). Chartered 2026-09-28.

Destination

One written architecture of desk v2 that a new reader understands in an hour, and the tools that keep the code inside it. That is four things:

  1. A report that measures today's desk v2 against security, user experience, speed and simplicity, and ranks the cuts.
  2. A target architecture: the layers, the few concepts each layer has, and the main flows (boot, open a list, open a record, save, load a script), each with its permission checks, its cache and its cost.
  3. Guardrails: written rules, CI checks and one process rule that stop the code from drifting away from the architecture again.
  4. An interactive diagram built from the code. A hand-written layer file says which layer may use which. The diagram marks in red each place the code breaks it, and the same file drives a CI check.

The map is reached when the report and the target architecture are written and ruled on, the diagram and the checks are merged on desk-v2, and each accepted cut is a ticket on the map that owns its area.

Notes

  • Why this map exists. The user, 2026-09-28: each ticket looked at its own feature, and nothing looked at the whole desk. The record page grew from 4,172 lines (2026-08-28) to 12,902 lines (2026-09-25). The goal is simple but flexible, not the most complex framework.
  • This map builds, in part. The diagram and the guardrail checks are task tickets on this map. The code cuts that the report finds are not done here. Each goes to the map that owns its area, or to a new map.
  • Scope. frontend/, the Python shell in frappe/shell/, the desk v2 DocTypes, and the parts of ui/ that the desk calls. CRM and ERPNext only where they connect to the desk. Not the internals of frappe-ui.
  • Fixed inputs. The program principles on the root map are not re-opened: the three authored tiers (app, site, per-user), one UI API that drives every surface by name, UI-first customization over scripting, REST API v2 only, and the ui/ versus frontend/ layer rule. Everything below them can be questioned, including merged code and closed rulings. Each proposed cut names the ruling it re-opens.
  • Order of goals when they conflict. Security is never traded. User experience comes next. Speed is a budget, not a maximum: each page gets a first-paint time and a request count, and when a page meets its budget, simpler code wins over more speed.
  • Simple means few concepts, not few lines (user ruling, 2026-09-28). Code is simple when a new reader learns few names, finds one way to do each job, follows a flow through few files, sees each layer use only the layers below it, and does not reason about the order of async events. Simplicity is counted in concepts, pairs of mechanisms that do the same job, files per flow, layer breaks and cycles, and timing guards. Line count only shows where to look. It is never a budget and never a CI check, because a line budget pushes code to be dense.
  • ui/ is a library for every app (user rulings, 2026-09-28). Everything in ui/ must stand on its own, so any app can use it without the desk. ui/ may use only the framework server, REST API v2, and its own code: never frappe/shell/, frontend/, desk boot data or record-page words. ui/ is new, so no app uses its components or composables yet, but apps will. "No app uses it today" is never a reason to cut or change something in ui/. Judge ui/ by what it exports, not by what desk v2 imports.
  • Guardrails take three forms. A written rule gets a CI check where a check is possible. A rule with no check becomes a fixed question in every review brief. A whole-desk review runs each time a map closes.
  • The pause is lifted (2026-09-28). New build tickets on Desk v2 — one page model and Desk v2 — return visits paint at once were paused while the report was written, because both change the record page runtime. The hand-off task added their cut tickets and lifted the pause. On both maps the cut tickets come before any new build ticket.
  • Research does not move the shared checkout. Read code from upstream/desk-v2 or a git worktree add. A measurement that needs a server uses the worktree server on a spare port, never a switch of apps/frappe.
  • Skills: /research for research tickets, /grilling + /domain-modeling for grilling, /prototype for the diagram prototype, /frappe-app-dev + /code-style for any code, /quality-code-review in a fresh subagent before a build PR opens. Review briefs also ask: can this be done with fewer concepts or less code?

Decisions so far

Not yet specified

  • The build tasks for the diagram. Their shape waits on the diagram prototype. The CI checks are already tickets.
  • A possible defect from the report: a script's change can be credited to the wrong script. It needs a reproduction before it becomes a ticket. (The / address defect is fixed by accepted cut 23.)
  • Two translate functions. A planned ui/ change gives ui/ its own __, and the desk keeps __ and __n. Whether the desk's pair wraps ui/'s or stays apart is open; it is one of the pairs the guardrails count.

Out of scope

  • Doing the code cuts. They go to the maps that own each area.
  • Changing the program principles listed under Fixed inputs.
  • The internals of frappe-ui, and CRM or ERPNext code beyond the point where it connects to the desk.