The highly productive Julia web framework

View the Project on GitHub GenieFramework/Genie.jl

Customized application configuration with initializers

Initializers are plain Julia files which are loaded early in the application cycle (before routes, controller, or models). They are designed to expose configuration code which might be needed later on in the application life cycle.

Initializers should be placed within the config/initializers/ folder and they will be automatically included by Genie.

If your configuration is environment dependent (ie a database connection which is different between dev and prod), it should be added to the corresponding config/env/*.jl file.

Best practices

Load order

The initializers are loaded in the order they are read from the file system. If you have initializers which depend on other initializers, this is most likely a sign that you need to redesign using a model or library file.


Library files are Julia files which provide distinct functionality and can be placed in the lib/ folder where they are also automatically loaded by Genie. If the lib/ folder does not exist you can create it yourself.


All the definitions (variables, constants, functions, modules, etc) added to initializer files are loaded into your app’s module. So if your app is called MyGenieApp, the definitions will be available under the MyGenieApp module.


Given the your app’s name is variable, you can also access your app’s module through the UserApp constant. So all the definitions added to initializers can also be accessed through the UserApp module (UserApp === MyGenieApp).


This is Genie’s default (bundled) initializers for loading the SearchLight ORM. Please notice that the initializers does contain database configuration information, which is defined in a dedicated, environment dependent file. The initializer simply delegates the configuration loading and setup to the SearchLight package.

using SearchLight, SearchLight.QueryBuilder


if SearchLight.config.db_config_settings["adapter"] !== nothing