What is the best way to architecture a project when I have two applications?


#1

Hey :slight_smile:

I am trying to figure out how to architecture my application and I really need some tips. It basically is a dashboard that lets people get an overview of their WooCommerce data. People can connect with WooCommerce, we retrieve their products, customers and orders and we display them on different interfaces.

I made a lot of research and I found this great article wrote by Mixmax. It explains why they had to move the contacts off into their own database, completely cut off from Meteor. I may have the exact same issue with the data coming from WooCommerce so here is how I imagined the architecture.

  • The meteor application with Blaze and MongoDB.

  • Another application that synchronize with the WooCommerce API and save the results in a database.

I am not sure if it is the best way to do it. Here is the main questions I have:

  1. Should I build the syncbox with Hapi or Express or is there a better way to do so with another Meteor app with Restivus for instance. I would rather avoid to introduce a new technology to the stack but it seems smarter to me to use Hapi or Express to manage this kind of things.

  2. I have browsed the Apollo and GraphQL documentation. Should I use Apollo to connect with the Syncbox and its database instead of building a rest api to access the data with Blaze?

  3. Looks like Apollo is more integrated with React so should I start to code my app with React instead of Blaze?

  4. Also, my meteor accounts are saved on the main application. How can I make things secure when Blaze or Apollo will ask for the data in the syncbox?

Thanks a lot for taking the time to answer some of these questions. :slight_smile:


#3

I would start out with the simplest possible config, and separate it if it becomes necessary. If you know for sure the syncbox in this example will need a lot of resources and be scaled separately, you can have it as a separate app.

I see nothing wrong with having them both as Meteor apps. If the syncbox is only doing api calls and updating the DB, you might as well have the conveniences of the Meteor build tool, with a minimal amount of packages.

I would also just connect to the same database with these two apps, unless you have a good reason to have two databases. The syncbox makes sure the data is up to date with woocommerce, while the β€œmain” app defines the subs and methods that clients access. No need for a separate DB unless the data grows really big and you need to scale out more, and that is a problem for another day once you have more experience with it.