Project Structure of an Ionic App
Learn about the architecture of an Ionic application.
We'll cover the following...
Default file structure
If we navigate to the root directory of an Ionic app, we should see a default structure that resembles the following:
For those new to Ionic development, the above structure might seem a little intimidating at first. Throughout this lesson, though, we’ll break each part of the app down so we fully understand their purpose.
In all honesty, we will spend most of our development time within the src subdirectory with some possible configuration changes to the capacitor.config.json and package.json files (we’ll cover what these might entail during later chapters).
The root directory
Our default project root directory consists of the following files and directories:
-
The
.browserslistrcfile is used by the Ionic build system to adjust the output CSS and JS to support the browsers that are specified within this file. -
The
.editorconfigfile helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. -
The
.eslintrc.jsonfile is used to lint, or check, ECMAScript or JavaScript files for any formatting issues and code errors. -
The
.git/directory isA local git-based repository that is used for version control of project assets. -
The
.gitignorefile comes into play when using a git-based repository (such as GitHub or Bitbucket) for version control. The.gitignorefile states what should be excluded from commits and pushed to the repository. -
The
android/directory is added for the Ionic project via Capacitor only after the firstionic buildprocess has been run. -
The
angular.jsonfile is used to define the configuration schema for the whole project, including values such as where project source files are located, custom prefixes for components, and automated task commands. -
The
capacitor.config.jsonfile is used to define the configuration for the Capacitor tooling. -
The
e2e/directory is used to store End-to-End tests (also ...