Home

Awesome

Nextgen

Gem Version Gem Downloads GitHub Workflow Status Code Climate maintainability

Nextgen is an interactive and flexible alternative to rails new that includes opt-in support for modern frontend development with ⚡️Vite.

Requirements | Usage | Examples | What's included<br> Support | License | Code of conduct | Contribution guide

Screen recording of Nextgen in action

Requirements

Nextgen generates apps using Rails 8.0.

Going forward, my goal is that Nextgen will always target the latest stable version of Rails and the next pre-release version. Support for Node LTS and Ruby versions will be dropped as soon as they reach EOL (see Ruby and Node EOL schedules).

Usage

To create a new Rails app with Nextgen, run:

gem exec nextgen create myapp

This will download the latest version of the nextgen gem and use it to create an app in the myapp directory. You'll be asked to configure the tech stack through several interactive prompts. If you have a ~/.railsrc file, it will be ignored.

[!TIP] If you get an "Unknown command exec" error, fix it by upgrading rubygems: gem update --system.

Examples

Check out the examples directory to see some Rails apps that were generated with nextgen create. RSpec, Vite, and vanilla Rails variations are included.

What's included

Nextgen starts with the "omakase" default behavior of rails new, so you get the great things included in Rails 8.0 like RuboCop, a GitHub Actions CI workflow, your choice of database platform, CSS framework, etc. You can also interactively disable parts of the default stack that you don't need, like JBuilder or Action Mailbox.

On top of that foundation, Nextgen offers dozens of useful enhancements to the vanilla Rails experience. You are free to pick and choose which (if any) of these to apply to your new project. Behind the scenes, each enhancement is applied in a separate git commit, so that you can later see what was applied and why, and revert the suggestions if necessary.

[!TIP] For the full list of what Nextgen provides, check out config/generators.yml. The source code of each generator can be found in lib/nextgen/generators.

Here are some highlights of what Nextgen brings to the table:

GitHub Actions

If you've opted into GitHub Actions, Nextgen will automatically add jobs to your CI workflow based on the gems and packages you have installed.

Minitest or RSpec

Prefer RSpec? Nextgen can set you up with RSpec, plus the gems and configuration you need for system specs (browser testing). Or stick with the Rails Minitest defaults. In either case, Nextgen will set up a good default Rake task and appropriate CI job.

Yarn or npm

Prefer npm? Nextgen allows you to choose Yarn or npm to manage your app's JavaScript dependencies. Your Dockerfile, CI jobs, bin/setup script, etc. will be adjusted appropriately.

[!NOTE] As of Rails 8.0, rails new is still hard-coded to use Yarn in some places. Therefore you may still need Yarn installed on your system in order to generate a new app. Nextgen will remove these Yarn references from your generated project if you select the npm option.

Opinionated RuboCop Config

By default, Rails apps include RuboCop with a config defined by the rubocop-rails-omakase gem. Nextgen allows you to opt out of RuboCop entirely, or use Nextgen's own custom RuboCop config. Nextgen's config will automatically include Capybara, FactoryBot, and RSpec rules, should your app include those frameworks.

Gems

Nextgen can install and configure your choice of these recommended gems:

Node packages

Nextgen can optionally install and configure these Node packages to work nicely with Rails:

Vite

Vite (pronounced veet) is a next generation Node-based frontend build system and hot-reloading dev server. It can completely take the place of the asset pipeline and integrate seamlessly with Rails via the vite_rails gem. If you opt-in, Nextgen can set you up with Vite and adds a bunch of vite_rails best practices:

These recommendations are based on my experience using Vite with Rails in multiple production apps. For additional background on these and other Vite-related changes, check out the following blog posts:

Support

If you want to report a bug, or have ideas, feedback or questions about Nextgen, let me know via GitHub issues and I will do my best to provide a helpful answer. Happy hacking!

License

Nextgen is available as open source under the terms of the MIT License.

Code of conduct

Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Contribution guide

Pull requests are welcome!