Rails application using typescript, react, built using Vite and the vite_rails gem.
- Rails 7
- Ruby 3.1
- Node 18.7
-
Here we use an
app/frontendfolder to store our front end application. Rails will generate anapp/javascriptfolder by default -
prettierandeslintare configured with several recommended base templates. Custom eslint rules can be configured in the.eslintrc.rules.cjsfile -
We've opted to build the front end using
Vite, which comes with two configuration files:vite.config.tsandconfig/vite.json- The
vite.config.tsis used to configure the vite package provided by our node_modules. Here we include any plugins that run along side vite - The
config/vite.jsonfile is our configuration for thevite_railsgem.
- The
-
Install postgres
brew install postgresqlbrew services start postgresql -
Install ruby version
rvm install 3.1.0rvm use -
Install node
nvm installnvm use -
Install bundler
gem install bundler -
Install rails and node modules
bundle installyarn -
Setup the database
bundle exec rails db:preparebundle exec rails db:migratebundle exec rails db:migrate -
Start the rails server
bin/rails server -
In a separate tab, start the frontend app
bin/vite dev -
Visit the app at
localhost:3000
-
Run the frontend tests
yarn run test -
Run the frontend test suite in watch mode
yarn run watch -
Run the rails specs
bundle exec rspec