What is the best practical way to add a major feature/service to an existing medium-sized Ruby on Rails project?
-
21-09-2019 - |
Question
I have an existing project written in Ruby on Rails. It is sort of backend solution for the upcoming major addition to the project. What I mean is it currently serves for the admins and it already has loads of features and actual Rails files in there.
Now I am planning to add the new "Public" facing part of the App in Rails and I am wondering what could be the best solutions. I could think of the two following possible ones but I would really appreciate if anyone who had experienced this could put me in the right direction.
- Create a new Public facing Web App using the same resources the backend Web App was using - any pros and cons?
- Simply add the new features to the existing backend Web App - any pros and cons? (I am sure this option will make the App files grow quite large, but should I care? or not?
I have only done small Web Apps in Rails before and this is my first large one. Please, anyone, your answers will be much appreciated.
Thanks.
Solution
You already have a lot of business logic in the models, so starting a new application would mean duplicating that logic, which is a maintenance nightmare.
I would simply add the public facing parts on to your existing project. I wouldn't worry about the application getting big. I've worked on a very large rails application and it works fine. (177 tables/models, 23+ controllers, etc...)
Just make sure you create a good way to separate the internal parts from the external ones, by adding a field to the User model to indicate if they are internal or external, and then as part of the authentication, limiting access to the internal parts.