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/frontend
folder to store our front end application. Rails will generate anapp/javascript
folder by default -
prettier
andeslint
are configured with several recommended base templates. Custom eslint rules can be configured in the.eslintrc.rules.cjs
file -
We've opted to build the front end using
Vite
, which comes with two configuration files:vite.config.ts
andconfig/vite.json
- The
vite.config.ts
is used to configure the vite package provided by our node_modules. Here we include any plugins that run along side vite - The
config/vite.json
file is our configuration for thevite_rails
gem.
- The
-
Install postgres
brew install postgresql
brew services start postgresql
-
Install ruby version
rvm install 3.1.0
rvm use
-
Install node
nvm install
nvm use
-
Install bundler
gem install bundler
-
Install rails and node modules
bundle install
yarn
-
Setup the database
bundle exec rails db:prepare
bundle exec rails db:migrate
bundle 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