Making our Next.js application tenant-aware
Looking at our database, we can tell which users have permission to a specific tenant. And yet our application is still just a basic login with mock data in the Ticket Management UI, ignoring our new shiny database changes. In this section, we’ll make our Next.js app capable of handling multiple tenants.
Note
In this chapter, I’ll be using two distinct terms: tenant-aware and tenant-based. They’re not exactly the same but the second one needs the first one. The first one indicates that we have a structure that allows us to pass information about the tenant that we wish to show as part of our URL – for example, https://some-url?tenant=tenantA
. But just because you opened that URL doesn’t mean tenantA exists. Tenant-based refers to the fact that we have checked it against actual tenant information (that is, in the database). Let me give a quick example: If the login is tenant-aware, it means that we...