Mastering Web Application

(Rick Simeone) #1
Chapter 2

Here are some basic assumptions leading us to the high-level directory structure:



  • Source code for the application and the accompanying tests should be
    clearly separated. This is to keep the build system easy to maintain, as
    there are usually different sets of build tasks to be executed for tests and
    for the source code.

  • Third-party code for any external libraries should be clearly isolated from
    our internal code base. External libraries will be changing at the different
    pace as compared to our deliverables. We want to make it easy to upgrade
    external dependencies at any time. Mixing our sources with external libraries
    would make such upgrades harder and time consuming.

  • Build-related scripts should reside in their own dedicated folders and not be
    scattered through the code base.

  • Build results should be outputted to a separate folder. The content and
    structure of the build output should closely match the one mandated by the
    production deployment requirements. It should be very easy to just grab the
    output of the build and deploy it in its final destination.


Taking all of the above assumptions into consideration we ended up with the
following set of top-level directories in the project:



  • src: It contains application's source code

  • test: It contains accompanying automated tests

  • vendor: It contains third party dependencies

  • build: It contains build scripts

  • dist: It contains build results, ready to be deployed in a target environment


Finally, here is the top-level folders structure visualized:

Free download pdf