Generate, don't scaffold: the Fractal Sierpinski motif with a regenerate arrow.

Generate, don't scaffold

TL;DR

  • A scaffold writes code once and walks away. Every change after that is manual.
  • Fractal regenerates the whole application from a model, every time the model changes.
  • Your own code lives in marked places, so regenerating is routine instead of risky.

Most frameworks offer a generator. Run a command, name a resource, and you get a model, a controller, a few views and a migration. It feels like a head start, and on day one it is.

Scaffolding is a one-way door

Two charts over time: scaffolded code drifts further from the model after day one, while generated code is pulled back in line with the model at every regeneration.

A scaffold helps on day one. After that, the model and the code drift further apart with every manual change.

The trouble starts on day two. A scaffold is a one-off: it writes files and walks away.

From that moment on, the generated code is just code. Every change to your domain becomes a manual change in five or ten places.

One new field, seven places to touch

Adding Invoice.due_date: with scaffolded code it means seven manual edits across database, domain object, API schema, forms, list views, permissions and tests, one of them forgotten; generated from the model it is one change and every layer follows.

Add one field to a scaffolded app and you edit every layer by hand. Generate from a model and every layer follows.

Add a field and you touch the database, the domain object, the API schema, the forms, the list views, the permissions and the tests.

Miss one and you have a bug that no generator will ever help you find.

Make the model the source of truth

From model to running software: a Studio model of entities, commands, roles and workflows goes through the generator into a readable codebase in your repository, with optional modules, and is deployed as a running app.

The model goes in, a complete and readable codebase comes out: not once, but every time the model changes.

Fractal takes a different route. Instead of generating code once, it keeps a model of your domain (entities, fields, value objects, commands, queries, workflows and roles) and generates the application from that model every time it changes.

That changes what the generator is for. It is no longer a shortcut you use at the start of a project; it is part of how the project evolves.

Add a field in the studio and regenerate, and every layer that depends on it follows: the API, the portal, the permissions and, when the MCP module is switched on, the MCP tools. The layers stay consistent because they come from the same place.

Your own code survives the next run

The layers of a generated codebase: portal, adapters, application and domain, with dependencies pointing inward and a custom/ folder alongside each layer.

Every layer has a custom/ folder beside it. Regeneration rewrites what the generator owns and leaves those folders alone.

This is the question that sinks most regeneration approaches. Real software is never fully generated.

The rules that make your business different, the integrations, the edge cases: that is code a person writes, and it must survive the next run of the generator.

In Fractal, hand-written code lives in clearly marked places that the generator respects: custom/ folders, and blocks between # FRACTAL custom begin and # FRACTAL custom end markers inside generated files.

Regenerating becomes routine, not risky

Regeneration as a three-way merge: a model change produces fresh output on the vanilla lineage, which is merged into main with your custom commits; custom code is preserved, the change lands everywhere, and real conflicts are surfaced.

Fresh output lands on a generator-only lineage and is merged into your work with a real three-way merge.

Each regeneration produces fresh output on a generator-only "vanilla" lineage, which is merged into your main branch with a real three-way merge. Where changes truly overlap, you get ordinary conflict markers instead of silently lost work.

Regeneration rewrites what it owns and leaves your work where it is. So you regenerate often, and the code never drifts away from the model.

Software that stays cheap to change after launch

For developers, it means less time on plumbing and more on the parts that need thought.

For the business, it means software that stays cheap to change long after the first release, which is when most custom software starts to get expensive.

Scaffolding gives you a head start. Generation keeps you moving. Want to see what that looks like on your own domain? Book a demo.