# Local Development Setup ## Installing Dependencies #### tl;dr The primary dependencies: - Ruby v2.6.3 - PostgresQL v11.2 - Node v11.15.0 - Watchman v4.9.0 (for Relay watching) Potentially useful version info you could have found in the repo: - Yarn v1.16.0 - Bundler v1.17.2 #### Installing Ruby Use your favorite Ruby version manager. I prefer [RVM](https://rvm.io/): ```bash rvm install ruby-2.6.3 ``` #### Installing PostgreSQL Use your system's package manager. For Arch Linux, use pacman: ```bash pacman -S postgresql ``` If you need to know which ```bash % postgres --version => postgres (PostgreSQL) 11.2 ``` #### Node.js/npm Use your system's package manager. For Arch Linux, use pacman: ```bash pacman -S nodejs yarn ``` #### Watchman Use your system's package manager. For Arch Linux, install directly from [AUR](https://aur.archlinux.org/packages/watchman/): ```bash # after installing via preferred method, run sudo mkdir -p /var/run/watchman/$USER-state sudo chown $USER:$USER -R /var/run/watchman/$USER-state ``` YMMV for non-Arch Linux platforms (e.g. MacOs). ## Database setup You will need to create a `pokemon_trade` role (or whatever you specify in your `.env`, for the `config/database.yml`) and allow it create/manage a database and login: ```bash sudo su postgres -c 'psql -c "CREATE ROLE pokemon_trade WITH CREATEDB LOGIN"' ``` Default role (user) defined in `config/database.yml` is simply `pokemon_trade`. Feel free to use something more fitting as needed. ## App setup #### Running the Rails server Copy the .env configuration into place, configure it, then set up the database. ```bash # Copy the .env template to .env # After copying, you should edit the configuration as needed. cp .env{.template,} bundle exec rails db:create db:schema:load rails server ``` #### Using `webpack-dev-server` for frontend hot module reloading Rails will proxy `webpack-dev-server` if it's running. All you need to do is start it in addition to the Rails server: ```bash bin/webpack-dev-server ``` #### Both at once Alternatively, if you want a quick command to run both the Rails server and webpack-dev-server for hot module reloading for frontend development, start the server with `foreman` (instead of `rails server`/`bin/webpack-dev-server`): ```bash gem install foreman foreman start -f Procfile.dev ``` Simply put, `foreman` reads a file and starts a process for each pre-defined command.