Directory Structure

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

    project-root | +-- lib/ | +-- ui/ | +-- serverless/ | +-- parameters.yaml | +-- tsconfig.somod.json | +-- package.json

    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.

    project-root | +-- build/ | | | +-- lib/ | | | +-- ui/ | | | +-- serverless/ | | | +-- parameters.json | +-- package.json

    When 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.

    project-root | +-- pages/ --+ +-- public/ | PREPARED NEXTJS PROJECT +-- .env | +-- next.config.js --+ | +-- .somod/ --+ +-- template.yaml --+ PREPARED SAM PROJECT | +-- parameters.json --- PARAMETRS USED to PREPARE
    • .somod is the SOMOD working directory, during the prepare phase SOMOD bundles lambda functions and function layers from all modules into this directory.
    • template.yaml is the prepared SAM Template.
    • pages/, public/, .env, next.config.js are part of prepared NextJs project.
    • parameters.json contains 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

Does this page need improvements?
Edit This Page in GitHub
Did this page help you?
Provide feedback in the GitHub Discussion Page
Need More help?

Write an email to

This documentation is built using
Developed and Maintained By
Sodaru Technologies
© 2023