To understand the structure of a SOMOD module, let's explore the working of SOMOD.
SOMOD works in 3 phases, Develop, Build and Prepare.
In Develop phase, the developer writes the code in the defined structure. SOMOD module contains Infrastructure, Backend, and Frontend code.
The directory structure in this phase is
Let's explore these individual files and directories in their respective chapters in the upcoming sections.
The Build phase validates the source code and generates a distributable code.
The build directory looks like this.
npm tries to publish the SOMOD module, only the build directory is included in the published package. Read more about npm publish here
The Prepare phase combines the code from all dependency modules to generate AWS SAM and NextJs Projects.
The generated files look like this.
.somodis the SOMOD working directory, during the prepare phase SOMOD bundles lambda functions and function layers from all modules into this directory.
template.yamlis the prepared SAM Template.
next.config.jsare part of prepared NextJs project.
parameters.jsoncontains values for each parameter and needs to be provided by the user before running the prepare command.
We will be exploring each of these files and directories in upcoming chapters. Let's start with
lib in the next section