New Project

We’ll use jets new to generate a new Jets project.

jets new demo --mode job

The --mode job option generates a Jets project designed for jobs.

❯ jets new demo --mode job
    create  .env
    create  .gitignore
    create  Gemfile
    create  Rakefile
    create  app/jobs/application_job.rb
    create  config/application.rb
    create  config/environments/development.rb
    create  config/environments/production.rb
    create  config/environments/test.rb

The project structure is nice and lightweight for job mode. For more information about the folders, see Project Structure.

Application Config

Let’s take a look at the starter application config. It looks something like this:


module Demo
  class Application < Jets::Application
    config.load_defaults 5.0
    config.project_name = "demo"
    config.mode = "job"
    config.prewarm.enable = false

The project_name will be used when we deploy this project. The project that is deployed will have the environment added, IE: demo-dev. Since this app is for jobs, prewarming is set to false.

You can override settings for each environment with the files in config/environments. Example:


Jets.application.configure do
  config.cache_classes = false
  config.eager_load = false
  config.logging.event = false

For more settings see the Config Reference.

Next, we’ll explore project files and write some code.