I’m trying to setup a Rails project that has 2 logically separated components, the admin panel and the user portal. From what I’ve read so far there are a number of ways to set this up;
- Combine both in a single web app with a single database
- Separate web apps for Admin and Main apps, but use a common database
- Separate web apps with separate databases
- Combine both but deploy separate instances, one running as Admin and other as Main app
The Main app will need to handle heavy traffic, the admin moderately low.
What is the best approach to set up the project among the four options?
Also what could be the downsides of each?
Is there any other way this can be done better?
Some ideas about the possible architectural solutions:
1. Combine both in a single web app with a single database
pros:
You have everything under a single project configuration,
and by so you avoid to configure your project settings twice.
You can re-use code without needing to copy files or reference files
in a different directory which sometimes can be troublesome.
cons:
under the same roof with the user-related code, so it there is a bigger probability
that admin-related functions can be exploited by a malicious user.
2. Separate web apps for Admin and Main apps, but use a common database
pros:
and the user experience in both of them more concise.
cons:
the main application, it will have to read and affect the data used in the main application; hence giving you less overhead.
This would be the best case in most scenarios.
3. Separate web apps with separate databases
Can’t think why you want to do this when the second application is meant
to handle the first one and the contents of the database.
If you were going to
use a big volume of data in the second application that were irrelevant to your
main application, it would be a reasonable option.
4. Combine both but deploy separate instances, one running as Admin and other as Main app
cons:
You will develop solution one with the added complexity of handling two instances.
A malicious user might find a way to login in your admin instance and getting access to
admin-level functions.