User Accounts/Meteor Accounts in Apollo

Like many meteor users I’m currently using the accounts-password package for authentication, however I’ve adopted and successfully implemented Apollo and would like to change the backend from mongodb to postgresql.

I looked at meteor-apollo-accounts but that seems to still be relying on mongodb just utilizing graphql instead of DDP.

Any assistance is hugely appreciated, almost ready to stand this app up just need to get things hammered down.

1 Like

Hi Tomwa,

This may not help but what I’ve done with my own app is had the regular accounts-password package with mongo, but used Apollo for everything else.

A) It’s easier to set up, you know it works.

B) Since only users are being created and read from the Mongo database, you shouldn’t have many scalability issues with Mongo (which has long been an issue, from what I remember).

C) You can still use things like Meteor.userId() to track owners of stuff, just in your postgres database instead.

D) You still get all those DDP niceties.

My setup is going to be as follows:

  • Meteor app and MongoDB on one server sharing resources.
  • Postgres DB (which will be holding all data apart from accounts) will be on it’s own server.
  • Possibly a third server with ElasticSearch… but that really depends on whether I need it later.

So yeah, not really answered your question but I hope it might give you a different idea!

2 Likes

How do you go about handling user data?

Do you simply duplicate it? If so how do you prevent data inconsistency?

Example:

I have posts, each user can make posts. How do you associate posts (In the postgres database) with users (in the mongodb database)?

Sorry for the slow response.

I don’t! I just have an ‘owner’ column in postgres that is the Meteor.userId().

All you need to do then is query whether the owner matches the userId of the logged in user. Or you could add a user to an ‘owners’ table when they make their first post or something.

Hope this helps :slight_smile:

1 Like

I’m doing the same as @korus90.

2 Likes

Smart thinking, I’ll give it a shot. :wink: