Iheanyi,
I realize your app may not be ruby-based, but here's how I've worked with this dilemma in mind in our app. To start, yes, we don't necessarily support custom CSS, but I do have a database field I (as admin) can add custom CSS to a customer's account template (in the case they have "premium support" or something). Our publicly customizable style settings are key:value based and stored as a JSON object in psql as you suggested might be an option. Here's how I make it less unweildy:
Field in the database:
t.json :settings
Then we have a validator that validates against a schema (see https://github.com/mirego/activerecord_json_validator).
validates :settings, json: { schema: SETTINGS_SCHEMA }, allow_blank: true
SETTINGS_SCHEMA looks something like:
SETTINGS_SCHEMA = {
type: 'object',
properties: {
color1: { type: 'string' },
color2: { type: 'string' },
},
additionalProperties: false
}.freeze
And you could create a schema validation in a .json file. This way, if you wanted to add new keys to your settings hash, you just update that file and deploy.
Also "type" (and also the key names) can be validated as a regular expression, so you could use a regex to validate that the value is a valid hexcode or something like that. No newline at end of file