How to design a multi-tenant application

A multi-tenant application is an application that is used by multiple clients, companies or customers, but each party will only see their own data.

The example application below is a single HR-application that can be used by different companies (clients) at the same time. You don’t want employees of one company to be able to see or process the data of other companies. The system administrator must be able to see and manage all data in the system.

1. Set up a System administrator

  1. The system administrator is not an employee of a client company. A simple way to identify a system administrator is to use a flag in the data item User.
    Create the flag System admin in the data item User.
    Flag System admin

2. Set up Page filters

  1. In all flows that process employees, you must create filters that make sure a user can only process employees of his/her own company, unless the user is the system administrator.

  2. The system administrator will see this:
    System administrator overview page

  3. A manager from ACER will see this:
    ACER user overview page

  4. The HP manager will see this:
    HP user overview page

Page filters

  1. Go to Design.

  2. Open the user flow (in this example: Employees).

  3. Open the overview page.

  4. Proceed to the screen where you can define a filter.
    Filter definition

  5. Select Apply a filter.

  6. Create this filter: the company of the current user = the company of the employee OR the current user is system administrator.
    Filter set up

This means that a user will only see his colleagues. Except when the user is system admin, then there is no filter and he/she will see all employees.

3. Set up Flow part filters

Be aware that flow parts must know for which company they have to ‘work’.

  1. Create an input containing the company.

  2. The user flow where the flow part is included, provides the company: it is the company of the user.

  3. Make sure that the system administrator cannot start such a flow part (e.g., a raise should only be applied to the employees of a single company and not to all employees in the system). The easy way to do that: set a filter on the button that calls the flow part.
    Filter set up

  4. Now the button only appears if the user is not a system administrator.
    Button for other users

Flow parts

  1. Create the input Company. It gets the input from the user flow.

  2. Create a lookup for all employees of this company.

  3. Perform the necessary actions, for instance, by creating a repeat action.
    User flow action