I'm curious what the best practices are for storing data such as an apps user preferences. I'm extremely new to Shopify app development, Ruby on Rails, and developing web based apps in general. So I've been getting by just by piecing together examples I've found online.
Just to get started, I'm developing a small app that makes a pop up appear on the online store. I'd like the store owner/app user be able to customize the text that appears in that pop up.
So far I've been (barely) able to stand up a public app using Heroku and load a ScriptTag to show my pop up on the online store. But now I'm at a loss of how to store a users preferences. What is the best way to go about this?
Thanks in advance!
The way you could access this data and pass it into your app would be through using ActiveRecord, which you can find a lot of resources online for. To store your data, a popular option would be to use a database. If you want to keep everything on Heroku, they offer a free Postgresql plan that you could start with: https://devcenter.heroku.com/articles/heroku-postgresql.
Add Metafields guru to your store
And take a look around the Shop level metafields.
Heaps of apps store their settings and data there.
So their apps can be stateless as all the data is kept on the client store! No database upkeep required.
If its a Web app and such you can store metafields against a page as well.