Skip to content

akhil-gautam/nextjs-on-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Next.js + Ruby on Rails API

image

Note: Everything is crafted for my pet projects!

Next.js on Rails is an opinionated template for quickly setting up a project with Next.js as the frontend and Ruby on Rails as the backend API.

It follows the best practices of Next.js and Ruby on Rails. It is actively maintained and is a great starting point for new projects.

We have added Docker support to this template. You can find the Dockerfile in the docker directory.

For a quick start, you can run the following command:

docker-compse up

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 accessibile components like modal/dialog

Setup instructions πŸ”ŒπŸ’‘

Manual

  • Ruby 3.0.3
  • Node >= 16.x.x
# run in the root directory
$ bundle install

# create database, migrate & seed
$ rails db:prepare

# install packages and come back to root directory
$ cd frontend && npm install && cd ..

# run the application using Foreman
# services are defined in the Procfile
$ foreman start

Docker 🚒

$ docker-compose up

Screenshots(desktop πŸ–₯ & mobile πŸ“±)

Screenshot 2022-03-30 at 11 52 33 PM

Screenshot 2022-03-30 at 11 52 46 PM

Screenshot 2022-03-30 at 11 52 58 PM

Screenshot 2022-03-30 at 11 53 46 PM

Contribution

Contributions are appreciated! It can be as simple as fixing a typo.

If you're facing any difficulty, create issues in the github repo and I will be happy to help.