Skip to content

Scaffold

A scaffold is the temporary structure that supports a build until the build can support itself; in software, scaffolding generates the boilerplate skeleton of a project so the developer can focus on the unique part.

Definition

What it is

In construction, a scaffold is a temporary frame erected around a building under construction. It is not part of the building; it is the structure that lets workers reach the building. When the building stands, the scaffold comes down.

In software, scaffolding is the same idea applied to a codebase. A scaffolder generates the files, folders and configuration that every project of a given kind needs: rails new blog creates a Ruby on Rails app, django-admin startproject mysite creates a Django project, npx create-react-app my-app creates a React app, npm init vite@latest creates a Vite project. The generated files are not the application; they are the frame the application grows on.

Why it matters

Every project of a given kind shares a common skeleton: directory layout, package manifest, test runner, linter configuration, CI file, gitignore, README. None of that is unique. A scaffolder encodes the common part once and gives the developer the unique part for free.

Scaffold vs template vs boilerplate

Aspect

Scaffold

Template

Boilerplate

Mechanism

Generator + prompts

Copy/paste

Manual inclusion

Customization

Interactive, per project

None

Manual

Example

rails new

GitHub template repo

Copyright notice

Drift risk

Low: regenerated per version

High: stale repo

None

The scaffold lifecycle

  1. Day 1 — Scaffolder generates the baseline: files, folders, config.

  2. Week 1 — Developer modifies files to fit the actual project.

  3. Month 1 — Scaffold is invisible: the project has absorbed it.

  4. Year 1 — Project upgrades its scaffold pattern via rails app:update or similar.

  5. End of life — When the framework changes direction, the scaffold becomes technical debt.

Where scaffolds help

graph LR
  A[Empty folder] -->|scaffold| B[Working skeleton]
  B -->|edit| C[Application code]
  C -->|deploy| D[Running product]
  A -->|no scaffold| E[Manual config, days of work]
  E --> C
  style A fill:#FFF3E0
  style B fill:#E8F5E9
  style D fill:#E8F5E9

How to use a scaffolder well

Using a scaffolder without inheriting debt

  1. Scaffold once, at the start

    Re-scaffolding into a live project overwrites your work. Scaffold on day 0 or not at all.

  2. Read the generated code

    A scaffold you do not understand is a black box. Read the files it creates; delete what you do not need.

  3. Do not fight the defaults

    If the scaffolder's default is wrong for your case, edit the config. Do not maintain a fork of the scaffolder.

  4. Version the config

    Commit the files the scaffolder produces. Later, the diff between what you have and what a new scaffold would produce is your upgrade plan.

Common failures

Origin

The word entered English in the 14th century from Old French eschafaut (ultimately from Latin scaffaldus, a raised platform for viewing). Its first sense was a raised stage for spectators or executioners; the construction sense, a temporary frame around a building, came later. In the 1990s, the object-oriented frameworks that generate project skeletons adopted the metaphor: the skeleton is the frame, the application grows on it, and once the application stands on its own, the scaffold is invisible.

Scaffolding is code generation for the common case, so you can spend your time on the uncommon case.

— Ruby on Rails Guides, *Getting Started*, 2024 (paraphrase)
14th c. · "scaffold" en inglés, plataforma elevada
2004 · Rails scaffolding (v0.9)
2005 · Django `startproject` y `startapp`
2016 · create-react-app populariza el scaffolding JS
2020 · Vite `create-vite` reemplaza parcialmente a CRA

Evidence

FAQ

Scaffold vs template?

A template is copied verbatim. A scaffold is generated by a program that adapts to project name, options and ecosystem. Templates drift; scaffolds can be regenerated.

Should I commit the scaffolded code?

Yes. The generated files are the baseline of your project. Committing them makes upgrades and diffs possible.

When to regenerate?

When the framework ships a major update that changes project layout, or when starting a new project. Never inside a live one.

Why read the generated code?

Because you will maintain it. Code you do not understand is code you cannot debug, upgrade or delete.

Connections

Etymology

Origin: borrowed

  • scaffold (noun): from Old French eschafaut, from Latin scaffaldus, a raised platform

Semantic network

Scaffoldsoftware-dcode-generboilerplattemplatecode-generframeworkTechnical

● broader ● narrower ● related

Broader

  • software-development
  • code-generation

Related

Used in the garden

Sources