Template management similar to Shopify - Architecture Recommendations

Hi guys,

We made a SAAS platform for community management. We have been requested to give customized experience for each community and eventually end community managers would like to modify the views / element locations / css / js . With a lot of research , we have decided to go with Shopify#liquidmarkup http://liquidmarkup.org/. What would be the ideal way to store these templates and where ?

Here is our current architecture

MAINAPP > Communities > Users

And hence communities would have their own rails “layouts” / “partials” / “liquidtemplates” . We are planning to store their layouts in the file system currently this way

Rails.root > templates > community_uuid **> community_specific_template_files **

But as our communities scale up, we would have to too many “templates” folders piled up. Even though they are ignored in MAINAPP git repo, on the app server with multiple unicorn nodes, these templates must be available for any unicorn server at any given point of time. This would exponentially increase the Filesystem Space consumed as our community base increases on our App servers.

We have 3 options currently

  1. Store them on File system and deploy / update templates on all application servers - IO operation

  2. Store templates in database and cache those template queries

  3. Store templates in REDIS as a HASH structure and retrieve accordingly .

Would love to know your thoughts ?

Vivek Sampara