JS ORM Framework Multiple REST APIs Relations

Viewed 34

In the case of a micro-services developed app, each service (= model) has it's own REST API, i.e:

  • People
  • Companies

Those models can have relationships together (i.e: Person "X" is working at Company "Y").

I would like to know if it exists a JS ORM or framework handling REST APIs as drivers (like a MySQL driver but done with REST) and managing the REST API calls by itself.

If I fetch a "Person" which has a data field relation "is_working_at" type: @Company, the ORM is doing the REST API call to the Companies API in order to fetch the Company data associated with this Person and populate the "is_working_at" field.

Thanks a lot.

1 Answers

I maintain ORM like library called EntityStore.TS:

https://github.com/dipscope/EntityStore.TS

It is designed for such cases as yours e.g. abstract entities from underlying services. On it's core it provides you an interface to generate commands based on your entities which later can be handled in any custom manner.

It will not cover your use case out of the box but at least can provide you everything you may need as a starting point to implement a plugin with custom behaviour. For example REST API endpoints can be specified per entity type using decorators which a plugin can provide. Later based on this configuration a propper query or merge can be performed.

Anyway there might be good library proposals in which I also interested in as a reference so thanks for your question! ;)

Related