Use Rails backend to serve JSONB data from PostgreSQL columns...
- No big architectural changes
- Non-relational data is hard to serve & maintain from a relational-oriented framework such as Rails (ActiveRecord). Some "hacks" we currently have to do:
Use lytics/ember-data-model-fragments
addon in order to use non-relational JSON fragments along with ember-data
- No substantial changes required
- Data-binding issues, as ember-data expects a relational data model:
- Might be cumbersome to implement Dynamic models (see comment below)
*Note: Most alternatives involve some degree of re-writing current custom-forms
implementations.
Use rmosolgo/graphql-ruby gem to generate an GraphQL endpoint within RoR.
See experimental (working 😁) branch: nimbox-api/experiment/graphql
- Easy to implement
- Tightly coupled with RoR
Use an external Postgres "adapter" called PostGraphQL to create a GraphQL independent from the Rails API
- Auto-schema
- Not coupled with the framework
- Kinda experimental/PoC
Setup a new NoSQL database exclusively for storing custom fields, forms & data.
See original RFC & discussion for further details & options.
- Freedom to choose NoSQL stack from scratch
- Setup, maintenance & implementation overhead
Use GraphQL (via alphasights/ember-graphql-adapter) to populate ember-data-model-fragments.
See experimental (not working 😩) branch: nimbox/experiment/graphql
- No big rewrite
- Might have same data-binding issues, regardless of using GraphQL
Use Ember Engines along with alphasights/ember-graphql-adapter to isolate data access for custom-forms.
- Isolate data access per module
- Should not suffer from data-binding issues, in theory
- Ember 2.10 at least required for Ember Engines
Use Ember Engines along with a NoSQL adapter (ex. ember-mongoose) + Ember Redux to create custom forms
- Stateless components
- Kinda experimental stuff
- Ember 2.10 at least required for Ember Engines
Use an entire new view layer library, such as ReactJS or VueJS, to create custom forms & fields as a separate application, but integrated into Ember
- Rendering via iframe / black magic
- Freedom to choose the best single tech for the use-case
Una área que no había tomado en cuenta fue que los modelos Fragments tendrían que ser Dinámicos.
Afortunadamente encontré ejemplos donde se puede hacer esto, aunque haya que hackear un poco el framework. Por ejemplo, ember-admin lo hace: DockYard/ember-admin#82
En este caso crean una store separada llamada
store:admin
para almacenar en un namespace separado esos modelos dinámicos... en nuestro caso podríamos implementar un store separadostore:custom-forms
Desafortunadamente al parecer no es tan sencillo hacerlo con ModelFragments: adopted-ember-addons/ember-data-model-fragments#218
Otra opción es investigar más sobre Orbit.js, específicamente el addon ember-orbit, y de que manera nos puede ayudar a nuestro use-case
Update 27/08/2017
Al parecer no es tan complicado si se usa un IIFE 😄 https://github.com/ecaresoft/nimbox/commit/d81a4638a4dd009e9a99466b3bbb51efce5e02ef