Are there any downsides to sharing a database between apps?

Would any complications arise from sharing a database with the frontend and backend version of an application? Strictly from a Meteor point of view. I noticed that Meteor creates a few of its own collections. My biggest concern is “meteor_accounts_loginServiceConfiguration”, as I’d like to allow password/oAuth registration for the front end users, but disable registration for the backend users. Would collections like this cause conflicts between the two apps’ configs?

I’m working on splitting my app into separate apps for the backend and frontend. Most of the JS is for the backend and I’d like to reduce load times for the frontend (especially on data).

I’m having a hell of a time getting the frontend client to auth against the backend database. So I gave up on that idea and figured I’d let the frontend have its own database, and its own users collection. The backend can have its own as well. This way they can be restarted individually without affecting each other. But you can’t access a remote collection that has the same name one already defined, so the backend cannot access the frontend’s user’s database. (Unless I use the basic nodejs Mongo driver, but I’ll lose reactivity).

Any help or suggestions would be greatly appreciated!

I’m guessing you mean customer app and admin app when you say frontend and backend versions. (Otherwise this comment is useless for you.)

I separate the customer app and the admin app in my Meteor projects, too. I share practically the same concerns.

What I do is I create two apps running in two separate containers. Although it means more coding, it also makes things easier in some aspects.

The only difference is, I don’t use two separate databases. I keep everything in one database. The customer app and the admin app are two pieces of the same app after all.

https://atmospherejs.com/alanning/roles might be the package you are looking for. It lets you define groups and roles for users. In simplest terms, you set it so that as long as you don’t assign a user to the ‘admin’ group, s/he won’t be able to use the admin app.

2 Likes