SpyneJS

STAGE: Blog

The Next Leap in AI Code Generation Starts with Structure

SpyneJS is available now — it unlocks new ways of building with generated code.

Frank Batista
Frank Batista November 2026 · 7 minutes
VBL and C structure
Separating structure from content lets applications evolve with
human control and understanding.

There is a wall that many of us hit with AI-generated code. The code arrives almost effortlessly, but then turns out to be harder to work with than the code we write by hand.

The reason is a mismatch. AI is a machine writing machine instructions, and it works best with logic and precision. Yet it has been trained to write code the way we did — for a developer-only world that no longer exists.

That mismatch is the wall, and it explains why building applications has not seen the same efficiency gains as generating code.

What changed is the job code has to do. Code is more than just browser instructions. It has become the medium developers and agents collaborate through, the thing we both read and both change.

An agent arrives like an anonymous developer seeing your code for the first time, and after the prompt, the codebase is the only shared understanding there is.

The way we have been building was designed for something else.

Before AI, frameworks gave developers convenience and flexibility in how to organize code, so that a wide range of people could write all of those machine instructions by hand. What was traded away was engineering discipline: clearly defined parts, and strict rules about where they go.

That is the developer-only world, and AI learned to write code from everything built in it. So agents are being directed to write loosely organized code into loosely organized structures. Agents are left guessing, and developers go hunting through the codebase.

Specs and harnesses can ease the guessing, but they only work around a problem that should be solved at its root. Better models work around it, too — yet as models get better at navigating loosely organized code, humans do not get any better at reading it.

As models get better at navigating loosely organized code, humans do not get any better at reading it.

There is an alternative. It is called SpyneJS, and it is available today for building applications with a generated-code process that is both more capable and easier to read.

Instead of relying on the loose conventions agents absorbed from their training, SpyneJS provides a structure built on precise rules: one way to organize an application, using the same objects and the same rules for both developers and agents.

With that shared structure in place, an agent can understand an application without reading every file — and a developer can see what the agent changed, and where.

What SpyneJS makes possible:

  • Shared clarity instead of a black box — code both developers and agents can read and reason about.
  • The codebase as the spec, with far less context kept in outside files.
  • Repeatable assembly over one-off building — applications configured and composed, not developed one by one.
  • Expressive freedom without sacrificing structure, using the full capability of the web platform.
  • Greatly diminished tech debt, and pull requests you can understand before you approve them.
  • Developers who stay in control of production as more of it is automated.
  • Engineering discipline for building applications.

So there is now a choice — between continuing to work around loosely structured code, or building on a shared structure designed for both developers and agents. What you decide determines how well you can understand, direct, and evolve your application as AI capabilities progress.

SpyneJS is available today and works alongside your existing stack. Starting a new application takes a single command:

npx spyne-cli create-app

The application it creates ships with a grammar that your agents read on the first prompt.

#View, Behavior, Logic

That grammar is built on a single architectural pattern: VBL — View, Behavior, Logic. If browsers had a specification for how to combine content into an interactive experience, I think it would look like it.

The pattern provides a way to express any type of browser application. It does this by elevating something long overlooked — Behavior — to a sibling of Views.

A browser application is as much a behavior-capture experience as a display experience. How Behavior and Views are wired together, along with the Logic that drives them, is exactly the information that has been missing from existing codebases.

Making that wiring explicit comes down to one discipline: separate View, Behavior, and Logic by strict rules, keep all three apart from your application's content, and that is what makes the difference.

A browser application is as much a behavior-capture experience as a display experience.

#Evolved in Enterprise, Now Available to Agents

SpyneJS is not new. It has run in production since 2018, including at large enterprise firms, and the structure described here is the one those applications were built on.

What is new is the way that structure reaches an agent: a grammar, shipped with every template, that an agent reads on the first prompt — so the conventions it learned from a decade of other people’s code are set aside, and the application’s own precise rules take their place.

You can see the difference when an agent works under strict VBL rules.

#The Noisemap

