Overview:
Next.js on Rails is an opinionated template that combines the frontend framework Next.js with the backend API framework Ruby on Rails. It is designed for quickly setting up projects and follows the best practices of both Next.js and Ruby on Rails. The template is actively maintained and serves as a great starting point for new projects. It also includes Docker support for easy deployment.
Features:
Backend:
- User Authentication using JWT
- User Authorization using Pundit
- Organizations support (Feature in progress)
- Interactor Pattern for API using interactor gem
- premailer-rails for styling emails with stylesheets
- pagy for faster pagination
- jb for a fast JSON API builder
- MiniTest for testing
- SimpleCov for code coverage
Frontend:
- User Signup and Login
- User Profile
- All basic components under components/shared
- DaisyUI for creating additional components
- react-cookie for sharing tokens in SSR
- zustand as minimal state management library
- @headlessui/react for accessible components like modal/dialog
Installation:
To set up Next.js on Rails, make sure you have Ruby 3.0.3, Node >= 16.x.x, and Docker installed.
- Clone the GitHub repository.
- Open a terminal and navigate to the cloned directory.
- Run the following command:This command will build the Docker image and start the containers.
docker-compose build && docker-compose up -d - Access the application by visiting http://localhost:3000 in your browser.
Summary:
Next.js on Rails is a template that combines the power of Next.js and Ruby on Rails for rapid project setup. It provides features such as user authentication, authorization, organizations support, and various frontend components. The template is actively maintained and includes Docker support for easy deployment. Installation is straightforward and requires Ruby, Node, and Docker. Overall, Next.js on Rails is a great starting point for new projects that can be customized to fit specific needs. Contributions are also welcome on the GitHub repository.