Currently, Rails application is on service.
The environment is following the below.
Environment | Version |
---|---|
Rails | 7.0.0 |
Ruby | 3.0.0 |
Elasticsearch(using ruby'gem) | - |
Activeadmin(using ruby'gem/management screen) | - |
RailsAdmin(using ruby'gem/management screen) | - |
Devise(authentication) | - |
Capistrano(Deploy) | - |
I'm thinking to introduce React to my app.
But in case of management screen, I want to use Rails.
Because it's already customized a lot and no complaint so far.
I think to introduce React to Rails app is 3way.
create-react-app
From my thinking, 1&2 and 3 have big differences. 1&2 is React renders from Rails View. 3 is React renders independently and Rails is just used for API.
So I have three questions.
I have no idea.
Please help me..
I would almost always use the approach number 3, as in using Rails as an API and having admin panel. To achieve this you simply define a different route for all the api endpoints and the admin, don't overthink this. Under the rails port you can put all the API endpoints and a rails admin endpoint. Using Webpacker in rails is still supported but starting with rails 7 it is no longer the default, which means that in case of some problems (which in my experience are frequent with webpacker) you might have a harder time finding some help. Using gems to work with JS frameworks always seems to me like an unnecessary complication, and adding an extra tool to help with a different tool...
Keep both tools to themselves, you can still have both apps in one repository nothing is stoping you from that, but Rails being responsible for the backend and react being the frontend is the most sensible approach IMHO. Nothing stands in a way of using rails app as both the API server and rails admin managment view. It is just a matter of setting up the routes.