Lib folder now auto-loaded again in Rails 7.1
Many years ago, the lib folder was removed from being auto-loaded in Rails. However, in Rails 7.1 it's back.
You can add autoload_lib to your config, and the lib folder will be added to your application's autoload paths. It does accept an ignore argument, which allows you to, of course, ignore folders in lib. When your new project is generated, it will add the assets & tasks folder to be ignored.
config.autoload_lib(ignore: %w(assets tasks))
There is a caveat that autoloading of lib is unavailable for Rails engines.