Folder structure

Public and private paths

Most of the code you write will be private, as in not visible to the browser. Though some folders are automatically included with the main client file.

Public folders

The files in these folders are automatically included in the client-file: (And thus those classes are available in the browser too)

- /element/
- /helper/
- /helper_controller/
- /helper_field/
- /helper_model/

Private folders

The files in these folders are never sent to the browser:

- /config/
- /controller/
- /lib/
- /migrations/
- /model/

Path explanation

All of your project code should go into an app directory.
That directory can contain many subdirectories. Most of those files are auto-required on boot.

The directories (and some of their basic files) are:

  • assets: Assets served through some kind of middleware
    • images: Static images
    • scripts: Client-side only javascript files. Served at /scripts/ url.
    • stylesheets: SCSS and LESS stylesheet files. Served at /stylesheets/ url.
  • config: Project configuration
    • bootstrap.js: Place where all plugins should be loaded
    • default.js: Default configuration
    • local.js: Configuration file that overrides all others. Is required for the environment definition. Should not be checked into git.
    • prefixes.js: Place to define which prefixes (locales/languages) are used on the site
    • routes.js: Routes should be defined here
  • controller: Actual controllers
    • app_controller.js: Basic controller instance your other controllers should inherit from
  • element: All custom elements of your project
    • app_element.js: Basic custom element your other custom elements should inherit from.
  • helper: Custom "helper" classes that are available in the Hawkejs template engine
    • app_helper.js: Basic helper your other helpers should inherit from.
  • helper_field: Create custom field definitions
  • helper_model: Used when you want to customize a browser-side's default model/document implementation
  • lib:
    • Put classes here that are only needed on the server.
  • model: All your models
    • app_model.js: Basic model your other models should inherit from.
  • public:
    • Files put in here will be publicly available under the /public/ url.
  • root:
    • Files put in here will be publicly available under the root url (So /)
  • view:
    • Template files go in here, preferably with a .hwk extension, though regular .ejs files also work. They are currently both treated equally.

You don't have to create this structure by hand, you can (and should) use the alchemy-skeleton repository for that. This is explained on the Installation page