Architecting a Multi-Tenant Restaurant SaaS with Next.js and PostgreSQL
I am creating a software-as-a-service (SaaS) restaurant that will allow the owners to have their menus on an online platform without spending on an individual website or software. All the restaurant needs to do is subscribe, upload their dishes, set prices, brand it, and give access to the employees from one dashboard.
Instead of developing and launching individual applications for each restaurant, I would rather develop an application that can cater to several restaurants simultaneously. Every restaurant will have their own menu, branding, and staff settings but the core application remains common. This kind of application model is called Multi-tenant SaaS model.
In this article, I will explain my initial architecture, how the application will identify restaurants, how I plan to isolate their data in PostgreSQL and why I selected path-based tenancy for the first version.
What are SaaS, tenants and multi-tenancy?

What does the restaurant SaaS need?
Before choosing the architecture, I defined what a restaurant should be able to do on the platform.
Every restaurant will need:
- A public digital menu
- A unique URL
- Menu categories
- Individual food items
- Prices, descriptions and images
- Restaurant branding and contact information
- An owner dashboard
- Staff access
- Control over its own content
Customers should be able to open a restaurant’s menu without creating an account. Restaurant owners and staff, however, must sign in before managing content.
This creates two different sides of the application:
- A public menu for customers
- A protected dashboard for restaurant teams
Path-based versus subdomain-based tenancy
There are two common ways to give each restaurant a unique address.
Path-based tenancy
With a path-based approach, the restaurant identifier appears inside the URL path:some-domain.com/fifth-avenue



