0

Is it possible to use loopback with shared nothing database model, where every client has its own database. For any CRUD data should reflect in corresponding client database.

Thanks Ankit S

Ankit Solanki
  • 670
  • 2
  • 9
  • 23

1 Answers1

0

Solution 1)

Loopback has it's own client framework, which is probably what you are looking for. Just serving that to each client would make it a shared nothing database/API.

https://loopback.io/doc/en/lb3/LoopBack-in-the-client.html

Solution 2)

Since Loopback normally is server-side you'd have to separate the clients being able to identify them. By default this is not activated, however using something like session-cookies or express-session would make it easy to identify and separate each client to then store them through relations in one database.

Otherwise if it's really important that each client has it's own database I'd look into a loadbalancer and round robin algorithm with sticky sessions to make sure each user gets it's own Loopback-instance (with their own database) but that feels a little bit overkill.

Undrium
  • 2,558
  • 1
  • 16
  • 24
  • Each client having its own loopback instance == multiple micro service where each service is catering a client? RAM will become a bottle neck here. – Ankit Solanki May 19 '17 at 18:01
  • What i am essentially trying to figure out is if based on the request can we change the database attached to loopback server. And if one can do the same would this risk the data sanity. Any idea? – Ankit Solanki May 19 '17 at 18:03
  • Session-cookies will allow you to separate the clients. – Undrium May 20 '17 at 08:52
  • @AnkitSolanki did you ever achieve you requirement – bipin May 28 '18 at 06:28