This is a migrated thread and some comments may be shown as answers.

Multi Tenant Design

8 Answers 74 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
JoPi
Top achievements
Rank 1
JoPi asked on 26 Oct 2015, 05:29 PM

Hi,

I'm designing a hybrid app in AppBuilder for our business customers whereby each business (which has many users) gets their own copy of a database and the app can point at the relevant database for each customer/business.  I'm new to AppBuilder but it doesn't seem to be possible to configure Backend Services Cloud Data to point to different databases or link an app to different API Keys.  Am I right about this or is there a work around?

Thanks

8 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 29 Oct 2015, 02:34 PM
Hello Joth,

I believe that my colleague answered your question in your private support ticket. Let us know should you have any further questions or suggestions.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
David Weinberg
Top achievements
Rank 2
answered on 10 May 2016, 10:40 AM

Hi JoPi,

Are you able to share any of the details of the answer provided?

David

0
David Weinberg
Top achievements
Rank 2
answered on 10 May 2016, 10:41 AM

Hi JoPi,

Are you able to share any of the details of the answer provided?

David

0
JoPi
Top achievements
Rank 1
answered on 10 May 2016, 10:55 AM

Hi David,

Happy to share the response.  It was only private because I was in a hurry and trying forums & support tickets...

I've cut & paste the 2 emails for Telerik with my further questions in between....

What you need is possible, but cannot be fully automated. You could create a reference Backend Services project and then duplicate it for each of your customers. The duplicate functionality only copies the structure (content types, fields) and does not copy any data. Each duplicate project will get its own API key and the data will be kept separately.

Unfortunately, this cannot be fully automated at the moment, meaning you have to manually duplicate the project from the UI. I am not certain if this is good enough for your solution.

Actually, the only missing part for the automation is the creation/duplication of the project. This is still not available as public API. We are planning to introduce it at some point. Once you have the project ready, you can use its master key for all administrative tasks related to it (initialize some data, etc.).

Let me know if you have any other questions, I will be happy to help.

Also, I'd like to offer our apologies for the late reply. 

Regards,
Lyubomir Dokov 
Telerik

Hi Lyubomir,
Thank you for your reply.  This sounds fine and lack of automation not a problem since duplication copies structure :)
I'm afriad I'm still new to AppBuilder/Javascript so could you clarify a few basics;
1. to create a 'reference Backend Services project', I'm assuming I just create a New Project (Hybrid/blank) and add a Backend Services Project to it with Cloud Data etc. and then reference that project as shown here: http://docs.telerik.com/platform/backend-services/rest/administration-api/projects/managing-projects .  Could you confirm.
2. I can't see how to duplicate a project from UI.  Could you just explain or provide links.
Thanks

The steps are basically as follows:
You create an app from the Telerik Platform Web Portal.
You add a Backend Services project to it and set up everything the way you need - content types, permissions, cloud code, etc. You will use this project as a reference - you will duplicate it for every different customer(or business) you have.
Whenever you need to create a separate data store for a new business, you duplicate the Backend Services project created in step 2. You can find more about duplicating projects here.

I am not sure how you want to use the different projects in your mobile app. Are you going to have different mobile apps built for each customer(business) or one app that will be able to work with all the businesses?

In any case, duplicating the project will duplicate the structure and everything else you need and will give you a separate API key and data store. You can then use the API key for the business you want to work with.

Note, that if you need to make a change on the project structure at a later time you will either have to do it manually on all the duplicated projects or you will have to automate it through the API.

I hope this helps, let me know if you need more information.


Regards,
Lyubomir Dokov 
Telerik

0
Anton Dobrev
Telerik team
answered on 12 May 2016, 01:47 PM

@JoPi

Thanks for sharing this information with the community.

@David, JoPi

Do not hesitate to post your further questions or considerations on the subject.


Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Shawn
Top achievements
Rank 2
answered on 28 Apr 2017, 03:27 AM

What approach does one follow for user-login?  I imagine in addition to username(email) and password, one need a tenant-code field as well?

Do you then use that tenant-code to lookup the back-end services project API to apply to that user's session? (Still learning Telerik Platform, so a dumb question now might be...can one assign different back-end API's to different users at run-time based on this tenant-code field at login?)

0
Shawn
Top achievements
Rank 2
answered on 28 Apr 2017, 04:25 AM

In my reply above, the above approach assumes that a user's table is altered such that the tenant code and user email are the primary key (instead of just the user email)...this allows the user to have different passwords for different tenants.

But I'm thinking a second approach could be to leave the users table such that email address is the primary key, and the user just provides email and password at logon, but then after logon, a lookup is done to see which tenants that email account has been linked to, and then have the user select a tenant to logon to.  And only then is the back-end services API key assigned for any further data access in that user's session.  Is this approach possible (once again, to assign a back-end service API key at run-time)?

0
JoPi
Top achievements
Rank 1
answered on 28 Apr 2017, 08:36 AM

Hi,

I think the design would depend on your situation regarding users.  For us, this is a business app and a user would never be part of different tenants and so we just use user email as primary key which also links to relevant apiKey.  We have a separate database for all our users.  As regards using different apiKey at runtime, yes this approach does work for us although since this post we've moved from Kendo to Xamarin although still use Everlive.

Tags
General Discussion
Asked by
JoPi
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
David Weinberg
Top achievements
Rank 2
JoPi
Top achievements
Rank 1
Shawn
Top achievements
Rank 2
Share this question
or