davestewart / nuxt-areas

Simple and scalable folder management for large Nuxt projects
228 stars 1 forks source link

Nuxt Areas

Scalable folder management for large Nuxt projects

Nuxt Areas

Overview

Areas is a Nuxt module that enables you to group related files by "area":

+- src
    +- areas
        +- products                     <- area 1
        |   +- components
        |   |   +- product-list.vue
        |   +- pages
        |   |   +- index.vue
        |   +- store.js
        +- users                        <- area 2
            +- classes
            |   +- User.js
            +- components
            |   +- user-list.vue
            +- pages
            |   +- index.vue
            +- store
                +- users.js
                +- user.js

Co-locating files this way has various advantages:

Nuxt's more "global" concerns such as plugins, modules, static , etc remain in the root, making the overall "shape" of the site more intuitive.

Like Nuxt, Areas builds routes from pages, and registers stores and components.

You can even add areas from external sources, providing a no-code way to share or modularise parts of your application.

Next steps

Docs:

Demo: