Application directory layout

IBM® WebSphere® sMash applications have a particular layout for their directory structure. This layout provides both organization around the parts that make up your application and convention around how your application works.

If you follow the conventions and structure defined by WebSphere sMash, your application will be easier to construct and maintain and you will have less configuration information to provide with the application. The following table summarizes the directory structure.

Directory or File Description
app The scripts and templates for key components of the application.
app/errors Custom error pages that handle errors produced by the application. See HTTP error handling for more information.
app/resources The set of RESTful resources provided by the application. See Resource (REST) handling for more information.
app/resources/employees.groovy Each script under app/resources implements the behavior of a resource. See Resource (REST) handling for more information.
app/resources/employees.bnd Each script under app/resources can have an optional bonding file of the same name that specifies the valid relationships between resources. See Resource (REST) handling for more information.
app/scripts The shared scripts that are used within your application. Scripts in this folder are not directly accessible through a URL; they are included in other scripts. Normally, this folder contains script functions that are used multiple times by other parts of your application.
app/views The script implementations of views. Views are reusable pieces of rendering logic for creating presentation markup (HTML) or data (XML or JSON). Views are usually templates (.gt) or scripts (.groovy) that handle the RENDER event. See Response rendering for more information.
classes The Java class files that are a part of the application. The files are contained in a directory structure that matches the Java package structure.
config The configuration files for your application.
config/ivy.xml The dependency information for your application. See the Dependency Management section for more information.
config/zero.config The configuration file for your application. See Configuration for more information.
config/php.ini The configuration file to modify the behavior of the PHP runtime. See the PHP documentation for more information.
java The Java source files. This directory is usually present at development time only, and is not excluded at production time. The directory structure under java must match the Java package structure.
lib Additional jar files that are required by an application, but that are not included by the extension modules declared in the config/ivy.xml file. After adding or removing jar files in lib, run 'zero resolve' and restart your application for the changes to picked up in your application's classpath.
logs The log and trace files produced by your application when it is running. The exact contents of the files depend on your log settings. See the Logging and tracing section for more information.
public The Web accessible root folder of the application. http://localhost:{port}/ serves the index page from this folder, and any subdirectories are reflected in the URL. The public folder can contain static content, such as HTML, images/ApplicationLayout, CSS, or JS, scripts, such as .groovy and .php, and templates, such as .gt. See File serving for more information.
reports The IVY dependency report shows details of the dependencies that you have on extension modules. This information describes what your application is using, which is useful during both development and production.
.zero This directory is created by the WebSphere sMash engine on behalf of the application to hold any generated files needed by the runtime. The files in this directory do not need to be edited or be maintained.
.zero/private/resolved.properties This file is generated by the tooling based on the application's dependencies specified in config/ivy.xml, and it is used by the WebSphere sMash runtime to set up among other things the classpath for the application. You do not have to edit or maintain it.


The following image shows the tree view of a sMash application.

This image shows a tree view of a sMash application.

Version 1.1.30763