Skip to main content

Overview

Layer - the first level of application partitioning, according to the scope of influence of the module

layers-flow-themed

Structure

└── src/
β”œβ”€β”€ app/ # Initializing application logic
β”œβ”€β”€ processes/ # (Optional) Application processes running over pages
β”œβ”€β”€ pages/ # Application Pages
β”œβ”€β”€ widgets/ # (Optional) Independent widgets
β”œβ”€β”€ features/ # Crucial functionality of the application
β”œβ”€β”€ entities/ # Business entities
└── shared/ # Reused modules

Rules

  • Each layer is located only at the topmost level, and cannot occur again at another nesting level

    // Bad
    - pages/../features/..
    - features/../entities/..
    // Good
    + pages/**
    + features/**
  • Each layer can use (import) only the underlying layers
  • The higher the layer is located, the higher the level of its responsibility and knowledge about other layers (from top to bottom)
    • app > (processes) > pages > (widgets) > features > entities > shared
  • The lower the layer is located , the more it is used in the upper layers, and therefore the more dangerous it is to make changes to it (from bottom to top)
    • shared > entities > features > (widgets) > pages > (processes) > app
LayerCan useCan be used by
appshared, entities, features, widgets, pages, processes-
processesshared, entities, features, widgets, pagesapp
pagesshared, entities, features, widgetsprocesses, app
widgetsshared, entities, featurespages, processes, app
featuresshared, entitieswidgets, pages, processes, app
entitiessharedfeatures, widgets, pages, processes, app
shared-entities, features, widgets, pages, processes, app

Representatives

note

It should be understood that not all of the above layers are mandatory, but are needed only when the complexity of the project and the swelling responsibility in the existing structure require it

app

app-themed-bordered

processes

processes-themed-bordered

pages

pages-themed-bordered

widgets

widgets-themed-bordered

features

features-themed-bordered

entities

entities-themed-bordered

shared

shared-themed-bordered

See also