Modulorails is the common base for the Ruby on Rails project at Modulotech.
It registers each application using it on the company's intranet, provides templates for the common configurations and defines common dependencies.
Add this line to your application's Gemfile:
gem 'modulorails'And then execute:
$ bundle install
To work the gem needs to be configured. Add an initializer config/modulorails.rb:
Modulorails.configure do |config|
config.name 'The usual name of the application'
config.main_developer 'The email of the main developer/maintainer of the application'
config.project_manager 'The email of the project manager of the application'
config.endpoint 'The url to the intranet'
config.api_key 'The API key'
endModulorails automatically generates a .devcontainer/ configuration for VS Code and compatible IDEs:
Dockerfilefor the development containercompose.ymlwith database, Redis, and mailcatcher servicesdevcontainer.jsonfor VS Code integration
Two helper scripts are provided in bin/:
bin/dc- Wrapper fordocker composecommands targeting the devcontainerbin/dcr- Wrapper fordocker compose runwith proper TTY and Git configuration
Usage:
bin/dc up -d # Start services in background
bin/dc logs -f app # Follow app logs
bin/dcr rails console # Run Rails console in container
bin/dcr rspec # Run tests in containerModulorails can configure your devcontainer for efficient use with Claude Code:
- Persistent bash history across container restarts
- Claude Code configuration volume
- Firewall initialization script
Modulorails detects and supports the Bun JavaScript runtime. When bun.config.js is present, the devcontainer will include appropriate JS and CSS build services.
- RubocopGenerator - Configures
.rubocop.ymlwith Modulotech standards - BundlerauditGenerator - Sets up bundler-audit for security checks
- GithooksGenerator - Installs git hooks for automated checks
- HealthCheckGenerator - Configures the health_check gem
- SidekiqGenerator - Adds Sidekiq background job processing
The following features are deprecated and will be removed in version 2.0:
config.staging_urlconfig.review_base_urlconfig.production_urlconfig.no_auto_update
Modulorails::BaseService#log- UseRails.logger.debugdirectlyModulorails::LogsForMethodService- UseRails.logger.debugdirectly
The following generators are deprecated and will be moved to Moduloproject 3.0:
Modulorails::DockerGenerator(and all sub-generators)Modulorails::GitlabciGeneratorModulorails::ClaudeCodeGeneratorModulorails::ModuloprojectGeneratorModulorails::SidekiqGeneratorModulorails::SelfUpdateGenerator(will be removed entirely)
There are tests in spec. To run tests:
- Build Docker images using
docker compose build. - You can run tests on all supported Ruby versions using
docker compose up. - Or you can run test on a specific Ruby version using one of the following commands:
- Ruby 2.5:
docker compose run ruby25 - Ruby 2.6:
docker compose run ruby26 - Ruby 2.7:
docker compose run ruby27 - Ruby 3.0:
docker compose run ruby30 - Ruby 3.1:
docker compose run ruby31
- Ruby 2.5:
Appraisal is used to test the gem against many supported Rails versions:
- Rails 5.2, 6.0 and 6.1 on Ruby 2.5 and 2.6.
- Rails 5.2, 6.0, 6.1 and 7.0 on Ruby 2.7, 3.0 and 3.1.
Bug reports and pull requests are welcome on GitHub at https://github.com/moduloTech/modulorails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Modulorails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.