vendredi 26 mai 2017

How companies handle multicountries websites

Good morning,

I would like to know what choices do I have to handle multicountry based websites, in the front-end and back-end. What kind of architecture should I have to make it the most simple possible to manage.

My specific case is: I have a front-end website made in VueJS served by ExpressJS that calls via an API the back-end server. The backend server is made in Rails and he expose just an API and a front-end for administration purposes. Both are hosted in a Heroku app.

The problem I'm facing is: Now we want to scale to another countries. And for that, we must have a different pricing in our backend. In our front-end, we should have the translation made for that specific country, with different images and eventually, handle multiple country-based domains (exemple.fr for france, exemple.es for spain etc).

I came with 2 solutions:

  1. The first one was to: In our front-end, our router would work in this way /:country/:locale/:path. Since we have the country and the locale, we call a file to read the locale values, images and constants for pricing calcs. In our back-end, we have a new heroku app with a different database for each country, having it's own pricing constants etc. So, when the front-end submit a form and call the backend, we call the backend associated with the country we are in. ex: we're in france, we call back.exemple.fr/api/...

The problem with that solution is: I need to have a different backend app for each country, and that mean that I must have a different code base for each app. What If I have an issue with my code, I should update every code for each app.

  1. The second solution is: Same front-end, same router with a country and a locale but our backend is the same for everyone. Except that our backend have now a table "prices" that store different prices for each country. Or even a backend that have constants for each country. Our api makes a call to http://ift.tt/2s39MDR... and return the result based on the french constants.

I don't know what would be the most efficient solution, or if there is another ones that are "better". I would like to know what's your opinion, if there is a convention about this problem. I still can't find any references about this.

Note that: We also have an Android and iOS app that calls the backend API.

Thanks for any help you could provide me. If you need precisions, let me know

William




Aucun commentaire:

Enregistrer un commentaire