Isolated learning atmosphere · v4.x
Nuxt Layers: The Basics
Based on the official Nuxt release notesThis site had a problem. It started as a blog. Then it grew a learning platform — tutorials, step pages, progress tracking, an RSS feed of its own — and both halves ended up in the same app/ directory, fighting for the same folders.
Two products, one Nuxt app. That's the situation layers exist for.
A layer is a Nuxt application you inherit from. Not a plugin, not a module — an ordinary Nuxt directory structure with a nuxt.config.ts, that another Nuxt app can pull in wholesale with one config line. Pages, components, composables, server routes, content: all of it merges into the consuming app as if you'd written it there.
This series targets Nuxt 4.x. Everything here is running on the page you're reading — /learn is served by a layer, /blog is not. The capstone is the commit that split them.
What we cover here#
- What a Layer Actually Is —
extends, the auto-scannedlayers/directory, and where layers sit next to modules. - Your First Layer — a real one, in about four files, that you can watch take effect.
- Precedence and Overrides — who wins when two layers define the same file, and how to override one file without forking a layer.
By the end you can take any folder of shared Nuxt code and make it inheritable.
Where it goes next#
- Nuxt Layers: Going Further — Intermediate. Layers as workspace packages, what a layer can own, and the relative-path trap.
- Nuxt Layers: Advanced — Advanced. Remote layers, layer-vs-module, testing and publishing.
- Nuxt Layers Capstone: Splitting This Blog — Advanced. The real migration, on this codebase, deployed.
How this series works#
Each step follows the same path: What it is → Why you'd care → Before → After → Do it yourself → Gotchas → Recap.
Every snippet is from packages/learn-layer in this repo — the layer serving this page.