Project

nextgen

0.03
The project is in a healthy, maintained state
Nextgen is an interactive and flexible alternative to `rails new` that includes opt-in support for modern frontend development with Vite.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.8.1
~> 7.1.1
~> 1.2
~> 0.23.1
~> 2.6
 Project Readme

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
Support | License | Code of conduct | Contribution guide

Screen recording of Nextgen in action

Requirements

Nextgen generates apps using Rails 7.1.

  • Ruby 3.1+ is required
  • Rubygems 3.4.8+ is required (run gem update --system to get it)
  • Node 18.12+ and Yarn are required if you choose Vite or other Node-based options
  • Additional tools may be required depending on the options you select (e.g. PostgreSQL)

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 7.1 like a production-ready Dockerfile, 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

Nextgen can optionally set up a GitHub Actions CI workflow for your app that automatically runs tests, linters, and security checks 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.

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:

  • All frontend sources (CSS, JS, images) are moved to app/frontend
  • A yarn start script is used to start the Rails server and Vite dev server
  • The autoprefixer package is installed and activated via PostCSS
  • A base set of CSS files are added, including modern_normalize
  • A Vite-compatible inline SVG helper is added
  • The stimulus-vite-helpers package is installed (if Stimulus is detected)
  • vite-plugin-ruby is replaced with the more full-featured vite-plugin-rails
  • Sprockets is removed and the asset pipeline is disabled
  • Vite's autoBuild is turned off for the test environment

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!