# How to design a multi-tenant application

**URL:** <https://community.triggre.com/t/how-to-design-a-multi-tenant-application/742>\
**Category:** Data\
**Tags:** data, designer\
**Created:** [December 31, 2019, 11:00pm UTC](https://community.triggre.com/t/how-to-design-a-multi-tenant-application/742 "2019-12-31T23:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mar](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.triggre.com/mar/32/395_2.png) [@Mar](https://community.triggre.com/u/Mar)\
**Post date:** [December 31, 2019, 11:00pm UTC](https://community.triggre.com/t/how-to-design-a-multi-tenant-application/742/1 "2019-12-31T23:00:00Z")

</div>

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 or 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](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/d990dc7c2e74fde72611cc54d86f1c92c4a65184.png)

## 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:  

3. A manager from ACER will see this:  

4. The HP manager will see this:  

### 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**.  

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](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/281d4f1fa544389d61081067e04847c75f7f5b74.gif)

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](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/b19530390af6ab78ad27aeae8492e170912ed749.png)

4. Now the **Button** only appears if the user is not a **System administrator**.  

### 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**.
