Volt Introduction and Docs

Volt Documentation

The following attempts to document all of the features of Volt. While the code is always the final source of authority, we attempt to keep these docs as up-to-date as possible.

App Layout

New volt apps come with a few folders/files out of the box:

name description
app Contains the apps components in subfolders
config Contains app configuration, and code to run on startup (initializers)
config.ru A special file used by rack compatible servers to start the app
spec a folder for all rspec test (or specs).
Gemfile Specifies all gems the project depends on
Gemfile.lock A file generated by bundler that tracks the specific gem version numbers
README.md A markdown file for your project

Most of your apps code will live in component folders inside of app. Apps can be broken up into seperate components to help with code reuse and testing. By default volt generates one component called "main". When you are first learning, you can put everything in "main".


Components contain several standard folders.

name description
assets your static assets: css, js, image, font, etc...
config component specific configuration and dependency management
controllers Classes that orchestrate the presentation of the UI and connecting it to the models
lib Additional ruby code needed for the comonent
models Classes that manage data, permissions, validations, and business logic
views html files that are rendered on the browser to show the app

The next sections of the doc's will take you through each of the parts of components before covering components in more detail.