<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Uncle Pushui on Medium]]></title>
        <description><![CDATA[Stories by Uncle Pushui on Medium]]></description>
        <link>https://medium.com/@cabloyjs?source=rss-764cf0ae2338------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*oXnhNuh0KFfXHRJ2</url>
            <title>Stories by Uncle Pushui on Medium</title>
            <link>https://medium.com/@cabloyjs?source=rss-764cf0ae2338------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:07:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cabloyjs/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[CabloyJS AI Spec-Driven Development Automatically Generates Gantt and Burndown Charts]]></title>
            <link>https://medium.com/@cabloyjs/cabloyjs-ai-spec-driven-development-automatically-generates-gantt-and-burndown-charts-5f4aee971a69?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f4aee971a69</guid>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[specs]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 07:38:03 GMT</pubDate>
            <atom:updated>2026-09-11T07:38:03.510Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0MhkFixXHkpwnxtU9fCW0w.png" /></figure><p>The easiest way to start AI coding is to describe a page or an API in a chat window. But once a project has multiple modules, multiple audiences, and an evolving frontend-backend contract, the genuinely difficult questions become: where does this change belong? Which boundaries have already been confirmed? How can we prove that it is actually complete?</p><p>CabloyJS includes two complementary Claude Code Skills that divide the work into two phases: first establish specification authority inside the repository, then execute a bounded delivery increment. This article introduces the two Skills, explains the Spec files they produce and consume, and uses real charts from the built-in a-commerce suite to show the result.</p><h3>Meet the two Skills first</h3><p>The two Skills are invoked as follows:</p><ul><li>cabloy-spec-generation: creates or maintains the suite planning records under repo-specs/&lt;suite&gt;/, establishing traceability among product, technical, delivery, and acceptance concerns.</li><li>cabloy-spec-execution: works from an existing specification to execute one explicit WBS-* item—or a finite, approved phase with a closed boundary—and records the actual verification results.</li></ul><p>The following table summarizes the difference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J--HK3B533dTHOvORsBIiw.png" /></figure><h3>1. Establish a specification baseline with generation</h3><p>In Claude Code, begin with a business description:</p><pre>/cabloy-spec-generation Plan an equipment-maintenance suite for field technicians and operations managers: include equipment records, work orders, asset history, role-based access control, and an Admin dashboard.</pre><p>The Skill first performs read-only discovery and asks for missing inputs. Its typical steps are:</p><ol><li>inspect the repository root, package.json, CLAUDE.md, and the edition marker;</li><li>distinguish a new suite from an extension of an existing suite, and check whether repo-specs/&lt;suite&gt;/ already exists;</li><li>independently evaluate whether Web and Admin should reuse an existing site or use a dedicated site;</li><li>collect product goals, roles, scope, module topology, tenancy and authorization, states, transactions, verification, and release constraints;</li><li>show a generation confirmation gate before writing planning records;</li><li>generate files in authority order, run exact-ID traceability checks, and produce two derived charts.</li></ol><h3>2. Execute a bounded increment with execution</h3><p>Once the specification is ready and a task’s dependencies are satisfied, invoke execution:</p><pre>/cabloy-spec-execution WBS-40-03</pre><p>WBS-40-03 is only an example. A real project should use an ID that actually exists in the target suite. The AI then follows this process:</p><ol><li>read README.md, the PRD, SRS, applicable ADRs, the complete WBS, ATP/test plan, progress, Evidence, and derived charts;</li><li>check the edition, current revision, workspace state, dependencies, blockers, unresolved TODOs, and whether previous evidence is still valid;</li><li>prepare an execution dossier listing the objective, scope, exclusions, authority IDs, source ownership, specialist-Skill routing, verification commands, and evidence format;</li><li>obtain explicit confirmation before routing into backend, frontend, or Contract Loop specialist workflows;</li><li>run the narrowest meaningful check first, followed by the ATP-required verification;</li><li>save Evidence containing the revision, environment, steps, results, and locations of sanitized artifacts;</li><li>update derived progress.md, regenerate and check the charts, and leave one unambiguous next action.</li></ol><pre>/cabloy-spec-execution Execute the next task in the equipment-maintenance suite</pre><p>If the next incremental WBS ID is unknown, ask the AI to first read the suite’s progress.md and combine it with the WBS, ATP, and existing Evidence to list executable WBS-* IDs whose dependencies are satisfied. The user can then confirm the specific item to execute next.</p><h3>What generation produces: a connected set of Spec files</h3><p>For a long-lived business suite, the default core output of cabloy-spec-generation is located at:</p><pre>repo-specs/&lt;suite&gt;/<br>├── README.md<br>├── prd.md<br>├── srs.md<br>├── pdp-wbs.md<br>├── test-plan.md<br>├── progress.md<br>├── implementation-gantt.svg<br>├── implementation-burndown.svg<br>└── decisions/<br>    └── 0001-&lt;suite-boundary-slug&gt;.md</pre><p>This is not simply one large document split into several files. It is a model of <strong>separated authority</strong>: each record owns one kind of fact, while the others refer to it through stable IDs and links.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tm2wvUXJZjHLlMNexnln9A.png" /></figure><h3>From business intent to evidence: how the files connect</h3><p>The core traceability chain is:</p><pre>PRD requirement<br>      ↓<br>SRS contract<br>      ↓<br>PDP/WBS task<br>      ↓<br>ATP scenario<br>      ↓<br>observed Evidence</pre><p>It can also be written more compactly:</p><pre>PRD → SRS → WBS → ATP → Evidence</pre><p>For example, a product requirement that “an authorized operator can view orders in the current tenant” must be made concrete in the SRS as identity, tenancy, authorization, data ownership, and API contracts. The WBS then defines the implementation boundary and dependencies; the ATP provides executable happy-path, unauthorized, and cross-tenant scenarios; finally, the actual runtime observations are saved as sanitized evidence.</p><p>When a task is executed, the document-state update order is:</p><pre>Upstream authority changes<br>  → traceability matrix<br>  → WBS dependencies and completion checks<br>  → ATP procedures and expected Evidence<br>  → progress / Evidence<br>  → two derived charts</pre><p>progress.md and both SVGs are downstream derived outputs. They help people and AI understand the current state quickly.</p><h3>How to read the two charts</h3><p>The charts are automatically generated by built-in scripts from pdp-wbs.md, test-plan.md, and progress.md.</p><h3>Gantt: inspect delivery order, not a calendar schedule</h3><p>The Gantt chart reads the formal phases, WBS tasks, dependencies, and progress statuses. It is useful for answering: what delivery packages exist? What is their approximate order? Which tasks depend on preceding phases?</p><p>The current chart for the built-in a-commerce suite contains 23 formal WBS tasks, all shown as 23/23 verified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kJ_TTjZt7mH8JNDDmjyWqg.png" /></figure><h3>Burndown: inspect scope counts, not velocity forecasts</h3><p>In the current a-commerce snapshot, the Burndown chart shows 23 active WBS items, 23 verified, 0 remaining, and 0 deferred.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9WMnG72OtioZN66MvkeWCg.png" /></figure><h3>When this approach is worthwhile</h3><p>This approach is best suited to enterprise systems that evolve over time, span modules, involve multiple collaborators, and include both Vona backend and Zova Admin/Web/SSR work — especially where tenancy, authorization, transactions, concurrency, auditability, or external integrations are important.</p><p>For a one-off page, a simple website, or a very small utility, a lightweight prompt-to-code workflow may be more economical.</p><h3>Start with a small increment</h3><p>Choose one clearly bounded capability rather than trying to plan an entire system at once:</p><ol><li>Use generation to plan the requirement.</li></ol><ul><li>Record goals, scope, and exclusions.</li><li>Confirm technical contracts, ownership, dependencies, and ATP.</li></ul><p>2. Use execution to deliver one WBS ID.</p><ul><li>Run applicable verification and save sanitized Evidence.</li><li>Update progress and the derived charts.</li></ul><p>3. Proceed to the next increment.</p><p>Create a Cabloy project from the public scaffolding:</p><pre>npm create cabloy<br>npm run dev<br>npm run dev:zova:admin<br>npm run dev:zova:web</pre><h3>Conclusion</h3><p>AI Spec-Driven Development in CabloyJS is not another way of saying “prompts become code.” It is a more concrete delivery path:</p><pre>Business intent → specification authority → bounded WBS → acceptance procedure → observed Evidence</pre><p>cabloy-spec-generation organizes intent into a traceable planning chain. cabloy-spec-execution advances one increment within confirmed boundaries. Together, they reduce the AI’s need to guess about business scope, technical ownership, and the definition of done.</p><h3>Further reading</h3><ul><li><a href="https://cabloy.com/ai/ai-spec-driven-development">AI Spec-Driven Development</a></li><li><a href="https://cabloy.com/ai/playbook-spec-generation">Generate a Cabloy Suite Specification</a></li><li><a href="https://cabloy.com/ai/playbook-spec-execution">Execute an Approved Cabloy Specification Increment</a></li><li><a href="https://cabloy.com/ai/verification">Verification</a></li><li><a href="https://cabloy.com/fullstack/contract-loop-playbook">Contract Loop Playbook</a></li><li><a href="https://cabloy.com/fullstack/vona-zova-integration">Vona + Zova Integration</a></li><li><a href="https://cabloy.com/fullstack/tutorials-overview">Cabloy Fullstack Quick Start Tutorials</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f4aee971a69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond IoC: CabloyJS as a Full-Stack Resource Addressing System]]></title>
            <link>https://medium.com/@cabloyjs/beyond-ioc-cabloyjs-as-a-full-stack-resource-addressing-system-ca31c62f4442?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca31c62f4442</guid>
            <category><![CDATA[open-api]]></category>
            <category><![CDATA[metadata-driven-framework]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Sun, 16 Aug 2026 06:39:07 GMT</pubDate>
            <atom:updated>2026-08-16T06:43:58.175Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YPJ6-80Yjmn_mFUmGtnnSg.png" /></figure><blockquote><em>IoC answers “how a runtime collaborator is obtained.” Full-stack resource addressing answers “which business capability this is, where it enters the system, how each layer locates it, and how it retains one business meaning.”</em></blockquote><p>In a new application, tracing a feature is usually straightforward: find a component, follow an import to its request function, then follow that function to a backend Controller. As a system grows into multiple business domains and modules — with admin resource pages, Web self-service pages, SSR, OpenAPI contracts, and frontend rendering resources — the harder question is no longer simply whether a Service can be injected.</p><p>Consider a Student capability. Which business domain owns it? Which module implements it? How does the backend expose it? How does a menu enter it? How does a generic Resource page know what it is displaying? And how do frontend requests, Schemas, permissions, forms, caches, and custom rendering continue to refer to the same business meaning?</p><p>IoC matters to all of those questions: it provides object ownership, lifecycle, scope, and dependency resolution. But Cabloy becomes more interesting when IoC is not viewed in isolation. Together with suites, modules, Bean identities, business Resources, OpenAPI, route parameters, selector-backed Models, and rendering metadata, it forms a set of <strong>constrained, mappable addressing coordinates</strong>.</p><p>This is not one universal string that travels through every layer, nor is it zero-configuration magic. Vona and Zova have independent runtime containers. Backend and frontend cooperate through contracts, metadata, generated artifacts, and build outputs. This article uses “full-stack resource addressing system” as a lens for understanding Cabloy architecture — not as the name of an official API that replaces existing terminology.</p><h3>Separate IoC from addressing first</h3><p>IoC asks a focused question: <strong>who creates, owns, disposes of, and supplies a runtime capability?</strong></p><p>In Zova, a Bean may be held in the sys, app, or ctx container scope. Code can use @Use for injection or use containers and Scope for dependency lookup. This single model keeps state sharing, lifecycle behavior, and cross-module collaboration from drifting into unrelated mechanisms. <a href="https://docs.cabloy.com/frontend/ioc-and-beans">IoC and Beans</a> explains that model in detail.</p><p>Addressing asks a broader question: <strong>when one layer needs something, which identity expresses the target, who resolves it, and what kind of resource results?</strong></p><p>The current repository’s Student sample includes related but non-interchangeable values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GqlGIPZJW1KdpPlckGrXgg.png" /></figure><p>Think of these as different coordinate systems for the same place: an administrative region, street, building number, navigation entry, delivery address, and room number are related, but they solve different problems. Calling them all an “ID” hides the boundaries that matter.</p><p>Let us follow training-student:student through the system.</p><h3>Coordinate one: suites and modules answer “who owns it?”</h3><p>Cabloy defines a <strong>suite</strong> as a business-domain composition boundary and a <strong>module</strong> as a feature implementation boundary within that domain. In other words:</p><ul><li>a suite answers, “which business domain does this group of capabilities belong to?”</li><li>a module answers, “within that domain, which capability owns this implementation?”</li></ul><p>In the Student sample, the domain is a-training and the module is training-student. Vona and Zova both have corresponding suite/module structures, so backend Controllers, Services, Models, Entities, and DTOs can evolve along the same business boundary as frontend pages, APIs, Models, and metadata. What is shared first is a <strong>business coordinate</strong>, not a block of memory shared by Node.js and the browser.</p><p>That is why a module name matters more than a directory position. Directories can be reorganized and implementation files can move, while a stable module namespace can continue to carry the logical identity of Services, Models, APIs, locales, errors, Resources, and frontend render resources. See <a href="https://docs.cabloy.com/fullstack/suites-and-modules">Suites and Modules</a> for the boundary between suites and modules.</p><h3>Coordinate two: Bean full names and the Scope facade</h3><p>At runtime, one module still needs to locate different families of capabilities. Most scene-based Vona Beans use this full identity:</p><pre>{moduleName}.{sceneName}.{beanName}</pre><p>For example:</p><pre>training-student.controller.student<br>training-student.service.student<br>training-student.model.student</pre><p>Here, sceneName distinguishes capability families such as controllers, services, and models. Two related facts must therefore remain separate:</p><ul><li>training-student:student is a module-qualified onion name;</li><li>training-student.service.student is a Bean full name whose scene has already been specified.</li></ul><p>An onion name is not merely a global Bean key with some characters omitted. A consumer must identify a scene such as service, model, or controller before the framework can resolve the corresponding full Bean name.</p><p>Business code usually does not need to write full names everywhere. Scope supplies a typed facade over module resources:</p><pre>// Business orchestration in the current module<br>const students = await this.scope.model.student.select();<br><br>// A known cross-module target<br>const sku = await this.$scope.commerceCatalog.model.sku.getById(id);</pre><p>Scope does not create another identity system. It raises a container-level full name into an everyday way to navigate a module’s resource catalog. Backend Scope can organize services, models, entities, configuration, locales, and errors; frontend Scope commonly exposes facades for configuration, constants, locales, errors, APIs, and API Schemas. Both <a href="https://docs.cabloy.com/backend/foundation">Vona Backend Foundation</a> and <a href="https://docs.cabloy.com/frontend/module-scope">Zova Module Scope</a> describe that division of responsibility.</p><p>There is an important limit: Scope lookup can resolve only resources from modules that have already been composed into the active application. A correct string does not install, load, or order an absent module. Module dependencies, suite/application composition, and runtime lookup are related but different concerns. The first establishes availability, ordering, and versioning; only then can the latter retrieve a resource from the composed modules.</p><h3>Coordinate three: @Resource() connects business identity to an HTTP contract</h3><p>The Student backend Controller uses @Controller(&#39;student&#39;) and @Resource(). This is a trimmed version of the current implementation, retaining only the roles relevant here:</p><pre>@Controller(&#39;student&#39;)<br>@Resource()<br>export class ControllerStudent extends BeanBase {<br>  @Web.get()<br>  @Api.body(DtoStudentSelectRes)<br>  async select(<br>    @Arg.filter(DtoStudentSelectReq) params: IQueryParams&lt;ModelStudent&gt;,<br>  ): Promise&lt;DtoStudentSelectRes&gt; {<br>    return await this.scope.service.student.select(params);<br>  }<br>}</pre><p>This is not just a class with two decorators. It connects at least three responsibilities:</p><ol><li>the Controller exposes an HTTP-facing action;</li><li>DTOs, Entity fields, and validation shape a machine-readable contract;</li><li>@Resource() registers the Controller’s onion identity as a business Resource.</li></ol><p>When Vona processes the Controller decorator, it derives the onion name from the Bean full name, combines module and controller-path metadata to compute the API path, and records the resource-to-route mapping. training-student:student can therefore remain a stable business Resource identity, while the HTTP path is a transport address derived from backend route metadata.</p><p>Avoid saying:</p><pre>training-student:student === /api/training/student</pre><p>A more accurate relationship is:</p><pre>training-student:student<br>  ──resolved through Resource registration and bootstrap metadata──▶<br>/api/training/student</pre><p>The first expresses <em>which business Resource</em> is involved; the second expresses <em>where the request goes</em>. This is one reason a Resource identity is often safer than scattering HTTP strings when frontend state, permissions, Schemas, or route context need to carry business meaning.</p><h3>Coordinate four: one field contract does not need to be copied into separate knowledge</h3><p>The value of resource addressing is not limited to finding an endpoint. It also allows one business contract to be recognized and projected by different consumers.</p><p>A backend field can participate in:</p><ol><li>validation;</li><li>OpenAPI generation;</li><li>form and table rendering;</li><li>serialization or desensitization.</li></ol><p>Take mobile from the Student Entity in training-student. This is a trimmed version of the current source:</p><pre>@Api.field(<br>  v.title($locale(&#39;Mobile&#39;)), // OpenAPI field title<br>  v.required(),               // validation<br>  v.min(11),                  // validation<br>  v.serializerReplace({       // response-time desensitization<br>    patternFrom: /^(\d{3})\d{4}(\d+)$/,<br>    patternTo: &#39;$1****$2&#39;,<br>  }),<br>  ZovaRender.order(3),        // display order for generic table and field surfaces<br>)<br>mobile: string;</pre><p>This declaration does not merely describe an isolated string. It is projected through DTOs and the Resource Schema: create, update, and view DTO layouts place { type: &#39;field&#39;, name: &#39;mobile&#39; } in Student Profile; the list-row Schema inherits the field and orders it through order(3). With no specialized Renderer, the generic form uses the default Input and the generic table uses a plain-text Cell. A query response with @Core.serializer() returns 13812345678 as 138****5678, while the persisted raw value remains unchanged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zX40PmAdhGoqYcmbLW_8sA.png" /></figure><p>If this field needs specialized controls instead of the default Renderer, it can additionally declare ZovaRender.field(&#39;training-student:formFieldLevel&#39;, ...) and ZovaRender.cell(&#39;training-student:level&#39;, ...), as level does in the same Entity. The point is not that every property must carry all four concerns or use a custom component. The point is that these concerns can be composed around the same field contract when they apply.</p><p>That does not mean each field automatically grows a complete UI, nor that every presentation decision belongs in the backend. It means the field’s business meaning, data contract, and permitted exposure do not have to be copied into backend DTOs, frontend request types, form rules, table columns, and response post-processing — and then manually kept aligned.</p><p>In this <strong>forward contract chain</strong>, backend Controllers, DTOs, Entities, and validation rules are the source of truth. Vona generates OpenAPI; Zova then generates or consumes SDK/Schema contract material. When a backend contract changes, the recommended path is to propagate that truth forward rather than hand-edit multiple frontend copies. <a href="https://docs.cabloy.com/fullstack/openapi-to-sdk">Backend OpenAPI to Frontend SDK</a> and <a href="https://docs.cabloy.com/fullstack/tutorial-6-one-contract-four-uses">One Contract Surface, Four Uses</a> describe the boundary of that chain.</p><h3>Coordinate five: routes choose a UI scene; Resource identities choose business context</h3><p>The generic Resource page makes clear why a page address and a business Resource identity need to remain separate.</p><p>rest-resource defines generic routes with dynamic parameters:</p><pre>export const routes: IModuleRoute[] = [<br>  { name: &#39;resource&#39;, path: &#39;:resource&#39;, component: ZPageResource },<br>  { name: &#39;entryCreate&#39;, path: &#39;:resource/create&#39;, component: ZPageEntryCreate },<br>  { name: &#39;entry&#39;, path: &#39;:resource/:id/:formScene?&#39;, component: ZPageEntry },<br>];</pre><p>Dynamic-parameter routes explicitly declare name, which establishes a type contract for page parameters. The route answers whether the active scene is a resource list, a create form, or a form scene for one record. The route itself does not yet know the business meaning of Student, Course, or any other Resource.</p><p>The Student SSR menu supplies that context:</p><pre>@SsrMenu({<br>  items: {<br>    student: {<br>      link: &#39;presetResource&#39;,<br>      meta: {<br>        params: {<br>          resource: &#39;training-student:student&#39;,<br>        },<br>      },<br>    },<br>  },<br>})<br>export class SsrMenuStudent extends BeanBase {}</pre><p>The menu does not directly render a Student page, nor does it grant authorization. It passes the resource parameter to the predefined generic Resource route:</p><pre>SSR menu<br>  → presetResource<br>  → :resource route parameter<br>  → Page Controller’s $params.resource</pre><p>The URL and route locate a page scene; $params.resource brings in business Resource context. Route names, route parameters, menu metadata, and permissions are still four separate objects that must each be verified.</p><h3>Coordinate six: the Resource identity becomes a selector-backed Model owner</h3><p>Once the generic page receives its parameter, it does not duplicate a page Controller for every Resource. It injects the current identity into one generic Model:</p><pre>@Controller()<br>export class ControllerPageResource extends BeanControllerPageBase {<br>  @Use({ beanFullName: &#39;rest-resource.model.resource&#39; })<br>  get $$modelResource(): ModelResource {<br>    return usePrepareArg(this.$params.resource, true);<br>  }<br><br>  protected async __init__() {<br>    await $QueryEnsureLoaded(() =&gt; this.$$modelResource.apiSchemasSelect.sdk);<br>  }<br>}</pre><p>There are two addresses at different levels:</p><pre>Generic Model Bean: rest-resource.model.resource<br>Current selector: training-student:student</pre><p>ModelResource is registered with enableSelector: true. It is not a vague global CRUD singleton; it is a selector-backed owner. ModelResource(training-student:student) and ModelResource(other-module:other-resource) can share an implementation while owning distinct Resource contexts.</p><p>During initialization, the owner requests bootstrap information with the Resource identity and stores the resolved resourceApi. It then centralizes permissions, form providers, view/create/update/filter/row/page Schemas, and list/item query and mutation capabilities in the same owner.</p><p>The conceptual chain is:</p><pre>$params.resource<br>  → ModelResource(resource selector)<br>  → bootstrap(resource)<br>  → resourceApi<br>  → schemas / permissions / forms / queries / mutations</pre><p>This has two practical benefits:</p><ul><li>a page does not need to copy the same API path, Schema-loading rule, permission lookup, and cache-invalidation policy into multiple Controllers;</li><li>a custom operation for the same Resource can be a thin semantic facade that reuses the existing Resource owner instead of creating a competing query-cache owner.</li></ul><p>For example, a training-student frontend Model can initialize the generic owner with training-student:student, then add semantic entry points for business actions such as summary(id) or deleteForce(id) while reusing that owner’s item query, mutation, and invalidation boundary.</p><p>One more distinction matters: a call-site value such as [&#39;select&#39;, ...] or [&#39;item&#39;, id, action] is only a logical query key. The effective cache identity also incorporates Model Bean identity and selector. A short query key is therefore not an address that is globally unique across the application. <a href="https://docs.cabloy.com/frontend/model-resource-internals-deep-dive">Model Resource Internals Deep Dive</a> and <a href="https://docs.cabloy.com/frontend/model-state-guide">Model State Guide</a> explain this owner/state identity layer.</p><h3>Coordinate seven: Schema metadata selects concrete UI capabilities</h3><p>A generic Resource Page stays deliberately thin: it loads the current Resource Schema, reads schemaRow?.rest?.blocks, and renders what the block metadata specifies. The page shell owns the question, “what is the current context?” Schema and metadata answer, “which blocks should this Resource compose in this scene?”</p><p>Where does schemaRow?.rest?.blocks come from? It is not an array assembled ad hoc by a frontend page. For the list page, the current Student sample defines it in the <strong>list-row DTO</strong> through @Dto({ blocks }):</p><pre>import type { IDecoratorDtoOptions } from &#39;vona-module-a-web&#39;;<br><br>import { $Dto } from &#39;vona-module-a-orm&#39;;<br>import { Dto } from &#39;vona-module-a-web&#39;;<br>import { ZovaRender } from &#39;zova-rest-cabloy-basic-admin&#39;;<br><br>import { ModelStudent } from &#39;../model/student.ts&#39;;<br><br>@Dto&lt;IDecoratorDtoOptions&gt;({<br>  blocks: [<br>    ZovaRender.block(&#39;basic-page:blockPage&#39;, {<br>      blocks: [<br>        ZovaRender.block(&#39;basic-page:blockFilter&#39;, {<br>          formFieldLayout: { inline: true },<br>          // The full sample also declares the filter form layout here.<br>        }),<br>        ZovaRender.block(&#39;basic-page:blockToolbarBulk&#39;, {<br>          actions: [ZovaRender.tableActionBulk(&#39;basic-table:actionCreate&#39;)],<br>        }),<br>        ZovaRender.block(&#39;basic-page:blockTable&#39;),<br>        ZovaRender.block(&#39;basic-page:blockPager&#39;),<br>      ],<br>    }),<br>  ],<br>})<br>export class DtoStudentSelectResItem extends $Dto.get(() =&gt; ModelStudent) {<br>  // List-row fields and each field’s ZovaRender.* metadata.<br>}</pre><p>This code is deliberately abbreviated. It retains the important structure: the root basic-page:blockPage composes registered frontend block resources for filtering, bulk toolbar actions, a table, and a pager. It does not mean every DTO should own these blocks, nor that the frontend implementations of those blocks live in Vona. The DTO declares, in backend-generated contract metadata, which rendering capabilities the current Resource list page should select.</p><p>The full chain that explains blocks is:</p><pre>DtoStudentSelectResItem’s @Dto({ blocks })<br>  → Vona merges blocks into the DTO OpenAPI metadata as rest.blocks<br>  → the GET select response’s data.list.items references the row DTO Schema<br>  → ModelResource.apiSchemasSelect.row resolves as schemaRow<br>  → schemaRow?.rest?.blocks<br>  → ControllerPageResource calls ZovaJsx.render(...) for each block</pre><p>In other words, schemaRow is the current select-response row Schema, and rest.blocks is the page-composition declaration attached to that Schema. basic-page:blockTable in ZovaRender.block(&#39;basic-page:blockTable&#39;) is another module-qualified render-resource identity, resolved by an implementation registered on the Zova side. The backend selects it; the frontend executes it. Neither side directly calls the other side’s objects across processes.</p><p>Cabloy resource addressing therefore does not stop at an API. Table cells, form fields, image scenes, and Behaviors can also be selected through module-qualified, scene-aware frontend resource identities. Field metadata can, for example, refer to training-student:formFieldLevel, which a registered frontend capability resolves and renders.</p><p>This does not mean backend code executes frontend components. More precisely, backend contracts or metadata can declare which frontend rendering resource should be selected at a point; the frontend still owns the renderer implementation and runtime. Frontend-owned facts such as routes, components, icons, table cells, and form fields also have a reverse contract handoff: refresh the frontend metadata/build output first, then let Vona consume the synchronized local dependency result. <a href="https://docs.cabloy.com/fullstack/frontend-metadata-to-backend">Frontend Metadata Back to Backend</a> describes that reverse chain.</p><p>The two directions are distinct:</p><pre>Forward: Vona Controller / DTO / Entity<br>  → OpenAPI<br>  → Zova SDK / Schema / API consumers<br><br>Reverse: Zova route / component / renderer / metadata<br>  → frontend metadata or build output<br>  → Vona-side metadata, tooling, and type consumers</pre><p>Together they support full-stack collaboration, but neither means that saving arbitrary source on one side automatically teaches the other side everything. Each chain has its own source of truth, generation step, shared handoff, and verification points.</p><h3>IoC’s actual position on this map</h3><p>Saying Cabloy is “more than IoC” does not diminish IoC. On the contrary, IoC is the runtime foundation that lets many of these coordinates work:</p><ul><li>a Bean’s container scope determines lifecycle and sharing boundaries;</li><li>@Use and beanFullName support explicit, resolvable collaboration;</li><li>Scope lets everyday business code access capabilities through a module-resource facade;</li><li>parameterized injection lets generic ModelResource be reused with the current Resource selector;</li><li>lifecycle and Model query/cache mechanisms turn “a resource was found” into “this owner is responsible for its state.”</li></ul><p>But treating this only as convenient dependency injection misses the larger collaboration structure. Business domains and modules assign capabilities an owner first; Bean/Scope gives runtime capabilities a resolution boundary; Resource and OpenAPI project a data contract for transport; route parameters bring context into a page; selectors and effective query keys isolate state to the current Resource.</p><blockquote><em>IoC makes a capability obtainable. Resource addressing makes that capability retain its business meaning after it crosses modules, contracts, routes, state, and rendering.</em></blockquote><h3>When this is useful — and when it should not be forced</h3><p>A multi-layer addressing system has a learning cost. Developers need to distinguish suites, modules, Beans, scenes, Resources, routes, selectors, Schemas, and generated artifacts. When debugging, they must begin from the correct coordinate instead of only searching for a component file.</p><p>It is usually most valuable for systems that evolve over time, have many modules or consumers, or need a clear contract loop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K3qZiF4X3CWGjTXNJy-OLw.png" /></figure><p>The final two rows are especially important. One business Resource can share a domain and persistence boundary between Admin and Web while using different API/DTO contracts, server-side scopes, state owners, and page architecture. Good resource addressing does not force everything into one generic CRUD page. It lets each boundary state clearly who it serves.</p><h3>Trace one Resource with seven questions</h3><p>To validate this mental model in an existing project, choose any registered Resource and follow it through these questions:</p><ol><li>Which suite/module owns it?</li><li>What is its business Resource identity?</li><li>Which Controller/DTO/Entity brings it into the backend contract?</li><li>Which menu, route name, and parameters bring it into a page?</li><li>Which Bean/Model owner receives it with which selector?</li><li>After bootstrap, where do resourceApi, Schemas, permissions, and render metadata come from?</li><li>Should this change follow the forward chain, the reverse chain, or first investigate generated/local dependency drift?</li></ol><p>The point is not to memorize more names. It is to break “why does this page work?” into a sequence of verifiable resolutions. Instead of asking only, “where is this component?”, you can ask: <strong>what is this Resource’s business identity, how is it mapped at this layer, and who owns its state and meaning?</strong></p><h3>Conclusion</h3><p>Cabloy does not rule every layer with one global ID. A more accurate description is that it uses the module as an important naming anchor and connects multiple address spaces — suite/module ownership, Bean scenes, Scope, business Resources, OpenAPI, route parameters, Model selectors, query caches, and render metadata — into a traceable full-stack chain.</p><p>IoC is one runtime foundation of that chain, but not the whole chain. The engineering benefit is that a business capability can cross backend and frontend, generated artifacts, and distinct runtimes without degrading into scattered URLs, repeated imports, hand-written requests, and disconnected state. Each layer retains its own responsibility and address while still mapping to the same business meaning.</p><h3>Further reading</h3><h3>Concepts and workflows</h3><ul><li><a href="https://docs.cabloy.com/fullstack/suites-and-modules">Cabloy: Suites and Modules</a></li><li><a href="https://docs.cabloy.com/backend/foundation">Cabloy: Vona Backend Foundation</a></li><li><a href="https://docs.cabloy.com/frontend/ioc-and-beans">Cabloy: Zova IoC and Beans</a></li><li><a href="https://docs.cabloy.com/frontend/module-scope">Cabloy: Zova Module Scope</a></li><li><a href="https://docs.cabloy.com/fullstack/openapi-to-sdk">Cabloy: Backend OpenAPI to Frontend SDK</a></li><li><a href="https://docs.cabloy.com/fullstack/frontend-metadata-to-backend">Cabloy: Frontend Metadata Back to Backend</a></li><li><a href="https://docs.cabloy.com/frontend/model-resource-internals-deep-dive">Cabloy: Model Resource Internals Deep Dive</a></li></ul><h3>Source samples verified for this article</h3><p>The implementation-level statements in this article were verified against Cabloy Basic revision <a href="https://github.com/cabloy/cabloy/tree/e8994f63dfffc7be2657cc4c7cb6687a89b63dec">e8994f63dfffc7be2657cc4c7cb6687a89b63dec</a>.</p><ul><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/vona/src/suite/a-training/modules/training-student/src/controller/student.ts">Student Resource Controller</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/vona/src/suite/a-training/modules/training-student/src/entity/student.tsx">Student Entity field-contract sample</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/vona/src/suite/a-training/modules/training-student/src/bean/ssrMenu.student.ts">Student SSR menu</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/decorator/bean.ts">Vona Resource-to-route mapping</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/routes.ts">Generic Resource routes</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/resource/controller.tsx">Generic Resource page controller</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts">ModelResource owner</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectResItem.tsx">Student select-row DTO blocks</a></li><li><a href="https://github.com/cabloy/cabloy/blob/e8994f63dfffc7be2657cc4c7cb6687a89b63dec/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/decorator/bean.ts">Vona DTO blocks to OpenAPI metadata bridge</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca31c62f4442" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Is AI So Good at React/Next.js, Yet Truly Useful Open-Source Next.js Projects Are Rare?]]></title>
            <link>https://medium.com/@cabloyjs/why-is-ai-so-good-at-react-next-js-yet-truly-useful-open-source-next-js-projects-are-rare-0b1446daef63?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b1446daef63</guid>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 06:48:35 GMT</pubDate>
            <atom:updated>2026-08-04T06:48:35.508Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z1qy-se56y20A_YXEKyOtA.png" /></figure><p>This is an interesting question because it exposes a distinction that is often blurred:</p><blockquote><strong><em>“AI is best at writing React/Next.js” does not mean “AI is best at building large Next.js projects.”</em></strong></blockquote><h3>1. React/Next.js really does have the most training material</h3><p>GitHub contains an enormous number of React/Next.js projects, tutorials, blog posts, and examples. As a result, AI performs exceptionally well on local development tasks involving components, Hooks, Tailwind, routing, Server Actions, and similar work.</p><p>But that does not mean AI has learned the overall architecture of enterprise applications.</p><h3>2. Most of what AI has learned is “local code”</h3><p>Training data contains large numbers of files such as:</p><ul><li>Button.tsx</li><li>LoginForm.tsx</li><li>UserTable.tsx</li><li>useFetch.ts</li></ul><p>It contains far fewer complete, long-lived ERP, CRM, e-commerce, or CMS systems.</p><p>Commercial projects are usually not open source, so the large-scale engineering examples available for AI to learn from are relatively limited.</p><h3>3. Much of the Next.js community is built around demos and starters</h3><p>Many high-star projects are essentially combinations of:</p><ul><li>Login</li><li>Blogs</li><li>Dashboards</li><li>Stripe payments</li><li>Prisma</li><li>Basic authentication</li></ul><p>They demonstrate a technology stack, rather than an enterprise system that has evolved over many years.</p><h3>4. Next.js itself is not an enterprise framework</h3><p>Next.js has always positioned itself as a React framework. It primarily addresses:</p><ul><li>Routing</li><li>Rendering</li><li>Builds</li><li>Images</li><li>Server Functions</li></ul><p>What makes enterprise applications genuinely complex is different:</p><ul><li>Permission systems</li><li>Multitenancy</li><li>Plugin mechanisms</li><li>Modularity</li><li>Workflows</li><li>Data permissions</li><li>Auditing</li><li>Messaging systems</li><li>Transactions</li><li>Internationalization</li></ul><p>Real projects therefore usually require a substantial surrounding stack as well.</p><h3>5. React’s greatest strength is also its greatest challenge</h3><p>React is highly flexible. You can freely combine:</p><ul><li>Redux, Zustand, MobX, and more</li><li>React Hook Form, TanStack Form, and more</li><li>SWR, TanStack Query, and more</li><li>Prisma, Drizzle, and more</li></ul><p>That rich ecosystem means there is no single best practice. It also means AI is more likely to learn many different styles than one unified architecture.</p><h3>6. The difficult part is architecture, not code</h3><p>AI can already generate CRUD and components quickly.</p><p>What is genuinely difficult is answering questions such as:</p><ul><li>Why are the modules split this way?</li><li>Why is the lifecycle designed this way?</li><li>Why does the permission model take this form?</li><li>Why is the plugin extension point located here?</li></ul><p>Those answers come from long-term practice and continuous evolution, not from code statistics alone.</p><h3>Summary</h3><p>A more accurate way to understand “AI is good at React” is:</p><blockquote><strong><em>AI is very good at completing React/Next.js code, but that does not mean it has learned to design large React/Next.js applications.</em></strong></blockquote><p>Rich training material improves local code generation. Mature enterprise systems, however, depend on long-term architectural design, accumulated business knowledge, and continuous evolution. That is also why truly strong, long-maintained, open-source Next.js projects are relatively uncommon.</p><h3>If Your Goal Is an Enterprise Fullstack System, Try CabloyJS</h3><p>The conclusion above is not that React or Next.js is bad. They remain excellent tools. If you need the React ecosystem, want to build pages quickly, or are working on a web application with well-bounded requirements, Next.js can be a very direct choice.</p><p>But when the goal shifts from “build an application” to “evolve an enterprise system for years,” generating components and endpoints is not enough. You also need a fullstack framework that can answer questions such as:</p><ul><li>Where should a business capability belong?</li><li>How can backend DTOs, OpenAPI, and frontend calls avoid becoming separate hand-maintained copies?</li><li>When a frontend resource changes, how do backend metadata or SSR consumers stay synchronized?</li><li>How can multiple business modules, Admin, Web, SSR, and SPA applications work together in one project?</li><li>How can AI-generated code follow the existing modules, commands, and verification paths instead of being assembled arbitrarily across the repository?</li></ul><p>Those are the problems <strong>CabloyJS</strong> aims to address.</p><p>CabloyJS is a Node.js fullstack framework system:</p><ul><li><strong>Vona</strong> provides backend runtime, business-service, data, and contract capabilities.</li><li><strong>Zova</strong> provides frontend application capabilities.</li><li><strong>Suites and modules</strong> give business domains and capabilities stable organizational boundaries.</li><li>The <strong>contract loop</strong> lets backend OpenAPI contracts generate frontend SDKs, while frontend resources and metadata can also return to the backend side through explicit handoff paths.</li><li>A <strong>CLI-first workflow</strong> makes creation, generation, builds, and verification discoverable and repeatable within the repository.</li></ul><p>Its value is not that AI can design your architecture for you. The real value is that, once a project has clear module boundaries, contract sources, generation paths, and verification requirements, AI no longer has to guess from a temporary prompt alone. It can participate within the same fullstack rules.</p><p>Of course, that also means CabloyJS is not the lightest choice. It requires learning the Vona, Zova, suite/module, and contract-loop models. For a one-off page, a simple site, or a project deliberately centered only on React/Next.js, staying lightweight may be the better choice.</p><p>But when you need a multi-module business system, long-term frontend/backend synchronization, Admin, Web, SSR, and SPA delivery, or want AI to do more than generate isolated code and gradually follow the collaboration rules of the whole repository, CabloyJS is worth trying.</p><h3>Start with a small experiment</h3><p>The public starting point for Cabloy Basic is:</p><pre>npm create cabloy</pre><p>After entering the generated project, start the backend:</p><pre>npm run dev</pre><p>You can also start Cabloy Basic’s Zova Admin or Web frontend separately:</p><pre>npm run dev:zova:admin<br>npm run dev:zova:web</pre><p>Then follow the <a href="https://docs.cabloy.com/fullstack/tutorials-overview">Cabloy Fullstack Quick Start Tutorials</a>. Start with a small module and experience how CRUD, frontend/backend contract sharing, and a fullstack workflow connect in practice.</p><p>If you are looking not for another component library or another Next.js starter, but for a framework built for enterprise fullstack collaboration, start with the <a href="https://docs.cabloy.com/fullstack/quickstart">Cabloy Fullstack Quickstart</a> and give CabloyJS a try.</p><h3>Further reading</h3><ul><li><a href="https://docs.cabloy.com/fullstack/introduction">Cabloy Fullstack Introduction</a></li><li><a href="https://docs.cabloy.com/fullstack/quickstart">Cabloy Fullstack Quickstart</a></li><li><a href="https://docs.cabloy.com/fullstack/suites-and-modules">Cabloy Suites and Modules</a></li><li><a href="https://docs.cabloy.com/fullstack/vona-zova-integration">Cabloy Vona + Zova Integration</a></li><li><a href="https://docs.cabloy.com/fullstack/contract-loop-playbook">Cabloy Contract Loop Playbook</a></li><li><a href="https://docs.cabloy.com/fullstack/tutorials-overview">Cabloy Fullstack Quick Start Tutorials</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b1446daef63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Turning Vue3 into a Tangle: From Scattered State to Object Collaboration with Zova]]></title>
            <link>https://medium.com/@cabloyjs/stop-turning-vue3-into-a-tangle-from-scattered-state-to-object-collaboration-with-zova-a6a3a292e90d?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6a3a292e90d</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[vue-3]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[state-management]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Sun, 02 Aug 2026 07:20:24 GMT</pubDate>
            <atom:updated>2026-08-02T07:20:24.003Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5v__QZRiImMfa2iXYnChqQ.png" /></figure><blockquote><em>Vue 3 remains the reactive foundation. Zova addresses a different question: how state, behavior, dependencies, and lifecycle gain clear ownership as an application grows.</em></blockquote><p>Vue 3 has been remarkably successful. It is lightweight, flexible, and built on an elegant reactive system. React and Angular continue to evolve as well, which naturally leads many developers to ask: what will help Vue remain compelling in the future?</p><p>One promising direction is not simply another round of debate about which state-management library to choose. It is a more fundamental question:</p><blockquote><em>As a real application becomes more complex, how should we organize state, behavior, and the relationships between them?</em></blockquote><p>Across many Vue 3 projects, I keep seeing a familiar pattern:</p><pre>const {<br>  list,<br>  loading,<br>  fetchList,<br>  createItem,<br>  removeItem,<br>} = useTodo();</pre><p>At first, this is wonderfully concise. But as a page and its business logic grow, friction starts to appear:</p><ul><li>One component consumes several composables, and the destructured variables keep accumulating.</li><li>You have to scan up and down the file to remember where list, loading, submit, or reset came from.</li><li>Names begin to collide, so prefixes spread everywhere: userList, orderList, todoList.</li><li>To avoid losing reactivity through destructuring, you need to remember rules around toRefs, storeToRefs, computed, and related helpers.</li><li>Pinia, provide/inject, composables, and component-local ref or reactive each solve part of the problem—but the developer must assemble the overall architecture.</li></ul><p>This is not an argument against destructuring, nor is it an argument that Vue 3’s Composition API is flawed. On the contrary: it is very powerful.</p><p>The real problem is this: <strong>as business complexity rises, code can drift from collaboration between objects toward assembly from individual variables.</strong></p><p>Once variables are scattered, ownership of state, boundaries of behavior, lifecycle, and dependencies can become scattered too.</p><p>That is the problem Cabloy/Zova aims to address.</p><h3>Vue reactivity is excellent — but application code should not become a pile of variables</h3><p>First, an important clarification:</p><blockquote><em>Vue is not a framework that must be written in an object-oriented style, and the Vue 3 Composition API is not an incorrect architectural approach.</em></blockquote><p>Vue 3 gives us an excellent reactive foundation. You can organize code with functions or with objects. You can use ref and reactive directly, or encapsulate them in composables, stores, or other abstractions.</p><p>The question is not whether functional or object-oriented programming is inherently more advanced. The question is:</p><blockquote><em>Does your business state and business behavior have clear, stable, and understandable ownership?</em></blockquote><p>A typical todo page may need:</p><ul><li>a list query, loading state, and error state;</li><li>create, update, and delete actions;</li><li>query caching and a refresh policy after mutations;</li><li>page input state;</li><li>page-rendering logic;</li><li>perhaps permissions, route parameters, and state shared across pages.</li></ul><p>If all of these are continually destructured from separate composables, the page can eventually look like this:</p><pre>const { todos, loading, refresh } = useTodos();<br>const { createTodo, creating } = useCreateTodo();<br>const { removeTodo, removing } = useRemoveTodo();<br>const { keyword, resetKeyword } = useSearch();<br>const { currentUser } = useAuth();</pre><p>Every line is reasonable in isolation. Together, though, the structure of the page becomes much less obvious.</p><ul><li>Who owns the todo list?</li><li>Who refreshes the list after a successful create?</li><li>Is loading for the query, or for the create operation?</li><li>Which state should survive across pages, and which belongs only to this page?</li><li>When another page needs the todo list, should you duplicate logic, extract a shared composable, or create a store?</li></ul><p>These are not syntax problems. They are <strong>architectural questions about state and behavior</strong>.</p><h3>A different perspective: put state and behavior back into objects</h3><p>Zova does not try to replace Vue 3’s reactive capabilities.</p><p>It does something else:</p><blockquote><em>On top of Vue 3 reactivity, Zova introduces Controllers, Beans, Models, and dependency injection so that state, behavior, lifecycle, and dependencies can again be organized as collaborating objects.</em></blockquote><p>Its three central characteristics can be summarized as:</p><blockquote><strong><em>Vue 3 reactivity + TSX rendering + Angular-style dependency injection</em></strong></blockquote><p>This is not a matter of transplanting Angular or React into Vue. It combines what each approach does well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*2P-q1Ut0IxSzj91KxO-Epg.png" /></figure><p>Instead of first asking, “Which composable should contain this logic?”, a developer can ask a more natural question:</p><blockquote><em>Who should own this state and behavior?</em></blockquote><h3>A page is an object with a responsibility</h3><p>Suppose we are building the simplest possible counter page.</p><p>In Zova, it can look like this:</p><pre>@Controller()<br>export class ControllerPageCounter extends BeanControllerPageBase {<br>  count = 0;<br><br>  get countText() {<br>    return `Current count: ${this.count}`;<br>  }<br><br>  increment() {<br>    this.count++;<br>  }<br><br>  protected render() {<br>    return (<br>      &lt;div&gt;<br>        &lt;div&gt;{this.countText}&lt;/div&gt;<br>        &lt;button onClick={() =&gt; this.increment()}&gt;<br>          Increment<br>        &lt;/button&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><p>The important part of this code is not simply that it uses a class. It expresses the business meaning directly:</p><ul><li>count is state owned by this page.</li><li>increment() is behavior provided by this page.</li><li>countText is display data derived from that state.</li><li>render() describes how the page is presented.</li><li>Everything is organized around one object.</li></ul><p>You do not first create ref(0), return a group of values, and destructure them at the call site:</p><pre>const { count, increment } = useCounter();</pre><p>You use the object’s state and behavior directly:</p><pre>this.count<br>this.increment()</pre><p>This is a small but significant difference: <strong>state no longer floats in a function return value; it clearly belongs to an object.</strong></p><p>Of course, count is not reactive because class fields are inherently reactive.</p><p>The actual mechanism is that Zova creates the Controller as a container-managed Bean and connects it to Vue’s reactivity underneath. When this.count++ runs, rendering that depends on it updates just as it would with ordinary Vue reactive code.</p><p>In other words:</p><blockquote><em>Object-oriented design organizes the code; Vue 3 makes the state inside those objects reactive.</em></blockquote><h3>Do not destructure everything: keep dependencies visible in the code</h3><p>The real challenge of many complex pages is not the UI. It is the collaboration between multiple business capabilities.</p><p>For example, a todo page needs a todo data model. In a conventional Vue project, that might be:</p><ul><li>a composable;</li><li>a Pinia store;</li><li>a group of API functions plus several refs;</li><li>or a mixture of all of the above.</li></ul><p>In Zova, it can be expressed explicitly as a Model:</p><pre>@Model()<br>export class ModelTodo extends BeanModelBase {<br>  findAll() {<br>    return this.$useStateData({<br>      queryKey: [&#39;list&#39;],<br>      queryFn: async () =&gt; {<br>        return await this.scope.api.todo.findAll();<br>      },<br>    });<br>  }<br><br>  create() {<br>    return this.$useMutationData({<br>      mutationKey: [&#39;create&#39;],<br>      mutationFn: async body =&gt; {<br>        return await this.scope.api.todo.create(body);<br>      },<br>      onSuccess: () =&gt; {<br>        this.$invalidateQueries({ queryKey: [&#39;list&#39;] });<br>      },<br>    });<br>  }<br>}</pre><p>ModelTodo is not merely an API utility class.</p><p>It owns a coherent set of responsibilities:</p><ul><li>todo queries;</li><li>query-cache identity;</li><li>create operations;</li><li>state during creation;</li><li>list invalidation and refresh policy after a successful create.</li></ul><p>The page Controller can then inject it:</p><pre>@Controller()<br>export class ControllerPageTodo extends BeanControllerPageBase {<br>  @Use()<br>  $$modelTodo: ModelTodo;<br><br>  get queryTodos() {<br>    return this.$$modelTodo.findAll();<br>  }<br><br>  async addTodo() {<br>    await this.$$modelTodo.create().mutateAsync({<br>      title: &#39;Learn Zova&#39;,<br>    });<br>  }<br><br>  protected render() {<br>    const todos = this.queryTodos.data ?? [];<br><br>    return (<br>      &lt;div&gt;<br>        &lt;button onClick={() =&gt; this.addTodo()}&gt;<br>          Create todo<br>        &lt;/button&gt;<br><br>        &lt;ul&gt;<br>          {todos.map(item =&gt; (<br>            &lt;li key={item.id}&gt;{item.title}&lt;/li&gt;<br>          ))}<br>        &lt;/ul&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><p>There is an important reading experience in these lines:</p><pre>this.$$modelTodo.findAll()<br>this.$$modelTodo.create()</pre><p>You can see immediately that:</p><ul><li>these capabilities come from ModelTodo;</li><li>the page depends on the todo model;</li><li>query and write logic are not scattered throughout the page;</li><li>there is a specific object to inspect when you need to understand caching, requests, or invalidation.</li></ul><p>That is the value of dependency injection. It is not merely a way to write fewer imports. It makes dependencies between objects explicit, stable, and traceable.</p><h3>Pinia, provide/inject, and composables: not three kinds of “state management,” but fragments of one question</h3><p>Common ways to organize state in the Vue ecosystem include:</p><ul><li>component-local ref / reactive;</li><li>composables;</li><li>Pinia;</li><li>provide/inject;</li><li>data-fetching and caching libraries.</li></ul><p>They are all valuable, and each fits particular situations.</p><p>For beginners, though, they can create a recurring question:</p><blockquote><em>When should I use a composable? When should I use Pinia? When should I use </em><em>provide/inject? When should the state remain in the component?</em></blockquote><p>Zova offers a different starting point: do not begin with a tool name. Begin with <strong>state ownership and lifecycle</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*ad1fd-itXab80-lwDoiSaA.png" /></figure><p>Concepts that may otherwise be spread across several tools can gradually become one mental model:</p><blockquote><strong><em>Do not first decide which library should hold state. First decide which object owns it, how long it should live, and who depends on it.</em></strong></blockquote><p>That shifts the architectural discussion from technology selection back toward business modeling.</p><h3>“Object-oriented” does not mean writing Java-style frontend code</h3><p>When developers see class, @Controller(), @Model(), and @Use(), a common concern is:</p><blockquote><em>Will this become over-engineering?<br>Will it turn into layers of traditional Java-style wrappers?</em></blockquote><p>The answer depends on how the system is used.</p><p>Zova does not require you to split everything into many classes from the beginning. A small page can be just one Controller:</p><pre>@Controller()<br>export class ControllerPageProfile extends BeanControllerPageBase {<br>  nickname = &#39;&#39;;<br><br>  save() {<br>    // Save the nickname.<br>  }<br><br>  protected render() {<br>    return (<br>      &lt;input<br>        value={this.nickname}<br>        onInput={event =&gt; {<br>          this.nickname = event.target.value;<br>        }}<br>      /&gt;<br>    );<br>  }<br>}</pre><p>Only when responsibilities genuinely grow do you split them gradually:</p><ol><li><strong>The page becomes complex</strong>: extract a Render Bean.</li><li><strong>Styling becomes complex</strong>: extract a Style Bean.</li><li><strong>Business behavior becomes reusable</strong>: extract a Service Bean.</li><li><strong>Data needs caching, reuse, persistence, or SSR coordination</strong>: extract a Model.</li></ol><p>This is not object orientation for its own sake. It lets code grow with the business.</p><p>A good architecture should not require developers to design a perfect class diagram on day one. It should let them start simply and provide a clear evolution path when complexity actually arrives.</p><h3>TSX brings rendering and behavior closer together</h3><p>Zova uses TSX as its main rendering expression.</p><p>That does not mean Vue templates are bad. Templates are friendly for simple pages and have a mature ecosystem.</p><p>But as business UI becomes more complex, TSX has a practical advantage: <strong>rendering logic and TypeScript logic are expressed in the same language.</strong></p><p>Conditions, loops, local variables, event handling, and component composition can all live naturally in the same code:</p><pre>protected render() {<br>  const query = this.$$modelTodo.findAll();<br><br>  if (query.isPending) {<br>    return &lt;div&gt;Loading…&lt;/div&gt;;<br>  }<br><br>  if (query.isError) {<br>    return &lt;div&gt;Loading failed. Please try again later.&lt;/div&gt;;<br>  }<br><br>  return (<br>    &lt;ul&gt;<br>      {query.data?.map(todo =&gt; (<br>        &lt;li key={todo.id}&gt;<br>          &lt;span&gt;{todo.title}&lt;/span&gt;<br>          &lt;button onClick={() =&gt; this.removeTodo(todo.id)}&gt;<br>            Delete<br>          &lt;/button&gt;<br>        &lt;/li&gt;<br>      ))}<br>    &lt;/ul&gt;<br>  );<br>}</pre><p>Here:</p><ul><li>it is clear which Model provides the data;</li><li>it is clear which behavior the click invokes;</li><li>it is clear how the page branches on state;</li><li>it is clear how TypeScript types flow through the code.</li></ul><p>For developers accustomed to complex business logic and rich component composition, this continuity of logic, state, and rendering within one object can provide a strong sense of control.</p><h3>Zova does not reject Vue; it adds a more complete application language on top of it</h3><p>On the surface, Zova may look like Vue 3 plus classes, decorators, an IoC container, and Models.</p><p>A more accurate description is that it offers a more unified language for frontend application architecture:</p><ul><li><strong>Controllers</strong> express interactive responsibilities of pages and components.</li><li><strong>Beans</strong> express composable, injectable capabilities.</li><li><strong>Models</strong> express data state with lifecycle, caching, and invalidation policy.</li><li><strong>IoC</strong> expresses object creation, scope, and dependencies.</li><li><strong>Vue 3 reactivity</strong> keeps state changes and UI updates naturally connected.</li><li><strong>TSX</strong> lets rendering and logic collaborate in one language.</li></ul><p>So Zova is not saying:</p><blockquote><em>“Vue 3’s Composition API is not good enough.”</em></blockquote><p>It is closer to saying:</p><blockquote><em>“When a project grows from a component into a business application, we need more than composable functions. We need clear object boundaries, dependencies, and state ownership.”</em></blockquote><h3>Closing: from “how do we manage state?” to “who owns this state?”</h3><p>Frontend development has spent years discussing state management.</p><p>But sometimes we start with the wrong question.</p><p>We often ask:</p><ul><li>Should we use Pinia or composables?</li><li>Where should global state live?</li><li>How do we avoid prop drilling?</li><li>How do we cache data fetching automatically?</li></ul><p>Those questions matter. But behind them sits one more fundamental set of questions:</p><blockquote><em>Who owns this state?<br>Who is allowed to change it?<br>Who depends on it?<br>How long should it live?<br>When it changes, who is responsible for preserving consistency?</em></blockquote><p>When those questions have clear answers, the choice of tools often becomes much easier.</p><p>That is the experience Cabloy/Zova aims to provide:</p><blockquote><em>Do not let business code become a collection of variables that have been destructured, moved around, and assembled.<br>Put state back into objects, behavior back into responsibilities, and dependencies back into structure.</em></blockquote><p>If you already know Vue 3, try writing one small Zova feature: one Controller, one Model, and a few TSX expressions. You may find that Vue 3 reactivity still feels familiar — but organizing a complex business feature no longer feels like untangling a knot.</p><h3>Further reading</h3><ul><li><a href="https://docs.cabloy.com/frontend/foundation">Zova Frontend Foundation</a></li><li><a href="https://docs.cabloy.com/frontend/reading-zova-for-vue-developers">Reading Zova for Vue Developers</a></li><li><a href="https://docs.cabloy.com/frontend/zova-vs-vue3-comparison">Zova vs Vue 3 Comparison</a></li><li><a href="https://docs.cabloy.com/frontend/ioc-and-beans">IoC and Beans</a></li><li><a href="https://docs.cabloy.com/frontend/state-architecture-for-vue-developers">State Architecture for Vue Developers</a></li><li><a href="https://docs.cabloy.com/frontend/model-architecture">Model Architecture</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6a3a292e90d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NestJS vs CabloyJS Env and Config Architecture: From Environment Variables to Instance-Aware…]]></title>
            <link>https://medium.com/@cabloyjs/nestjs-vs-cabloyjs-env-and-config-architecture-from-environment-variables-to-instance-aware-695be50c411e?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/695be50c411e</guid>
            <category><![CDATA[cabloyjs]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[vonajs]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 07:46:31 GMT</pubDate>
            <atom:updated>2026-07-30T07:46:31.430Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cZzmmmf7f4P7s7PoDZMw3Q.png" /></figure><h3>NestJS vs CabloyJS Env and Config Architecture: From Environment Variables to Instance-Aware Configuration</h3><blockquote><em>The hard part is not reading </em><em>.env. It is deciding where a value comes from, what can override it, when configuration becomes available, and which configuration a request should finally see.</em></blockquote><p>A single .env file is usually enough for a small service: a port, a database URL, and a Redis password. Once deployment shapes, test isolation, module reuse, customer-specific behavior, or multi-tenancy enter the picture, configuration stops being a list of variables. It becomes part of the runtime architecture.</p><p>This article compares NestJS @nestjs/config <strong>4.0.4</strong> with the current Cabloy Basic Vona backend. The short version is: <strong>NestJS provides composable application-configuration tools; CabloyJS/Vona organizes mode, flavor, module configuration, and instance-effective configuration into one framework-level chain.</strong></p><h3>The short conclusion</h3><p>DimensionNestJS @nestjs/configCabloyJS / VonaPrimary roleA composable application-configuration toolkitPart of a layered runtime and configuration modelEnvironment selectionThe app declares .env paths and loading policyThe CLI selects mode/flavor, then resolves cascading env/config layersRuntime validationJoi / custom validate entry pointsStrong config shapes; no equivalent centralized validation phase in the core startup pathModule ownershipregisterAs(), load, forFeature()Module config resource plus project config.modules[...] overridesRequest-level variationThe app composes tenant/request configuration itselfctx.config exposes merged, instance-effective configuration</p><p>Both systems can consume environment variables. The difference is the question they prioritize: NestJS focuses on how an application composes configuration capabilities; Vona focuses on whether configuration belongs to the application, a module, or an active instance.</p><h3>NestJS: a composable model centered on process.env</h3><p>NestJS typically begins with ConfigModule.forRoot(): it reads env files, combines them with existing process.env, and provides ConfigService. An application can independently choose Joi schemas, a synchronous custom validate(), configuration factories, namespaces, caching, and variable expansion.</p><pre>ConfigModule.forRoot({<br>  isGlobal: true,<br>  envFilePath: [&#39;.env.production.local&#39;, &#39;.env.production&#39;],<br>  validationSchema: Joi.object({<br>    PORT: Joi.number().port().required(),<br>  }),<br>});</pre><p>Two precedence rules must be kept separate. With multiple envFilePath entries, earlier files take priority. Values already injected into process.env before startup override matching values from those files by default. This works well for Docker, Kubernetes, and CI/CD: an image can supply defaults while platform secrets or command-line injection retain deployment priority. If production should trust only externally injected variables, use ignoreEnvFile: true.</p><p>That env-loading order is not the same as the lookup order of ConfigService.get(). In 4.x, get() checks internal custom configuration first, then validated environment configuration, then falls back to process.env and the caller&#39;s default. In other words, “process environment overrides .env” does not mean it always overrides configuration created with registerAs().</p><p>NestJS’s major strength is <strong>startup-time validation</strong>. validationSchema and validate() can reject an invalid port, a missing database endpoint, or an unsafe production flag while the application starts, and they can turn string input into numbers or booleans at that boundary. The generic in ConfigService.get&lt;number&gt;(&#39;PORT&#39;) does not perform runtime conversion by itself.</p><p>registerAs() can also give database, authentication, or messaging configuration an explicit namespace and support typed injection through ConfigType&lt;typeof config&gt;:</p><pre>export const databaseConfig = registerAs(&#39;database&#39;, () =&gt; ({<br>  host: process.env.DATABASE_HOST,<br>  port: Number(process.env.DATABASE_PORT ?? 5432),<br>}));</pre><pre>constructor(<br>  @Inject(databaseConfig.KEY)<br>  private readonly database: ConfigType&lt;typeof databaseConfig&gt;,<br>) {}</pre><p>Together with ConfigModule.forFeature(databaseConfig), configuration can be registered with a feature module instead of accumulating in the root module. Partial registration has a lifecycle boundary, however: reading another module&#39;s configuration too early in a constructor can happen before that target module initializes. In that case, defer the read to a safer lifecycle boundary such as onModuleInit(). Also, cache: true primarily caches ConfigService reads of process.env; it is not a universal configuration or remote-configuration cache.</p><h3>Vona: configuration as a runtime chain</h3><p>Vona does not start with a standalone configuration package. It starts with runtime dimensions established by the CLI:</p><ul><li>META_MODE, such as dev, test, and prod;</li><li>META_FLAVOR, such as normal, docker, and ci, or a project-defined flavor.</li></ul><p>The CLI derives NODE_ENV from mode and normalizes SERVER_WORKERS: production defaults to the CPU count, while non-production defaults to 1. Mode and flavor are therefore framework runtime inputs determined before application startup, not strings scattered through business code.</p><h3>Both env and project config cascade</h3><p>For prod + docker, env files can follow a chain like this:</p><pre>.env → .env.prod → .env.prod.docker<br>     → .env.local / .env.prod.local / .env.prod.docker.local</pre><p>.local is the highest-priority local override layer. When Vona produces the final runtime env object, pre-existing process.env values can still override matching keys. Project config follows the same model: config.ts → mode → flavor → local. The selected config functions may run asynchronously and are then deep-merged in deterministic order, translating env input into structured server, logger, Redis, and database configuration.</p><p>This gives local development, Docker builds, CI, and externally injected deployment values one explainable precedence model rather than several unrelated startup scripts.</p><h3>Module defaults and project overrides have explicit ownership</h3><p>A Vona module can define reusable defaults in src/config/config.ts; the project overrides them through config.modules[&#39;module-name&#39;]:</p><pre>module default config → current project&#39;s config.modules[module-name]</pre><p>The current module reads configuration through this.scope.config; another module&#39;s configuration is available through this.$scope.&lt;module&gt;.config. Configuration is therefore a module resource alongside service, model, entity, and locale resources. Module authors own reusable defaults, while the project owns deployment- and product-specific policy. In a system that reuses suites and modules, this is easier to audit than an informal rule that every key comes from one global service.</p><h3>ctx.config is the distinguishing layer</h3><p>app.config is the global application baseline. Once a request enters an instance context, ctx.config is that instance&#39;s effective configuration:</p><pre>app.config<br>  → static instance configuration<br>  → configuration persisted on the instance record<br>  → ctx.config</pre><p>This does not mean NestJS cannot support multi-tenancy. A NestJS application can build equivalent business capabilities with request-scoped providers, middleware, and its own tenant configuration service. The difference is architectural ownership: a typical NestJS project designs tenant resolution, configuration merging, and datasource routing itself; Vona lets instance resolution, effective configuration, startup, and datasource behavior share one runtime model.</p><p>When multi-instance deployments, instance isolation, or customer-level variation are recurring requirements, that shared model reduces the drift caused by every module interpreting the tenant independently. If a service will always have one application-wide configuration, the additional flavor and instance vocabulary can also be unnecessary overhead.</p><h3>The key distinction: type safety is not runtime validation</h3><p>Vona configuration functions and module metadata infer configuration shapes. scope.config therefore provides strong type guidance and helps prevent misspelled fields or invalid cross-module access. But the current central env/config startup path does not provide a single runtime validation stage equivalent to NestJS validationSchema or validate().</p><p>A Vona project should still treat ports, databases, external credentials, and production safety switches as startup contracts, and validate them explicitly in project config or a dedicated startup-validation boundary. Conversely, a NestJS project should not turn every domain setting into an unowned ConfigService.get(&#39;...&#39;) string lookup merely because it uses Joi.</p><p>A more durable layering model is:</p><ol><li>env is external, string-based deployment input;</li><li>a validation boundary rejects invalid input and performs conversions;</li><li>project config organizes application-level runtime structure;</li><li>module config owns defaults and reusable capability;</li><li>behavior that differs per instance has an explicit request-level effective configuration.</li></ol><p>NestJS provides mature tools for point 2. Vona provides fuller framework conventions for points 3, 4, and 5. CabloyJS’s value is not replacing a dotenv package; it is turning configuration into runtime architecture that can be understood and audited as one chain.</p><h3>How to choose</h3><p>Choose NestJS @nestjs/config when the service is primarily a conventional application with few deployment shapes, and the team values explicit env validation and freedom to compose factories, namespaces, and providers.</p><p>Choose — or benefit from — CabloyJS/Vona when a project repeatedly needs mode/flavor-driven builds and deployments, reusable suite/module defaults with project overrides, and instance-effective configuration. It asks the team to learn more runtime vocabulary, but prevents them from reinventing configuration rules for every module, tenant, and deployment shape.</p><h3>Sources and implementation references</h3><h3>NestJS</h3><ul><li><a href="https://docs.nestjs.com/techniques/configuration">NestJS Configuration documentation</a></li><li><a href="https://docs.nestjs.com/techniques/configuration#custom-env-file-path">NestJS: Custom env file paths</a></li><li><a href="https://docs.nestjs.com/techniques/configuration#configuration-namespaces">NestJS: Configuration namespaces</a></li><li><a href="https://docs.nestjs.com/techniques/configuration#partial-registration">NestJS: Partial registration</a></li><li><a href="https://github.com/nestjs/config/releases/tag/4.0.4">@nestjs/config 4.0.4 release</a></li><li><a href="https://github.com/nestjs/config/blob/4.0.4/lib/config.module.ts">@nestjs/config 4.0.4 </a><a href="https://github.com/nestjs/config/blob/4.0.4/lib/config.module.ts">ConfigModule source</a></li><li><a href="https://github.com/nestjs/config/blob/4.0.4/lib/config.service.ts">@nestjs/config 4.0.4 </a><a href="https://github.com/nestjs/config/blob/4.0.4/lib/config.service.ts">ConfigService source</a></li></ul><h3>CabloyJS / Vona</h3><ul><li><a href="https://docs.cabloy.com/backend/runtime-and-flavors">Vona Backend Runtime and Flavors</a></li><li><a href="https://docs.cabloy.com/backend/config-guide">Vona Config Guide</a></li><li><a href="https://docs.cabloy.com/backend/multi-instance-and-instance-resolution">Vona Multi-Instance and Instance Resolution</a></li><li><a href="https://github.com/cabloy/cabloy/blob/b4efd76d2800d23750166f626b77d107ac04866b/vona/packages-utils/dotenv/src/index.ts">Vona env loader, version verified for this article</a></li><li><a href="https://github.com/cabloy/cabloy/blob/b4efd76d2800d23750166f626b77d107ac04866b/vona/packages-vona/vona-core/src/lib/module/config.ts">Vona module config merge, version verified for this article</a></li><li><a href="https://github.com/cabloy/cabloy/blob/b4efd76d2800d23750166f626b77d107ac04866b/vona/src/suite-vendor/a-vona/modules/a-instance/src/service/instance.ts">Vona instance-effective config merge, version verified for this article</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=695be50c411e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Frontends Still Need Wrapping After Hooks]]></title>
            <link>https://medium.com/@cabloyjs/why-frontends-still-need-wrapping-after-hooks-d5f376ac859d?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5f376ac859d</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 05:02:03 GMT</pubDate>
            <atom:updated>2026-07-18T05:02:03.135Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uRNZLIaB-qtNef6E3FNd3g.png" /></figure><blockquote><em>Hooks replaced many inappropriate HOC use cases. They did not remove the need to apply independent rules around an existing rendering target.</em></blockquote><p>When we ask whether HOCs are obsolete, it is easy to mix up two different questions:</p><ol><li>How should components reuse <strong>internal</strong> state, requests, subscriptions, and interaction logic?</li><li>How should an application independently handle props, refs, layout, and presentation policies <strong>around the rendering boundary</strong> of an existing component or native element?</li></ol><p>For the first question, a custom Hook is usually the right starting point today. If an HOC only moves useQuery, useEffect, or useState outward and passes the result back through props, it often adds little more than another component layer and prop forwarding.</p><p>The second question did not disappear with Hooks. The key is not whether a few lines of code <em>can</em> live inside a component. It is this:</p><blockquote><em>Should this rule be owned by the target component itself, or should it remain an optional, replaceable, and composable rendering policy?</em></blockquote><h3>Hooks are for reusing internal logic</h3><p>Custom Hooks are the natural modern React mechanism for reusing stateful and side-effectful logic. If several components need to subscribe to online status, for example, that subscription can live in useOnlineStatus(). Each calling component still decides how to use the result and what UI to render.</p><p>The ownership stays inside the caller’s boundary: the component uses the data, handles the interaction, and owns the final output. A Hook does not introduce a new UI boundary, which is why it fits data access, state, subscriptions, and event handling so well.</p><p>This also explains why many classic HOCs now feel cumbersome: they were often used for internal logic reuse that a Hook can express more directly.</p><p>A Hook, however, is not a universal syntax for wrapping rendering elsewhere. If a requirement needs to alter props passed to a target, intercept a ref, or place the rendered result inside a shared layout, it is dealing with a different boundary.</p><h3>Start with React: what does an autofocus HOC solve?</h3><p>Consider an input that should receive focus after it mounts. If we want that behavior to be attachable to multiple input-compatible components, a traditional React HOC might look like this:</p><pre>function withAutoFocus(WrappedInput) {<br>  return React.forwardRef(function AutoFocus(props, outerRef) {<br>    const inputRef = React.useRef(null);<br><br>    React.useEffect(() =&gt; {<br>      inputRef.current?.focus();<br>    }, []);<br><br>    return (<br>      &lt;WrappedInput<br>        {...props}<br>        ref={node =&gt; {<br>          inputRef.current = node;<br><br>          if (typeof outerRef === &#39;function&#39;) {<br>            outerRef(node);<br>          } else if (outerRef) {<br>            outerRef.current = node;<br>          }<br>        }}<br>      /&gt;<br>    );<br>  });<br>}</pre><p>Used like this:</p><pre>const AutoFocusInput = withAutoFocus(TextInput);<br><br>&lt;AutoFocusInput placeholder=&quot;Enter something&quot; /&gt;</pre><p>This works, and the requirement it expresses is perfectly valid: <strong>add a “focus after mount” rule to a render target without changing </strong><strong>TextInput itself.</strong></p><p>It also exposes the cost of the classic HOC expression:</p><ul><li>it creates a new component type;</li><li>if callers need the input node, it must deliberately preserve the outer ref contract;</li><li>the wrapped component must support the relevant ref contract too;</li><li>production HOCs often also need to consider debugging names and static properties.</li></ul><p>So the useful conclusion is not that HOCs can never be used. It is that <strong>an HOC is rarely the first choice when the goal is only to reuse internal stateful logic; when the rule really belongs at a rendering boundary, it is still describing a real problem.</strong></p><h3>The decision test: who owns this rule?</h3><p>When a requirement should be reused, start with three questions:</p><ol><li>Is it intrinsic behavior of the target component, or a policy needed only in certain contexts?</li><li>Should callers be able to attach, remove, or combine the rule independently?</li><li>Does it need to alter render input, a ref, output structure, or presentation around the target?</li></ol><p>The answers point to different abstractions:</p><ul><li>If the rule is intrinsic to the component, keep it inside the component, using a Hook where appropriate.</li><li>If it must expose a stable, standalone UI contract, make it a normal component.</li><li>If it only transforms data and has no rendering concern, use a pure helper.</li><li>If it intercepts or wraps an existing render target and must compose independently, it needs some form of wrapping capability.</li></ul><p>React HOCs, other wrappers, and Cabloy/Zova Behaviors are different implementations of that last category. They are not the same runtime mechanism, but they all address cases where a rule should not be fused into its target.</p><h3>Zova Behavior: attach a rule to the render target</h3><p>In Cabloy/Zova, the same autofocus requirement can be expressed with a Behavior:</p><pre>&lt;input bs-behaviors-focus type=&quot;text&quot; /&gt;</pre><p>The &lt;input&gt; is still just an input. Autofocus is a capability attached to its rendering process. Its essential implementation looks like this:</p><pre>@Behavior&lt;IBehaviorOptionsFocus&gt;()<br>export class BehaviorFocus extends BeanBehaviorBase&lt;<br>  IBehaviorOptionsFocus,<br>  IBehaviorPropsInputFocus,<br>  IBehaviorPropsOutputFocus<br>&gt; {<br>  inputRef?: HTMLElement;<br><br>  protected render(props, next) {<br>    const refOuter = props?.ref;<br><br>    props = {<br>      ...props,<br>      ref: ref =&gt; {<br>        if (this.$options.always || !this.inputRef) {<br>          ref.focus?.();<br>        }<br>        this.inputRef = ref;<br>        refOuter?.(ref);<br>      },<br>    };<br><br>    return next(props);<br>  }<br>}</pre><p>It does a small number of things:</p><ol><li>receives the current render props;</li><li>preserves the original ref;</li><li>injects a new ref that calls focus() once the element is available;</li><li>calls the original ref as well;</li><li>continues the original render with next(props).</li></ol><p>This is direct render-time composition: a Behavior can adjust the input to the next render step, while the target element remains unaware of whether autofocus is needed.</p><p>Behavior is not a “Vue HOC.” Zova is built on Vue runtime and reactivity, but it provides an application architecture based on controllers, beans, and IoC. Behavior is Zova’s native facility for render-time interception and composition. The important point here is not its lower-level runtime machinery, but that it expresses autofocus as a rule that can be attached to a target independently.</p><h3>Not only props: wrapping rendered output</h3><p>Autofocus demonstrates a <strong>before-render</strong> shape: change the input to the next render step, such as props or a ref.</p><p>A second kind of requirement makes the value of wrapping even clearer: form-field layout. A field control owns input, values, and validation, but different pages may need to present it differently: add a label, display validation errors, insert prefix or suffix content, or apply a block or inline layout.</p><p>A layout Behavior can first obtain the field’s original rendering result, then add presentation structure around it. Its core shape is like this:</p><pre>const vnode = next(renderContext);<br><br>return (<br>  &lt;fieldset&gt;<br>    &lt;legend&gt;{label}&lt;/legend&gt;<br>    {vnode}<br>    {errorMessage}<br>  &lt;/fieldset&gt;<br>);</pre><p>If the layout rule is intended only for a native input, a separate layout Behavior can be attached directly to &lt;input&gt;. For example, define demo-ui:inputLayout to accept ordinary native props, call const vnode = next(props), and return a layout shell. Its usage can be as simple as:</p><pre>&lt;input bs-demo-ui-inputLayout type=&quot;text&quot; placeholder=&quot;Enter something&quot; /&gt;</pre><p>That attaches demo-ui:inputLayout to the rendering process of a native input: the Behavior continues rendering the input, then places its resulting vnode in its own layout structure. It does not change the responsibility of &lt;input&gt;, and it does not require a dedicated input component for this case.</p><p>Cabloy Basic’s existing form-field layout Behavior follows the same “render first, then wrap” pattern, but it runs inside a form-field host and depends on field state and layout configuration. It should therefore be used through ZFormField and a form provider, not attached directly to an arbitrary &lt;input&gt;. Native-element use cases need a separate Behavior such as demo-ui:inputLayout that handles ordinary input props.</p><p>A page can also choose a form-field layout Behavior. For example, the login page selects home-login:formFieldLayoutLogin through ZForm&#39;s formProvider, so every field in that form automatically receives the layout Behavior and renders with a consistent visual style:</p><pre>&lt;ZForm<br>  formProvider={{<br>    behaviors: {<br>      FormFieldLayout: &#39;home-login:formFieldLayoutLogin&#39;,<br>    },<br>  }}<br>&gt;<br>  {/* fields */}<br>&lt;/ZForm&gt;</pre><p>The useful separation is: <strong>the field owns the field itself; the layout policy owns how that field is wrapped and presented in this page.</strong></p><p>If the login layout were hard-coded into every field component, layout policies for different pages would contaminate one another. If every page copied fields and layout code, there would be no shared point of adjustment. A selectable rendering rule preserves the field’s stable contract while preserving page-level presentation freedom.</p><h3>Which reuse mechanism should you choose?</h3><p>NeedFirst choiceWhyReuse state, data, subscriptions, and interaction inside a componentCustom HookThe logic still belongs to the calling component’s own boundary.Provide stable, standalone UI structure with explicit inputs and outputsComponentThe abstraction owns a clear UI contract.Transform data or normalize options without rendering contextPure helperNo framework-level render composition is needed.Alter props/refs or wrap an existing render targetHOC / Wrapper / BehaviorThe rule belongs around the target and may need independent attachment and composition.</p><p>This table does not mean every visual requirement should become a Behavior. When an abstraction owns a stable interface and interaction contract of its own, a normal component is usually clearer. HOCs, wrappers, and Behaviors matter because they let a rule live around an existing target instead of becoming an inseparable part of that target.</p><h3>Conclusion</h3><p>Classic React HOCs can seem obsolete mainly because they were once used to solve many problems that Hooks now solve better.</p><p>Wrapping itself is not obsolete. As long as a requirement is fundamentally about:</p><ul><li>intercepting a target’s props or ref before render;</li><li>adding a shared presentation or interaction policy outside the target;</li><li>independently declaring and combining cross-cutting rules;</li></ul><p>there is still a place for HOCs, wrappers, and Zova Behaviors.</p><blockquote><em>What became outdated was not the idea of wrapping. It was the habit of turning every reuse problem into an HOC.<br>Hooks are for internal logic reuse; wrapping capabilities attach and compose cross-cutting rules at a rendering boundary.</em></blockquote><h3>Further Reading</h3><ul><li><a href="https://react.dev/learn/reusing-logic-with-custom-hooks">React: Reusing Logic with Custom Hooks</a></li><li><a href="https://legacy.reactjs.org/docs/higher-order-components.html">React: Higher-Order Components (legacy documentation)</a></li><li><a href="https://react.dev/reference/react/forwardRef">React: </a><a href="https://react.dev/reference/react/forwardRef">forwardRef reference</a></li><li><a href="https://docs.cabloy.com/frontend/behavior-guide">Cabloy: Behavior Guide</a></li><li><a href="https://github.com/cabloy/cabloy/blob/main/zova/src/suite-vendor/a-zova/modules/a-behaviors/src/bean/behavior.focus.ts">BehaviorFocus source</a></li><li><a href="https://github.com/cabloy/cabloy/blob/main/zova/src/suite/cabloy-basic/modules/basic-form/src/bean/behavior.formFieldLayout.tsx">Form-field layout Behavior source</a></li><li><a href="https://github.com/cabloy/cabloy/blob/main/zova/src/suite/a-home/modules/home-login/src/page/login/render.tsx">Login-page form-field layout selection</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5f376ac859d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cabloy Form Layout: Organize Complex Forms in DTOs with Tabs, Groups, and Sections]]></title>
            <link>https://medium.com/@cabloyjs/cabloy-form-layout-organize-complex-forms-in-dtos-with-tabs-groups-and-sections-0cc9d849426e?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/0cc9d849426e</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[dto]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 02:12:09 GMT</pubDate>
            <atom:updated>2026-07-18T02:12:09.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QF7LcDKQH4WKpEIFYPyVTg.png" /></figure><blockquote><em>Automatically rendered forms work well when there are only a few fields. As a form grows to include profile information, contact details, and business records, structure starts to matter: how should fields be grouped? Which fields should sit side by side? Which content belongs in a separate tab?</em></blockquote><p>Cabloy Form Layout is designed for exactly this. It lets you describe the placement and hierarchy of multiple form fields in a DTO, then lets the frontend render that structure from the configuration.</p><p>Put simply: <strong>Form Layout decides where fields go. The existing schema and form configuration still decide field types, labels, validation, and other field behavior.</strong></p><h3>What Form Layout Can Do</h3><p>With Form Layout, you can configure common form requirements in a DTO:</p><ul><li>Change the order in which fields appear.</li><li>Put related fields into a titled business group.</li><li>Use multiple columns on wider screens and a single column on smaller screens.</li><li>Split independent content, such as Basic Information and Training Records, into separate tabs.</li><li>Apply the same structural approach across create, update, and view forms.</li></ul><p>The main nodes are straightforward:</p><ul><li>field: places one field.</li><li>section: arranges fields in one or more columns.</li><li>group: organizes related fields together.</li><li>tabs / tab: divides separate content areas into tabs.</li></ul><h3>Example: Structuring the Student Form</h3><p>The following Student Create DTO layout is slightly simplified for illustration. It focuses on the Form Layout portion and omits the outer DTO definition, page actions, and other field configuration.</p><pre>ZovaRender.block(&#39;basic-form:blockFormLayout&#39;, {<br>  formLayout: {<br>    children: [<br>      {<br>        type: &#39;tabs&#39;,<br>        children: [<br>          {<br>            type: &#39;tab&#39;,<br>            title: $locale(&#39;BasicInformation&#39;),<br>            children: [<br>              {<br>                type: &#39;group&#39;,<br>                title: $locale(&#39;StudentProfile&#39;),<br>                children: [<br>                  {<br>                    type: &#39;section&#39;,<br>                    columns: { default: 1, md: 2 },<br>                    children: [<br>                      { type: &#39;field&#39;, name: &#39;name&#39; },<br>                      { type: &#39;field&#39;, name: &#39;mobile&#39; },<br>                      {<br>                        type: &#39;field&#39;,<br>                        name: &#39;imageId&#39;,<br>                        span: { default: 1, md: 2 },<br>                      },<br>                    ],<br>                  },<br>                ],<br>              },<br>            ],<br>          },<br>          {<br>            type: &#39;tab&#39;,<br>            title: $locale(&#39;TrainingRecords&#39;),<br>            children: [<br>              { type: &#39;field&#39;, name: &#39;level&#39; },<br>              { type: &#39;field&#39;, name: &#39;trainingRecords&#39; },<br>            ],<br>          },<br>        ],<br>      },<br>    ],<br>  },<br>});</pre><p>Read the example from the outside in to see what it produces.</p><h3>1. tabs and tab: Split the Form by Business Area</h3><p>The outer tabs node creates a tabbed area. It contains two tab nodes:</p><ul><li>BasicInformation</li><li>TrainingRecords</li></ul><p>Tabs help readers focus on one area at a time when a form contains independent business content. If a form has only a few fields, a simple group is usually easier to scan than a tabbed interface.</p><h3>2. group: Give Related Fields a Clear Context</h3><p>The group in the Basic Information tab is titled StudentProfile. It puts the student&#39;s name, mobile number, and image under one shared business context.</p><p>Think of a group as a titled grouping for related fields. Contact details, shipping addresses, and approval information are all common examples.</p><h3>3. section: Control Responsive Columns</h3><p>The section controls the field grid. columns: { default: 1, md: 2 } means one column by default and two columns at the md breakpoint and above.</p><p>As a result, name and mobile can appear side by side on wider screens and naturally stack on smaller screens.</p><h3>4. field: Reference Fields Already Defined in the DTO Schema</h3><p>Each field uses name to reference a field that already exists in the DTO schema, such as name. Its widget, label, and validation rules continue to use the field&#39;s existing configuration.</p><p>imageId also uses span: { default: 1, md: 2 }. It takes one column in the default layout and both columns in the two-column layout. This is useful for an image, note, or description that should occupy a full row.</p><h3>Choosing the Right Node</h3><p>Start with the smallest structure that expresses what the form needs:</p><p>RequirementUseOnly change field orderfieldShow fields side by side on wider screenssectionGive related fields a shared title and boundarygroupSeparate genuinely independent business contenttabs / tab</p><p>A common composition is: <strong>Tabs divide business areas, Groups express business context, Sections handle responsive columns, and Fields place individual fields.</strong></p><p>You do not need every container for every form. Use field alone for a simple form, add a section when columns help, and add a group only when fields truly belong to the same business block.</p><h3>One Easy-to-Miss Detail</h3><p>Form Layout controls field <strong>placement</strong>, not field visibility.</p><p>If a field should not appear, configure its visibility in the field’s schema metadata. Leaving it out of formLayout does not necessarily hide it; an eligible visible field can still appear at the end of the form.</p><h3>Summary</h3><p>Form Layout lets a DTO describe the structure of a complex form:</p><ul><li>Use field to set field order.</li><li>Use section for responsive columns.</li><li>Use group for business grouping.</li><li>Use tabs / tab to separate independent content.</li></ul><p>The key division of responsibility is simple: <strong>DTO metadata describes the form structure; the schema and form runtime continue to govern each field’s behavior.</strong> When fields change, update the layout in the DTO instead of maintaining field placement repeatedly across multiple pages.</p><h3>Further Reading</h3><ul><li><a href="https://docs.cabloy.com/frontend/form-layout-guide">Form Layout Guide</a></li><li><a href="https://docs.cabloy.com/frontend/form-guide">Form Guide</a></li><li><a href="https://github.com/cabloy/cabloy/blob/be077b1efcd0fef8b7842e14932b07f7efc2bcc5/vona/src/suite/a-training/modules/training-student/src/dto/studentCreate.tsx">Student Create DTO example</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0cc9d849426e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Bridge Login State Across SSR and CSR: Next.js, Nuxt, and Cabloy Compared]]></title>
            <link>https://medium.com/@cabloyjs/how-to-bridge-login-state-across-ssr-and-csr-next-js-nuxt-and-cabloy-compared-35b36a1f1446?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/35b36a1f1446</guid>
            <category><![CDATA[nuxtjs]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 02:07:05 GMT</pubDate>
            <atom:updated>2026-07-13T02:07:05.281Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qfD0RYSC0QD13ibg7ZE7CA.png" /></figure><blockquote><em>Supporting login state across SSR and CSR is not merely a question of whether a cookie travels with the request. The real work is verifying identity on the server, reusing that result for the first client render, recovering a good browser experience later, and still authorizing every protected operation on the server.</em></blockquote><h3>Start with three minimal implementations</h3><p>Before discussing abstractions, here are representative ways that Next.js, Nuxt, and Cabloy carry <strong>server-verified login state</strong> into the first client render.</p><p>All three examples deliberately expose only a UI-safe public DTO. A raw session token, refresh token, password hash, and server-internal fields do not belong in a hydration payload.</p><h3>Next.js App Router: a Server Component passes a safe DTO explicitly</h3><pre>// app/types/session.ts<br>export type PublicSession = {<br>  user: { id: string; name: string };<br>  roles: string[];<br>} | null;</pre><pre>// app/lib/session.ts<br>import &#39;server-only&#39;;<br>import { cookies } from &#39;next/headers&#39;;<br>import type { PublicSession } from &#39;@/app/types/session&#39;;</pre><pre>export async function getPublicSession(): Promise&lt;PublicSession&gt; {<br>  const token = (await cookies()).get(&#39;session&#39;)?.value;<br>  if (!token) return null;</pre><pre>  const session = await verifySessionOnServer(token);<br>  if (!session) return null;</pre><pre>  return {<br>    user: {<br>      id: session.user.id,<br>      name: session.user.name,<br>    },<br>    roles: session.roles,<br>  };<br>}</pre><pre>// app/dashboard/page.tsx — Server Component<br>import { DashboardClient } from &#39;./dashboard-client&#39;;<br>import { getPublicSession } from &#39;@/app/lib/session&#39;;</pre><pre>export default async function DashboardPage() {<br>  const initialSession = await getPublicSession();</pre><pre>  return &lt;DashboardClient initialSession={initialSession} /&gt;;<br>}</pre><pre>// app/dashboard/dashboard-client.tsx<br>&#39;use client&#39;;</pre><pre>import type { PublicSession } from &#39;@/app/types/session&#39;;</pre><pre>export function DashboardClient({<br>  initialSession,<br>}: {<br>  initialSession: PublicSession;<br>}) {<br>  if (!initialSession) return &lt;a href=&quot;/login&quot;&gt;Sign in&lt;/a&gt;;</pre><pre>  return &lt;p&gt;Hello, {initialSession.user.name}&lt;/p&gt;;<br>}</pre><p>A protected operation still establishes identity and authorizes the exact resource on the server:</p><pre>// app/lib/projects.ts<br>import &#39;server-only&#39;;<br>import { getPublicSession } from &#39;./session&#39;;</pre><pre>export async function getProjectForViewer(projectId: string) {<br>  const session = await getPublicSession();<br>  if (!session) throw new Error(&#39;Unauthenticated&#39;);</pre><pre>  await assertCanReadProject(session.user.id, projectId);<br>  return await db.project.findUniqueOrThrow({ where: { id: projectId } });<br>}</pre><h3>Nuxt: a server session endpoint plus a useFetch payload</h3><pre>// server/api/session.get.ts<br>import { getCookie } from &#39;h3&#39;;</pre><pre>export default defineEventHandler(async event =&gt; {<br>  const token = getCookie(event, &#39;session&#39;);<br>  if (!token) return { user: null, roles: [] };</pre><pre>  const session = await verifySessionOnServer(token);<br>  if (!session) return { user: null, roles: [] };</pre><pre>  return {<br>    user: {<br>      id: session.user.id,<br>      name: session.user.name,<br>    },<br>    roles: session.roles,<br>  };<br>});</pre><pre>// composables/useSession.ts<br>export function useSession() {<br>  return useFetch(&#39;/api/session&#39;, {<br>    key: &#39;session&#39;,<br>    default: () =&gt; ({ user: null, roles: [] }),<br>  });<br>}</pre><pre>&lt;!-- app.vue or a layout --&gt;<br>&lt;script setup lang=&quot;ts&quot;&gt;<br>const { data: session } = await useSession();<br>&lt;/script&gt;</pre><pre>&lt;template&gt;<br>  &lt;AccountMenu :session=&quot;session&quot; /&gt;<br>&lt;/template&gt;</pre><h3>Cabloy: server mem, client local, bridged by the Model Query Cache</h3><p>This is the current shape of Cabloy Basic’s ModelPassport:</p><pre>// zova/src/suite/a-home/modules/home-passport/src/model/passport.ts<br>this.passport = process.env.CLIENT<br>  ? this.$useStateLocal({ queryKey: [&#39;passport&#39;] })<br>  : this.$useStateMem({ queryKey: [&#39;passport&#39;] });</pre><p>The server confirms the passport using the authentication information for the current request:</p><pre>async ensurePassport() {<br>  if (process.env.CLIENT) return this.passport;</pre><pre>  if (!this.sys.config.ssr.cookieDisabledOnServer &amp;&amp; !this.isAuthenticated &amp;&amp; this.accessToken) {<br>    this.passport = await this.$api.homeUserPassport.current();<br>    this._setLocaleTz();<br>  }</pre><pre>  return this.passport;<br>}</pre><p>The surface APIs differ, but the shared principle is the same:</p><blockquote><strong><em>The browser receives a server-confirmed, UI-safe projection of login state. Authentication and authorization decisions remain on the server.</em></strong></blockquote><h3>What each implementation is actually solving</h3><h3>Next.js: the Server Component is the start of the bridge</h3><p>The natural boundary in the Next.js App Router is between Server Components and Client Components.</p><pre>HttpOnly Cookie<br>  → server-only session verification<br>  → Server Component<br>  → serializable initialSession prop<br>  → Client Component hydration</pre><p>cookies() is read along a server execution path. getPublicSession() reads the request cookie, verifies the session, and constructs a small, explicit PublicSession DTO. The Server Component then passes it as initialSession to the Client Component.</p><p>Two details matter:</p><ol><li><strong>The Client Component receives a DTO, not the cookie or raw session.</strong> HttpOnly exists specifically to keep the credential unavailable to browser JavaScript.</li><li><strong>initialSession solves first-render consistency.</strong> It avoids a server-rendered signed-in UI becoming a signed-out client UI during hydration. It does not authorize a later Server Action, Route Handler, or data-access operation.</li></ol><p>Next.js does not decide your global client session store for you. The application may put initialSession in Context, a state store, a Query cache, or pass it farther through the component tree. That explicitness is a feature: the application owns both the session DTO and its later client-state policy.</p><h3>Nuxt: keyed async data bridges the SSR payload</h3><p>In Nuxt, the primary bridge is commonly useFetch or useAsyncData:</p><pre>HttpOnly Cookie<br>  → /api/session server endpoint<br>  → useFetch(&#39;/api/session&#39;, { key: &#39;session&#39; })<br>  → Nuxt SSR payload<br>  → Client hydration reuses payload</pre><p>The server /api/session endpoint reads and validates the request cookie, then returns only public display data. A page or layout calls the same useFetch path. On SSR, the result enters the Nuxt payload; during initial hydration, the client reuses the result under that async-data identity instead of treating the same session read as an independent request.</p><p>key: &#39;session&#39; provides stable identity for this async data. It also makes later refreshes such as refreshNuxtData(&#39;session&#39;) possible. It is <strong>not</strong> a permission key and does not authorize any protected endpoint.</p><p>Projects that want a fuller Nuxt session abstraction can evaluate the official nuxt-auth-utils module and its useUserSession(), setUserSession(), and requireUserSession() APIs. This article uses /api/session plus useFetch because it exposes the fundamental SSR-payload-to-client-reuse chain directly.</p><h3>Cabloy: Model-owned Query Cache identity is the bridge</h3><p>Cabloy’s ModelPassport uses different helpers for the initial SSR source and the browser persistence policy, then joins them through the same effective Query Key:</p><pre>request cookie / token<br>  → ModelPassport.ensurePassport()<br>  → server $useStateMem([&#39;passport&#39;])<br>  → request-scoped Query Cache<br>  → dehydrate after render<br>  → client QueryClient hydrate<br>  → client $useStateLocal([&#39;passport&#39;])<br>  → Query Cache first, localStorage fallback</pre><p>The server selects $useStateMem(...) because it has no browser localStorage, and the identity for this request must be confirmed through the request credential and ensurePassport(). A successful memory Query Cache entry that passes the dehydration policy can enter the SSR snapshot.</p><p>The client selects $useStateLocal(...) because it must both reuse the initial SSR snapshot and support CSR-only entry or browser-session recovery when no snapshot exists. $useStateLocal(...) checks the Query Cache first. When a hydration entry exists, the server-confirmed passport wins. Only when no cache value exists does it attempt synchronous localStorage restoration and then fall back to meta.defaultData.</p><p>Two details are frequently misunderstood:</p><ul><li>The dehydrated entry is the Query entry created by server $useStateMem(...), not the client $useStateLocal(...) wrapper.</li><li>Hydration restores the Query Cache. Reading that value does not automatically save it to localStorage; a later assignment through the client local-state wrapper updates the cache and writes the local record.</li></ul><p>Also, [&#39;passport&#39;] is not a global key. Zova prefixes the key with Model identity, and selector-enabled Models include selector identity as well. Reuse therefore requires the same Model, applicable selector, and logical queryKey.</p><h3>One table for the three bridge designs</h3><p>DimensionNext.js App RouterNuxtCabloyServer identity confirmationServer-only code / Server Component reads and verifies Cookie/api/session endpoint reads and verifies CookieModelPassport.ensurePassport() confirms the passport for the current requestInitial client-state carrierExplicit initialSession prop through the RSC payloadNuxt payload from useFetchDehydrated and hydrated Model Query Cache entryLater client-state policyContext, store, or Query policy chosen by the applicationuseFetch cache; higher-level auth/state policy chosen by the application$useStateLocal restores localStorage only when hydrated cache is absentIdentity ruleThe Server/Client Component props contractAsync-data key, such as sessionModel identity + selector when applicable + logical queryKeyProtected server operationsServer Actions, Route Handlers, and DAL authorize independentlyServer APIs, handlers, and services authorize independentlyVona passport guard and business permission logic authorize independentlyMain architectural emphasisServer/client component boundary and safe DTOsSSR-aware fetching and payload reuseModel ownership, Query Cache identity, and helper lifecycle</p><p>None of these designs “hydrates a cookie into the browser.” A cookie is a request credential. Hydrated props, a Nuxt payload, and a Model Query Cache entry are derived state for rendering and interaction.</p><h3>The real security boundary: client login state improves UX only</h3><p>Many implementations go wrong here: a page can render the user name and hide buttons by role, so the client state is treated as an authorization result.</p><p>It is not.</p><h3>1. An HttpOnly cookie is not client state</h3><p>Browser JavaScript should not read an HttpOnly cookie. The browser attaches it to requests within the cookie&#39;s scope; the server then validates its signature, expiry, session record, revocation state, or user status.</p><p>Do not conflate these two channels:</p><pre>Cookie / session credential<br>  → server-side authentication input</pre><pre>hydrated public session DTO / passport cache<br>  → client rendering input</pre><h3>2. A client route guard is a UX guard, not an authorization point</h3><p>A client-side guard can redirect early, avoid a visible unauthorized page, or hide unavailable controls. A caller can still issue an HTTP request directly and can still alter display state in browser memory.</p><p>Every protected Server Action, Route Handler, Nuxt server API, Vona Controller/service, or equivalent operation must independently:</p><ol><li>establish the current identity from request authentication data;</li><li>validate that the user, tenant, and session remain valid;</li><li>authorize the exact action against the exact resource;</li><li>validate its input.</li></ol><h3>3. A smaller DTO is both safer and more stable</h3><p>The first client render commonly needs no more than:</p><pre>{<br>  user: { id, name, avatar },<br>  roles: [&#39;admin&#39;],<br>}</pre><p>It does not need a raw session, refresh token, upstream API token, password field, internal audit field, or an entire database user record. A safe DTO reduces both direct exposure and accidental leakage as server-side data models evolve.</p><h3>4. Stale display state is normal</h3><p>Logout, expiration, role revocation, tenant changes, and a logout on another device can all make a browser’s previous login-state projection stale.</p><p>The objective of an SSR/CSR bridge is therefore:</p><blockquote><strong><em>Make the first paint and ordinary interactions coherent, not give the client a permanently trusted copy of identity.</em></strong></blockquote><p>Cookie configuration should match the application: HttpOnly, Secure, SameSite, path, expiry, and rotation strategy all matter. Cookie-authenticated state-changing requests also need a CSRF approach appropriate to the deployment, cross-site requirements, embedded contexts, and session architecture.</p><h3>Why Cabloy’s bridge deserves separate attention</h3><p>The Next.js and Nuxt examples usually keep one visible application abstraction across the boundary:</p><pre>Next: server DTO → client prop / provider<br>Nuxt: server endpoint → same useFetch key</pre><p>Cabloy’s distinguishing feature is that the same business field can deliberately use different state helpers on server and client:</p><pre>SSR Server: $useStateMem([&#39;passport&#39;])<br>SSR Client: $useStateLocal([&#39;passport&#39;])<br>Bridge: Model-owned effective Query Cache identity</pre><p>This separates two needs instead of conflating them:</p><ul><li>mem means request-confirmed runtime state for the current SSR pass, without a browser storage backend;</li><li>local means client state that can persist and recover in the browser, without overriding a hydrated server conclusion;</li><li>the common effective key joins those paths during the first hydration.</li></ul><p>The trade-off is equally explicit. Developers must understand Model ownership, Query Cache lifecycle, dehydrate/hydrate behavior, selectors, and helper families rather than treating this as an ordinary Vue ref or one global store. For applications where SSR, caching, persistence, and resource models coexist, that explicit ownership can be easier to sustain than an accumulation of local conventions.</p><h3>Common mistakes and better formulations</h3><p>Misleading shortcutMore accurate formulation”Next.js hydrates the session cookie into React.”Next.js reads the Cookie in a Server Component or server-only path and passes a serializable safe DTO to a Client Component.”Nuxt useCookie lets the client read an HttpOnly login cookie.&quot;useCookie is SSR-aware, but browser JavaScript still cannot read an HttpOnly cookie; the client should consume a safe DTO returned by the server.&quot;A useFetch key is a permission key.&quot;The key identifies async data and payload/cache reuse. The server still authorizes requests from their credentials and target resources.&quot;Cabloy&#39;s $useStateLocal is dehydrated directly by the server.&quot;In this flow, the server $useStateMem entry is dehydrated; the client $useStateLocal wrapper reuses hydrated cache through the same effective key.&quot;An SSR snapshot automatically persists to localStorage.&quot;SSR hydration restores initial cache. Cabloy saves browser-local state through later assignments to the local-state wrapper.&quot;An API is safe because the UI hides its button by role.&quot;UI control is an experience layer; every protected server operation must authenticate, authorize, and validate input independently.</p><h3>When each structure fits</h3><h3>Choose an explicit Next.js DTO bridge</h3><p>This fits applications centered on the App Router and Server Components that want precise control over every server-to-client boundary. The exposure surface is highly visible; the trade-off is that the application chooses and maintains its own client session provider, cache, and refresh policy.</p><h3>Choose a keyed Nuxt useFetch bridge</h3><p>This fits Nuxt applications centered on server APIs and SSR data fetching. It offers SSR-payload reuse with little plumbing; the trade-off is that a team must keep async-data keys, endpoint response shapes, and refresh/invalidation policy disciplined as the application grows.</p><h3>Use Cabloy’s ModelPassport bridge</h3><p>This fits Cabloy/Zova Model applications that want SSR handoff, client cache identity, and browser persistence fallback under one Model-owned state runtime. It provides an existing passport bridge pattern; the trade-off is following the architectural rules around Model/selector/Query Key identity and helper lifecycle.</p><p>Whichever framework you choose, the stable final principle is unchanged:</p><blockquote><strong><em>The server verifies identity, the client reuses display state, and protected server operations authorize again.</em></strong></blockquote><h3>References and source material</h3><h3>Next.js</h3><ul><li><a href="https://nextjs.org/docs/app/guides/authentication">Next.js Authentication</a></li><li><a href="https://nextjs.org/docs/app/api-reference/functions/cookies">Next.js </a><a href="https://nextjs.org/docs/app/api-reference/functions/cookies">cookies() API</a></li><li><a href="https://nextjs.org/docs/app/getting-started/server-and-client-components">Next.js Server and Client Components</a></li><li><a href="https://nextjs.org/docs/app/guides/data-security">Next.js Data Security</a></li></ul><h3>Nuxt</h3><ul><li><a href="https://nuxt.com/docs/4.x/api/composables/use-fetch">Nuxt </a><a href="https://nuxt.com/docs/4.x/api/composables/use-fetch">useFetch</a></li><li><a href="https://nuxt.com/docs/4.x/getting-started/data-fetching">Nuxt Data Fetching</a></li><li><a href="https://nuxt.com/docs/4.x/api/composables/use-request-fetch">Nuxt </a><a href="https://nuxt.com/docs/4.x/api/composables/use-request-fetch">useRequestFetch</a></li><li><a href="https://nuxt.com/docs/4.x/api/composables/use-cookie">Nuxt </a><a href="https://nuxt.com/docs/4.x/api/composables/use-cookie">useCookie</a></li><li><a href="https://nuxt.com/docs/3.x/guide/recipes/sessions-and-authentication">Nuxt Sessions and Authentication</a></li></ul><h3>Cabloy</h3><ul><li><a href="https://github.com/cabloy/cabloy/blob/5d2aeab0c994fb8e222088ebceebc4c9ab3af649/zova/src/suite/a-home/modules/home-passport/src/model/passport.ts">ModelPassport source</a></li><li><a href="https://github.com/cabloy/cabloy/blob/5d2aeab0c994fb8e222088ebceebc4c9ab3af649/cabloy-docs/frontend/model-state-guide.md">Model State Guide</a></li><li><a href="https://github.com/cabloy/cabloy/blob/5d2aeab0c994fb8e222088ebceebc4c9ab3af649/cabloy-docs/frontend/ssr-init-data.md">SSR Init Data</a></li><li><a href="https://github.com/cabloy/cabloy/blob/5d2aeab0c994fb8e222088ebceebc4c9ab3af649/cabloy-docs/frontend/a-model-under-the-hood.md">A-Model Under the Hood</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35b36a1f1446" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Manage Complex State in Large Vue Projects: “Scattered” vs “Systematic”]]></title>
            <link>https://medium.com/@cabloyjs/how-to-manage-complex-state-in-large-vue-projects-scattered-vs-systematic-15e5c022797b?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/15e5c022797b</guid>
            <category><![CDATA[ssrs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 07:48:26 GMT</pubDate>
            <atom:updated>2026-07-06T07:48:26.183Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NKoOwD8RAgXdGWtBhHRXuA.png" /></figure><blockquote><em>Large frontend systems rarely hit their limit because they chose the wrong individual state tool. They hit it when ownership, sharing boundaries, cache semantics, persistence, and SSR rules no longer compose into one coherent system.</em></blockquote><h3>The problem is not tool shortage. It is boundary drift.</h3><p>If I had to compress the entire argument into one sentence, it would be this:</p><blockquote><strong><em>Large Vue projects usually do not become difficult because they need one more library. They become difficult because state mechanisms keep multiplying while state boundaries keep losing clarity.</em></strong></blockquote><p>That is the real subject of this article.</p><p>Not whether Pinia is sufficient. Not whether composables are overused. Not whether Vue itself is somehow inadequate.</p><p>The real problem is more structural than that.</p><p>In a large codebase, the usual mechanisms all solve legitimate local problems:</p><ul><li>local reactive state,</li><li>composables,</li><li>provide/inject,</li><li>stores,</li><li>query cache,</li><li>local persistence,</li><li>SSR hydration rules.</li></ul><p>Any one of those choices can be correct.</p><p>And still, taken together, they can produce a state layer that feels progressively less stable.</p><p>Not because one piece is obviously wrong, but because the whole system gradually loses shape.</p><p>That is what I mean by the <strong>scattered</strong> version.</p><p>Not a broken system. Not an amateur system. Not even an irrational one.</p><p>A scattered system is one where:</p><ul><li>each local decision can be justified,</li><li>each mechanism solves a real problem,</li><li>but the overall state architecture becomes harder and harder to explain, modify, and trust.</li></ul><p>What Zova/Cabloy tries to offer is not a replacement for Vue, but a more <strong>systematic</strong> way to organize state on top of Vue:</p><ul><li><strong>Bean / Controller</strong> defines ownership,</li><li><strong>IoC Scope</strong> defines how far state is shared,</li><li><strong>Model</strong> defines a unified state layer,</li><li><strong>Resource Owner</strong> defines the boundary for resource-level semantics such as queries, schema, permissions, and invalidation.</li></ul><p>If the project is small, short-lived, or handled by a very small team, the scattered version may be perfectly adequate.</p><p>But once the system becomes long-lived, multi-person, SSR-aware, cache-heavy, and persistence-heavy, the difference between scattered and systematic stops being a matter of taste.</p><p>It becomes a question of architecture.</p><p>And that leads to the real question underneath the tooling discussion:</p><blockquote><strong><em>Should complex state continue to be held together mainly by team discipline, or should more of it be held together by structure?</em></strong></blockquote><h3>The decisive questions sit upstream of tooling</h3><p>Most state-management discussions begin at the tool layer:</p><ul><li>Should we use Pinia?</li><li>Should we add Query?</li><li>How should we persist local state?</li><li>How should we handle SSR hydration?</li></ul><p>Those are sensible questions.</p><p>But in large systems, they are not the first questions.</p><p>The first questions are these:</p><ul><li><strong>Ownership</strong> — which object actually owns this state?</li><li><strong>Sharing boundary</strong> — is it local, parent/child shared, app-level, or system-level?</li><li><strong>State family</strong> — is it server state, in-memory state, local persistence, cookie-backed state, or async persistent state?</li><li><strong>Cache semantics</strong> — who owns the key, invalidation, and restore rules?</li><li><strong>Lifecycle</strong> — what survives disposal, refresh, route transitions, and SSR request boundaries?</li><li><strong>Resource semantics</strong> — is this just a value, or part of a larger resource boundary that also owns schema, permissions, queries, forms, and actions?</li></ul><p>When those questions are answered by different local mechanisms, the result is usually familiar:</p><ul><li>some state lives in pages,</li><li>some lives in composables,</li><li>some lives in stores,</li><li>some lives in query cache,</li><li>some lives in persistence wrappers.</li></ul><p>The application still works.</p><p>But the architecture becomes progressively harder to narrate.</p><p>And once a system becomes hard to narrate, it usually becomes hard to evolve safely.</p><p>That is the real failure mode of state management in large projects.</p><p>Not that a feature cannot be built.</p><p>But that the team gradually loses a clean answer to the most important question:</p><blockquote><strong><em>Why does this state live here, why is this mechanism responsible for it, and where exactly does its boundary end?</em></strong></blockquote><p>Large systems usually do not need more state tools.</p><p>They need <strong>a stronger organizational model for the tools they already have</strong>.</p><h3>Why large Vue projects drift into the scattered version so easily</h3><p>Because the road into it is the most natural road available.</p><p>A team starts with local state. Then extracts a composable. Then uses provide/inject. Then adds a store. Then adds Query. Then adds local persistence. Then patches SSR behavior.</p><p>Every move is locally rational.</p><p>That is exactly why the outcome is so common.</p><p>The issue is not that teams are making obviously bad decisions.</p><p>The issue is that the default growth path is a <strong>local-solution path</strong>, not a <strong>boundary-first path</strong>.</p><p>And over time, that difference compounds.</p><p>The same symptoms begin to appear again and again:</p><ul><li>the same kind of state lands in different places on different screens,</li><li>refresh rules are hidden inside mutation success handlers,</li><li>persistence is treated as an afterthought rather than part of state semantics,</li><li>“global state” quietly mixes request-level and long-lived system concerns,</li><li>one resource’s schema, permissions, forms, queries, and invalidation rules end up split across several layers.</li></ul><p>This is the critical distinction:</p><blockquote><strong><em>The scattered version is not wrong because the tools are wrong. It is wrong because each tool solves one slice while the system never grows one stable ownership model.</em></strong></blockquote><p>That creates a very particular form of technical debt.</p><p>Not sudden failure.</p><p>Not dramatic breakage.</p><p>A slower, more corrosive debt: the project becomes increasingly dependent on memory, habit, and tribal knowledge to remain coherent.</p><p>At first, that feels like flexibility.</p><p>Later, it feels like fog.</p><h3>What Zova/Cabloy changes is not the reactive core, but the authoring model</h3><p>The most important thing to understand about Zova/Cabloy is this:</p><blockquote><strong><em>Vue 3 remains the reactive foundation. What changes is the programming model the business layer encounters first.</em></strong></blockquote><p>In mainstream Vue development, the most visible concepts are usually:</p><ul><li>setup(),</li><li>ref() / reactive(),</li><li>computed(),</li><li>composables,</li><li>provide/inject,</li><li>stores.</li></ul><p>In Zova, the center of gravity shifts.</p><p>The foreground concepts become:</p><ul><li><strong>Controller / Bean instances</strong> as visible state owners,</li><li><strong>__init__</strong> as a lifecycle-aware wiring point,</li><li><strong>IoC scopes</strong> as the sharing model,</li><li><strong>Model</strong> as the unified state layer,</li><li><strong>Resource Owner</strong> as the owner of resource-level frontend semantics.</li></ul><p>That changes the first design question.</p><p>Instead of asking:</p><ul><li>should this go into a store?</li></ul><p>You are pushed to ask:</p><ul><li>which bean owns this?</li><li>which scope should share it?</li><li>which model family should represent it?</li></ul><p>That is not a cosmetic shift.</p><p>It changes where architectural decisions happen.</p><p>In the scattered version, state tends to appear first and only later search for a home.</p><p>In the systematic version, the home is chosen first, and implementation follows.</p><p>That sounds subtle.</p><p>In a large system, it is not subtle at all.</p><p>Because the hardest thing in a growing codebase is not shipping one more feature.</p><p>It is continuing to place boundaries correctly as the system gets more complex.</p><h3>Layer 1: make ownership explicit</h3><p>In many Vue projects, the most natural host for state is a local declaration inside setup():</p><pre>const count = ref(0);<br>const countLabel = computed(() =&gt; `=== ${count.value} ===`);</pre><p>There is nothing wrong with that pattern.</p><p>But at scale, it often produces a predictable drift: state appears as a local variable first, then gradually leaks outward into composables, stores, parent components, and other abstractions.</p><p>Zova begins from a different assumption. Visible state typically lives directly on a Controller or Bean instance:</p><pre>count: number = 0;</pre><pre>protected async __init__() {<br>  this.countLabel = this.$computed(() =&gt; {<br>    return `=== ${this.count} ===`;<br>  });<br>}</pre><pre>increment() {<br>  this.count++;<br>}</pre><p>The important point is not that you wrote less .value.</p><p>The important point is this:</p><ul><li>the state host becomes a <strong>framework-managed instance</strong>,</li><li>derived state becomes <strong>lifecycle-aware wiring on that instance</strong>,</li><li>behavior and state collapse back under one explicit owner.</li></ul><p>That changes how a large codebase is read.</p><p>In ordinary Vue code, the reader often asks:</p><ul><li>which composable owns this?</li></ul><p>In Zova, the reader is more likely to ask:</p><ul><li><strong>which Bean or Controller owns this?</strong></li></ul><p>That is a healthier question in a large system.</p><p>Because large systems rarely suffer from a lack of flexibility.</p><p>They suffer from a lack of stable ownership.</p><p>And once ownership drifts, scope, persistence, cache identity, SSR behavior, and invalidation tend to drift with it.</p><h3>Layer 2: make sharing a scope problem instead of a mechanism-switching problem</h3><p>Large Vue projects also become scattered because <strong>sharing is expressed through multiple unrelated mechanisms</strong>.</p><p>The word “shared” can point to very different strategies:</p><ul><li>local component sharing through local state or composables,</li><li>parent-child sharing through props/emits or provide/inject,</li><li>app-level sharing through a store,</li><li>long-lived sharing through module singletons, plugin state, or some implicit global object.</li></ul><p>So the system quietly learns a rule like this:</p><blockquote><strong><em>When the sharing boundary changes, the mechanism changes too.</em></strong></blockquote><p>Zova reframes that into one IoC model with multiple scopes:</p><p>Sharing rangeCommon Vue 3 patternZova question framingcomponent-internallocal state, component-local composablesshould this be a ctx-scoped Bean?between-componentsprops/emits, parent-owned composables, provide/injectshould this use hierarchical injection such as host / skipSelf?app-globalstores, app-level provided stateshould this be an app-scoped shared Bean?system-levelmodule singletons, long-lived imported stateshould this be a sys-scoped state that outlives requests?</p><p>The value is not just cleaner terminology.</p><p>It is a different way of framing the problem:</p><blockquote><strong><em>Do not start with the sharing mechanism. Start with the sharing boundary.</em></strong></blockquote><p>A compact mental model looks like this:</p><pre>class ControllerPage {<br>  @Use()<br>  $$localCounterState: CounterState;</pre><pre>  @Use({ injectionScope: &#39;host&#39; })<br>  $$hostCounterState: CounterState;</pre><pre>  @Use({ injectionScope: &#39;app&#39; })<br>  $$appCounterState: CounterState;</pre><pre>  @Use({ injectionScope: &#39;sys&#39; })<br>  $$sysCounterState: CounterState;<br>}</pre><p>The strength of this model is not only uniform syntax.</p><p>It is also that:</p><ul><li>the sharing boundary becomes explicit,</li><li>state does not need to jump between unrelated mechanisms as sharing expands,</li><li>app-level and system-level state stop being casually mixed together.</li></ul><p>This matters even more in SSR.</p><p>Because many teams casually label both of the following things as “global state”:</p><ul><li><strong>request-level or app-level state</strong> — state that should follow an app instance or one SSR request,</li><li><strong>system-level state</strong> — state that should outlive those requests.</li></ul><p>If that distinction is not built into the model, SSR bugs become easy to create and hard to reason about.</p><p>Zova moves the difference directly into the architecture through app versus sys.</p><p>That is what a systematic model does well:</p><blockquote><strong><em>It turns boundaries that used to live in team memory into explicit structural rules.</em></strong></blockquote><h3>Layer 3: Model is not just a request layer, and not just another store</h3><p>Even teams that use both a store and a query library often unify only part of the state problem.</p><p>The usual split is familiar:</p><ul><li>stores handle client-shared state,</li><li>query handles server-state cache,</li><li>localStorage utilities handle persistence,</li><li>cookie utilities handle request-related state,</li><li>async persistence is wrapped somewhere else.</li></ul><p>That is still a scattered model.</p><p>Every state family has a tool.</p><p>But the state families do not share one coherent owner.</p><p>Zova’s Model pushes the abstraction one step further.</p><p>It does not only represent remote data. It brings multiple state families under one model-state layer:</p><ul><li>data — server / query-style state,</li><li>mem — in-memory state,</li><li>local — localStorage-backed state,</li><li>cookie — cookie-backed state,</li><li>db — async persistent state.</li></ul><p>That changes the conversation in an important way.</p><p>Server state, local persistence, and in-memory state no longer need to be treated as unrelated worlds.</p><p>They still have different semantics, but they can live under one unified model ownership.</p><p>And this is not merely a thin wrapper over other tools.</p><p>Zova’s Model is built on TanStack Query, but what the business layer sees is a more structured interface:</p><ul><li>query keys carry model identity,</li><li>mutation keys carry model identity,</li><li>invalidation policy can belong to the model,</li><li>local / cookie / db state still participates in model-owned keying and restore semantics,</li><li>SSR and hydration behavior can follow model rules.</li></ul><p>So the accurate description is not “Model is another store.”</p><p>It is this:</p><blockquote><strong><em>Model is a unified state boundary for query, mutation, persistence, invalidation, restore behavior, and SSR semantics.</em></strong></blockquote><p>That is also why localStorage should not be understood as merely “saving something somewhere.”</p><p>A more precise description is:</p><blockquote><em>local-storage state is not a separate store; it is </em><strong><em>model-owned query state with a local-storage persister</em></strong><em>.</em></blockquote><p>That may sound like a wording change, but it affects the whole architecture:</p><ul><li>which model owns the state,</li><li>how its key space is isolated,</li><li>how restore works,</li><li>who owns invalidation,</li><li>whether it participates in SSR dehydration and hydration behavior.</li></ul><p>In the scattered version, those answers are spread across utilities and conventions.</p><p>In the systematic version, they are pulled back into one model boundary.</p><p>That is the kind of abstraction large systems actually need.</p><h3>Layer 4: pull resource semantics back under a Resource Owner</h3><p>Even teams with both a store and a query layer often continue to fragment at the resource boundary.</p><p>Take a typical list / form / detail resource.</p><p>The frontend still needs to know all of this:</p><ul><li>how the API path is built,</li><li>how the list is fetched,</li><li>how one row is fetched,</li><li>how create / update / delete work,</li><li>where schema comes from,</li><li>how permissions are checked,</li><li>which caches must be invalidated after success,</li><li>how the form layer is wired.</li></ul><p>At that point, the problem is no longer “a piece of state.”</p><p>It is a bundle of <strong>resource semantics</strong>.</p><p>This is where ModelResource becomes especially important:</p><blockquote><strong><em>It allows a model to become not just a query wrapper, but the frontend owner of a resource boundary.</em></strong></blockquote><p>That means the model can own:</p><ul><li>resource bootstrap,</li><li>schema access,</li><li>permission access,</li><li>form integration,</li><li>query state,</li><li>mutation state,</li><li>cache invalidation policy.</li></ul><p>A large amount of logic that would otherwise be scattered across pages, forms, buttons, request wrappers, schema helpers, and permission helpers gets pulled back into one stable boundary.</p><p>The shortest way to say it is this:</p><blockquote><strong><em>The page consumes resource semantics. The model owns query semantics.</em></strong></blockquote><p>That matters because it lifts the discussion from “where should this value live?” to “who owns this entire resource-shaped complexity?”</p><p>And once that resource boundary is stable, pages, forms, permissions, schema, and cache behavior are much more likely to remain stable together.</p><p>That is one of the most valuable properties a large codebase can have:</p><blockquote><strong><em>Not just reusable logic, but reusable boundaries.</em></strong></blockquote><h3>One table to summarize the difference</h3><p>DimensionScattered versionSystematic versionState ownershipwhoever touches it first tends to host itownership is assigned first to Bean / Controller / ModelSharing modelcomposables, provide/inject, stores grow in parallelsharing is discussed through IoC scopesServer dataowned by a separate request or query layerpart of Model&#39;s unified state boundaryLocal persistencelocalStorage / cookie wrappers remain separate utilitieslocal / cookie / db live inside model-state familiesCache keysoften become team-defined stringsnamespaced by model identity and selectorsInvalidationhandled by pages, buttons, and mutation callbacksowned as model policySSR semanticsusually patched through conventionsstructured through app / sys and hydration rulesReading strategyfind hooks and variables, then infer boundariesinspect owner, scope, and model firstComplexity controlmostly maintained by team disciplinemore of it is maintained by structure</p><p>The judgment behind the table is simple:</p><blockquote><strong><em>The scattered version can work, but it manages complexity mainly through discipline. The systematic version moves more of that burden into structure.</em></strong></blockquote><p>Or, more bluntly:</p><ul><li>the scattered version is easier to start,</li><li>the systematic version is easier to scale.</li></ul><p>And large projects are rarely decided by how elegant they felt in week one.</p><p>They are decided by whether the architecture is still legible six months later.</p><h3>Three practical scenarios</h3><h3>1. Page filter state</h3><p>In the scattered version, page-level filter state often evolves like this:</p><ul><li>it starts as a few local refs,</li><li>then moves into a composable,</li><li>then gets saved to localStorage,</li><li>then later moves into a store because another page needs it too.</li></ul><p>That path can work.</p><p>But after enough steps, the crucial questions become harder to answer:</p><ul><li>which page actually owns it?</li><li>is it page-local, resource-level, or app-level?</li><li>is persistence just a UX convenience, or part of the state semantics?</li></ul><p>In the systematic version, the first question is not “should we extract a composable?”</p><p>It is:</p><ul><li>is this page / controller-local state?</li><li>should it instead be mem or local state on a Model?</li><li>does it need model identity in its key space?</li></ul><p>Answer those questions early, and the state tends to keep a much more stable home.</p><h3>2. List query and refresh after create</h3><p>In the scattered version, refreshing a list after creating a record often means:</p><ul><li>manually refetching the list,</li><li>invalidating queries from the page,</li><li>or letting some store action do it as a side effect.</li></ul><p>It works.</p><p>But the refresh rule ends up distributed across multiple call sites.</p><p>In the systematic version, this belongs much more naturally to Model ownership:</p><ul><li>the list query belongs to the model,</li><li>the create mutation belongs to the model,</li><li>the invalidation policy after create belongs to the model too.</li></ul><p>The page consumes a resource action instead of coordinating cache semantics itself.</p><h3>3. Resource forms, permissions, and schema</h3><p>The scattered version usually loses control not at simple fetching, but at the semantics that accumulate around a resource:</p><ul><li>which fields are editable,</li><li>which buttons are visible,</li><li>where the schema comes from,</li><li>which regions refresh after which action.</li></ul><p>If those rules are split across pages, forms, buttons, helper utilities, store logic, and query logic, the codebase becomes only locally understandable.</p><p>The Resource Owner mindset is different:</p><ul><li>pull that semantic bundle back to one stable owner,</li><li>let the page consume it,</li><li>let the model own it.</li></ul><p>That is what effective complex-state management actually looks like.</p><p>Across all three scenarios, the same distinction appears again:</p><blockquote><strong><em>The scattered version solves the immediate problem first. The systematic version places the state inside the right boundary first.</em></strong></blockquote><h3>The systematic version is not free</h3><p>This part matters.</p><p>A more systematic architecture is not a free lunch.</p><p>Its cost includes at least this:</p><ul><li>you accept stronger architectural constraints,</li><li>you need to learn roles like owner, scope, and model,</li><li>you cannot keep treating every piece of state as a local detail that will be sorted out later,</li><li>for small projects, short projects, or one-off pages, the structure may feel heavier than necessary.</li></ul><p>So the conclusion is definitely not:</p><ul><li>every Vue project should be written this way.</li></ul><p>The more accurate conclusion is:</p><blockquote><strong><em>When complexity is still low, the scattered version feels flexible. When complexity keeps rising, the systematic version becomes far more stable.</em></strong></blockquote><p>What you save early is abstraction cost.</p><p>What you usually pay later is boundary cost.</p><p>That is the real trade-off.</p><p>The systematic version does not guarantee that day one feels fastest.</p><p>It gives you a much better chance that day 180 still feels manageable.</p><h3>Final judgment: the ceiling is architectural, not just tool-level</h3><p>If state management is reduced to “which library should we choose,” the conversation remains too shallow.</p><p>In large frontend systems, the more decisive questions are usually these:</p><ul><li>does state have a stable owner?</li><li>are sharing boundaries explicit?</li><li>is cache identity controlled?</li><li>is persistence part of the model’s semantics, or merely a patch?</li><li>are SSR rules structural, or just conventions?</li><li>is resource-level complexity pulled back under one stable owner?</li></ul><p>So the conclusion I would draw is this:</p><blockquote><strong><em>The ceiling of state management in a large project is usually not determined by one library. It is determined by whether the architecture forms a coherent state system.</em></strong></blockquote><p>The scattered version can be fast.</p><p>The systematic version can be steady.</p><p>The former depends more on discipline.</p><p>The latter depends more on structure.</p><p>That is the real value of Zova/Cabloy in large Vue projects: not one isolated capability, but a more consistent system for the things that drift apart most easily:</p><ul><li>ownership,</li><li>sharing,</li><li>cache semantics,</li><li>persistence,</li><li>SSR,</li><li>resource boundaries.</li></ul><p>That is why “Scattered vs Systematic” is more than a catchy title.</p><p>It points to the real engineering question underneath the tooling debate:</p><ul><li>should complex state continue to be held together mainly by people,</li><li>or should more of it be held together by structure?</li></ul><p>If I had to compress the whole article into one closing line, it would be this:</p><blockquote><strong><em>Large Vue projects usually do not need more state tools. They need a state architecture capable of organizing the tools they already have.</em></strong></blockquote><h3>Further reading</h3><p>If you want to keep following this topic, the most useful public references are:</p><ul><li><strong>Reading Zova for Vue Developers</strong> — a bridge from the Vue mental model to the Zova one</li><li><strong>Zova vs Vue 3 Comparison</strong> — a broader side-by-side framing</li><li><strong>IoC and Beans</strong> — the sharing boundaries behind ctx, app, sys, and host</li><li><strong>Model Architecture</strong> — why Model is not just a query wrapper</li><li><strong>Model State Guide</strong> — the data / mem / local / cookie / db state families</li><li><strong>Model Resource Owner Pattern</strong> — why resource-level query, schema, permissions, and invalidation should be owned together</li></ul><p>And if you are working on a Vue system that keeps getting larger and harder to explain, the most useful question may no longer be:</p><ul><li>do we need one more state library?</li></ul><p>It may be this instead:</p><ul><li><strong>can we turn this state system from a scattered assembly into a coherent architecture?</strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15e5c022797b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Large Frontend Performance Is Usually an Architecture Problem Before It Is a Bundle Problem]]></title>
            <link>https://medium.com/@cabloyjs/large-frontend-performance-is-usually-an-architecture-problem-before-it-is-a-bundle-problem-97dfb493a0fd?source=rss-764cf0ae2338------2</link>
            <guid isPermaLink="false">https://medium.com/p/97dfb493a0fd</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <category><![CDATA[ssrs]]></category>
            <category><![CDATA[web-performance]]></category>
            <dc:creator><![CDATA[Uncle Pushui]]></dc:creator>
            <pubDate>Tue, 30 Jun 2026 09:43:36 GMT</pubDate>
            <atom:updated>2026-06-30T10:14:32.675Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why modular boundaries, contract-driven UI, query infrastructure, and SSR matter more than one more round of bundle trimming</em></p><p>Most large frontend teams do not have a “we forgot to optimize” problem.</p><p>They already split bundles, lazy-load routes, compress assets, cache requests, and add SSR where it clearly helps.</p><p>And yet the app still gets heavier.</p><p>One dashboard gets faster, and another one becomes the new bottleneck. A bundle goes down, then creeps back up a few sprints later. Caching improves one flow, while invalidation gets messy somewhere else.</p><p>That is usually the moment when performance stops being just an optimization problem and starts looking like an architecture problem.</p><p>Large frontend applications often stay slow even after teams add code splitting, lazy loading, compression, caching, and SSR. The deeper issue is usually architectural: monolith growth, repeated CRUD page construction, fragmented server-data behavior, and SSR treated as an exception instead of part of the runtime model.</p><p>Most frontend teams already know the usual performance checklist:</p><ul><li>split bundles</li><li>lazy-load routes</li><li>compress assets</li><li>optimize images</li><li>cache requests</li><li>use SSR where it clearly helps</li></ul><p>None of that is wrong. In fact, all of it is worth doing.</p><p>But if the same performance issues keep returning in slightly different forms, the bigger question is not “what should we optimize next?”</p><p>It is whether the system is designed to keep getting heavier as it grows.</p><p>That is the core argument of this article:</p><blockquote><em>Large frontend systems usually stay fast only when the architecture actively resists weight accumulation.</em></blockquote><h3>The real problem is not just slowness. It is slowness that keeps coming back.</h3><p>This is the part many teams recognize instinctively but do not always name clearly.</p><p>A lot of teams approach performance in a familiar loop:</p><ol><li>shrink the bundle</li><li>optimize the slow screen</li><li>cache a few expensive requests</li><li>move selected routes to SSR</li><li>repeat when the next bottleneck appears</li></ol><p>That approach works for a while.</p><p>What it does not explain is why large business applications so often slide back into the same state. In many cases, the reason is structural. The architecture keeps creating new weight faster than the team can remove it.</p><p>You can usually see that happening through four patterns:</p><ul><li>the frontend keeps drifting toward a monolith</li><li>similar CRUD and resource pages are rebuilt over and over</li><li>query and cache behavior varies from team to team</li><li>SSR exists, but only as a special-case feature</li></ul><p>When those patterns are present, performance work becomes reactive by default.</p><h3>1. Weak boundaries quietly turn the frontend into one growing shell</h3><p>A codebase can look modular and still behave like a monolith.</p><p>It may have feature folders, shared utilities, route splitting, and a decent naming convention. But that often amounts to <strong>directory modularity</strong>, not real architectural separation.</p><p>The harder question is whether the system has durable boundaries:</p><ul><li>business boundaries</li><li>bundle boundaries</li><li>runtime boundaries</li><li>delivery-target boundaries</li></ul><p>Without them, every new feature adds a little more shared dependency surface, a little more startup cost, and a little more cross-cutting complexity. No single change looks fatal. The problem is the accumulation.</p><p>That is why large-app performance is often misdiagnosed as “one more bundle problem.” In reality, it is frequently a boundary problem. Once the frontend loses the ability to resist monolith growth, every optimization becomes harder to keep.</p><h3>2. Rebuilding the same resource surfaces again and again also makes the app heavier</h3><p>Another source of weight is repetition at the page layer.</p><p>Large business systems tend to contain many variations of the same basic surfaces:</p><ul><li>list pages</li><li>create and edit forms</li><li>filters</li><li>detail views</li><li>row actions</li><li>resource-oriented admin flows</li></ul><p>When teams hand-build these again and again, the cost is not just duplicated effort. It is also duplicated structure:</p><ul><li>more page code</li><li>more repeated view logic</li><li>more initialization work per screen</li><li>more inconsistency across similar resources</li><li>more rework when backend fields change</li></ul><p>This is where contract-driven UI becomes interesting.</p><p>The point is not that everything should be generated. That is rarely the right target. The more practical goal is to let backend contracts shape the routine parts of the frontend, while keeping custom work for the genuinely product-specific pieces.</p><p>Done well, that has a few compounding benefits: thinner page layers, less drift between backend and frontend, and fewer repeated decisions around the same CRUD patterns.</p><p>At scale, that is not just a DX win. It changes the weight profile of the application.</p><h3>3. Query caching works best as infrastructure, not as a team habit</h3><p>A surprising number of “slow frontend” complaints are really data-path problems.</p><p>You see them in patterns like these:</p><ul><li>too many requests on first entry</li><li>unnecessary refetches when returning to a screen</li><li>multiple components requesting the same data independently</li><li>inconsistent invalidation rules</li><li>awkward SSR prefetch and hydration behavior</li></ul><p>Small apps can get away with this for a while. Large apps usually cannot.</p><p>That is why query caching should be treated as infrastructure. The specific library matters less than the role it plays in the system.</p><p>What matters is whether server-data behavior is:</p><ul><li>consistent</li><li>reusable</li><li>centrally modeled</li><li>compatible with SSR and hydration</li><li>understandable across teams</li></ul><p>If caching arrives late, each team tends to wrap it in its own way. Cache keys drift. Invalidation becomes uneven. SSR support is added later and never feels fully integrated.</p><p>When query behavior is part of the runtime model, the frontend is much more likely to get shared semantics, predictable reuse, and cleaner transitions between server-rendered and client-resumed states.</p><p>In large systems, that kind of coherence matters as much as bundle size.</p><h3>4. SSR becomes more valuable when it includes admin flows, not just public pages</h3><p>SSR is still often discussed as a public-web technique:</p><ul><li>SEO pages</li><li>marketing pages</li><li>content pages</li><li>landing pages</li></ul><p>But some of the heaviest first-load experiences in real applications are internal:</p><ul><li>admin dashboards</li><li>workbenches</li><li>reporting screens</li><li>entry pages that need identity, permissions, menus, layout state, and initial data before they become useful</li></ul><p>If all of that is handled purely on the client, users often sit through a long startup chain before they see the first meaningful screen.</p><p>That is exactly where SSR can help.</p><p>But SSR is most effective when it is not bolted on as a special case. It works best when it lines up with the rest of the architecture:</p><ul><li>modular frontend boundaries</li><li>shared contract surfaces</li><li>query and cache infrastructure</li><li>coherent hydration paths</li></ul><p>That matters not only for public web apps, but also for serious back-office systems where first-use responsiveness shapes the overall feel of the product.</p><h3>Why Cabloy is a useful case study</h3><p>Cabloy is interesting here not because it “solves performance automatically,” but because it brings several of these ideas together in one place.</p><p>In Cabloy Basic:</p><ol><li><strong>Frontend structure is explicitly modular.</strong> Zova organizes capabilities through modules and suites instead of treating the UI as one flat application surface.</li><li><strong>Backend contracts can shape routine frontend surfaces.</strong> DTO, entity, and OpenAPI metadata can feed SDK generation and schema-aware UI helpers for forms, tables, filters, detail views, and actions.</li><li><strong>TanStack Query sits in the foundation.</strong> Zova’s model-state layer builds on it through framework-native abstractions.</li><li><strong>SSR exists for both Admin and Web flavors.</strong> That treats first-load quality as a whole-system concern rather than something reserved for public pages.</li></ol><p>The takeaway is not that every team should adopt Cabloy. The more portable lesson is that large frontend performance improves when these concerns are treated as design choices early, not cleanup tasks later.</p><h3>A better question to ask</h3><p>If your team has already done the obvious optimizations and the app still feels heavy, ask this instead:</p><blockquote><em>Is our architecture structurally designed to keep getting heavier over time?</em></blockquote><p>That question usually reveals more than another isolated bundle audit.</p><p>A strong answer tends to include four things:</p><ol><li>real modular boundaries</li><li>thinner routine UI through shared contracts</li><li>query caching as infrastructure</li><li>SSR integrated into the system model, including admin flows where it matters</li></ol><p>If those pieces are missing, performance wins tend to be temporary. If they are present, the frontend has a much better chance of staying fast as it grows.</p><p>That is the real challenge in frontend performance at scale:</p><blockquote><em>not making one page faster today, but building a system that does not keep getting slower by default.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97dfb493a0fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>