Much like Magento 1.0, Magento 2 is divided into modules. These modules are meant to encapsulate functionality related to a certain business feature. The framework provides organization for these modules, which can be found in the app/code directory with the following convention: app/code/(vendor)/(modulename).
Under the (modulename) directory, there are a series of nested directories that contain the blocks, helpers, controllers, and models that make up a module. The hierarchy looks like this:

Module architecture with nested directories
The following is a brief description of these directories and the programmatic roles of the files they contain:
Block/: This directory has PHP classes that contain logic to manage the view template. Blocks, therefore, are fundamentally related to display logic and are key to managing this logic.Controller/: This directory contains controllers for the module. A controller is responsible for routing requests in Magento, and handles requests by defining actions in controller class methods. These methods collect relevant data, and prepare and render the view.etc/: The etc/ directory contains files related to Magento configuration. For example, the module.xml file, a required file, contains information about the module version number and name.Model/: This directory has files that provide logic related to the model. The model provides abstraction for managing data from the relational database underlying Magento. Class methods here will allow you to perform CRUD (create read update, and delete) operations without the use of SQL (Structured Query Language), by providing an interstitial layer that generates SQL as a result of method invocation.Setup/: This directory contains classes for the setup of a new database structure and the data it needs to contain. This code is invoked when the module is installed.Api/: The Api/ directory contains module classes that are exposed to the Magento API, making them available to API calls.I18n/: This directory contains module language files used for localization.Plugin/: This directory contains plugins that can be used to extend the functionality of any public method in a Magento class. We'll discuss this directory in greater detail in the section immediately following this one.view/: This directory contains view files, including static templates, design templates, and layout files. We have discussed the contents of this directory and theming in general in greater detail in Chapter 3, Designs and Themes.