Skip to content

A starting point for your Ruby on Rails, PostgreSQL, Next.js, and Tailwind CSS project.

License

Notifications You must be signed in to change notification settings

Mdromi/rails-nextjs-starter

Repository files navigation

Rails Nextjs Tailwind Starter

A starting point for your Ruby on Rails, PostgreSQL, Next.js, and Tailwind CSS project.

Table of Contents

Setup

Backend (Ruby on Rails) & Frontend (Next.js)

  1. Clone the repository:

     git clone https://github.com/mdromi/rails-nextjs-starter

    or

     gh repo clone mdromi/rails-nextjs-starter
  2. Navigate to the backend directory:

    cd rails-nextjs-starter
  3. Install dependencies:

    bundle install
  4. Rename the .env.example file to .env

    mv .env.example .env
  5. Add your database information

    # FOR DATABASE
    DATABASE_NAME_DEVELOPMENT=your_app_name_development
    DATABASE_NAME_TEST=your_app_name_test
    DATABASE_NAME_PRODUCTION=your_app_name_productions
    DATABASE_USERNAME=your_database_username
    DATABASE_PASSWORD=your_database_password
  6. Setup SMTP Server

    # SETTING UP SMTP SERVER
    GMAIL_USERNAME=your_gmail_username
    GMAIL_PASSWORD=your_gmail_password
  7. Generate a secret

    bundle exec rails secret
  8. Encrypted credentials file

    #VSCode 
    EDITOR='code --wait' rails credentials:edit
  9. Then we add a new key

    # Other secrets...  
    #Used as the base secret for Devise-JWT 
    devise_jwt_secret_key: (copy and paste the generated secret here)
  10. Setup the database:

    rails db:create
    rails db:migrate
  11. Install dependencies frontend

    cd frontend && yarn install && cd ..
  12. Start the servers using the provided script:

    ./start-servers.sh

This script will start both the Rails backend server and the Next.js frontend server concurrently.

Access the frontend application at http://localhost:5100 in your web browser.

Access the backend API endpoints at http://localhost:3001/.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License.