The noisemap, available on npm, visualizes where tech debt and hard-to-understand code come from by mapping every file across four roles: View, Behavior, Logic, and Content.

Side-by-side noisemap of Next.js and SpyneJS codebases, showing the distribution of roles within modules.
Next.js: 59 modules • mean mixing 0.243
Roles mixed inside most files — view, behavior, logic and content in one module. This is where much of the friction in AI-generated codebases begins.

SpyneJS: 204 modules • mean mixing 0.003
More parts, each specialized to one role, content kept apart. Every file can be read by its role, by agents and developers alike.

The two maps above show the same application — one built in Next.js, the other ported to SpyneJS — after both were updated by AI in exactly the same way, several times. You can read more about the experiment here.

The noisemap measures how much the structure and content roles are mixed inside each file of a codebase. When behavior and content have no dedicated roles, files are free to mix them, and the result is the tangled code at the heart of so many challenges with AI-generated code.

That mixing is where tech debt collects. When a single file holds several roles, changing one puts the others at risk, and nothing about where the file lives tells you what it is responsible for. When each file holds a single role — as on the right — every change shows up as the exact parts it touched, turning a pull request into something you can understand before you approve it.

#Assembling Applications from Interchangeable Parts

SpyneJS is building toward a system of interchangeable parts — components, features, plugins, services, and design systems assembled into an application rather than coded one piece at a time.

The example below is an early step. It starts with the Application Shell, which already provides a first form of assembly configured with JSON.

From there, designs generated by a Figma agent and a Shopify store were brought together to create a storefront for a fictitious company, Asteroid Metals Co. The code was written in Claude Code, which read the designs through the Figma integration and connected to the store through the Storefront API while I directed each stage and supplied the service credentials.

What matters is how those pieces enter the application: design, content, and commerce all arrive through the same roles and the same channels, with no custom integration code. Measured with the noisemap, mean mixing across its modules is 0.00.

You can view it here: Asteroid Metals Co.

The Asteroid Metals Co. storefront from the integration example, showing a filterable grid of six asteroid metal samples in the light theme.
Asteroid Metals Co., the integration example's storefront, in the light theme generated in Figma.

This example also loads two SpyneJS plugins: the Content Management System plugin, and the Behavior Console plugin, which displays behavior data in real time. You can read the generated code for both integrations: the shopping cart designed in Figma and the Shopify connection.

Design systems fit into this same model of interchangeable parts. Material Design is one of the first to be ported to VBL, letting you build applications that follow Google's Material Design 3 using components rebuilt in SpyneJS. Many components are available now with more on the way, and you can browse the gallery at material.spynejs.com.

#SPYNE: The Stack Built on SpyneJS

SpyneJS is the framework. SPYNE is the web stack being built on top of it — bringing those parts, templates, and tools together into a system for building and authoring web applications.

Available today:

  • The application generator CLI
  • The built-in grammar
  • The Content Management System, which lets you author with local JSON files
  • The Behavior Console, with a real-time preview of events and data

In development:

  • A catalog of interchangeable parts
  • More application templates
  • The SPYNE Workbench for managing and authoring sites

#The Developer’s New Role

With AI writing the code and doing more of the production work, our role is to expand what is possible: to go beyond automating the status quo, and to work with agents rather than be led by them. That is how we stay competitive, and how our applications keep evolving wherever AI takes us.

If you build applications, start here:

npx spyne-cli create-app

Have your agents build your next application with it. Then ask them which structure is better.

With AI writing the code and doing more of the production work, our role is to expand what is possible: to go beyond automating the status quo, and to work with agents rather than be led by them.

Training and Consulting

To follow what is being built, and to be notified when tutorials and training sessions are available, join the mailing list at spynejs.com/subscribe. The aim is an approach to automation that does more than keep developers in the loop.

If your service generates code for its customers — a website builder or a design tool, for example — the SPYNE team would like to work with you. We can show how your service can return more precise and readable generated code, and the difference that makes. Reach us at frank@spynejs.com.



copied