Search code examples
reactjsruby-on-railsforeman

How to use foreman between 2 repo?


I have a project. Although it is the same website, the front and back ends are divided into 2 repo(s), which are made by React and Ruby on Rails respectively. Therefore, every time I want to start a website locally, I must open 2 Ubuntu terminal windows.

I heard that foreman can start both at once. Are there any examples to learn from? Thanks!


Solution

  • You could just add foreman gem to you Gemfile and create Procfile.dev file in your root directory.

    Inside of it, you add all of the processes you want to launch. So, it could be something like this:

    backend: bin/rails server -p 3000
    frontend: npm start
    

    Obviously, you can use whatever you use to start your frontend application.

    And then you run foreman start -f Procfile.dev in your terminal.