Skip to content

Instantly share code, notes, and snippets.

@buildAI
Last active November 10, 2019 15:43
Show Gist options
  • Save buildAI/a2090ca15ed1300631ef11438b57ae14 to your computer and use it in GitHub Desktop.
Save buildAI/a2090ca15ed1300631ef11438b57ae14 to your computer and use it in GitHub Desktop.
Setting up a new rails app. That would lead building a restful APIs on rails with React, Tailwind CSS for the front end.

This is written on 10/November/2019

The database is postgres

  • rails new rails_app -d=postgresql -T --webpack=react --skip-coffee --skip-active-storage *-d option is to specify a database

    • -T option to skip unit test framework, files
    • --webpack to configure javascript frame for webpack bundler here it's react
    • --skip-coffee to skip coffescript
    • --skip-active-storage to skip active-storage related things.

    This gives us the rails app useful to build a webpack with react front end and ruby on rails backend

  • Adding rspec to rails

    1. Add gem 'rspec-rails' to Gemfile
    2. Run bundle install
    3. Run this command rails generate rspec:install to init rspec ralted config and folder structure.
  • Setting up Database

    1. Run rails db:migrate to setup the schema
    2. Run bin/setup to setup the database
  • Setting up react components

    1. Run mkdir app/javascript/components to make directory for react components.
    2. Run touch app/javscript/packs/index.js to make entry point for react components.
    3. Import a root component and load in index pack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment