Anderson
Anderson

Reputation: 363

Concept of a SaaS system

Good evening, I developed a system that behaves in the SaaS format, where the client only registers and already has access to use, in it I used a unique identifier for each client and they all use the same structure, PHP files and the same database . So far so good, because the domain does not change, that is, everyone uses www.lalalaetc.com.br/app and the system separates everything by the unique identifier, however, I would like to develop a virtual store from it, only there would be a difference, the domain, that is, I believe the principle is the same, use a unique identifier for each store, but my doubt is how I will make it so that when someone accesses the store the domain is addressed correctly and load the id of my client? What is the way forward and what do I need to research to do such a feat?

Upvotes: 0

Views: 115

Answers (2)

okobsamoht
okobsamoht

Reputation: 11

i managed to handle the tenant with the folomming steps:

  1. i cloned de the parse server source and i added a new middleware named "tenantConfig"
  2. in that middleware i intercepts the requests and i get one specific header that i named "x-parse-tenant" and i use the value of that header like a database name
  3. so i modify the datapase adapter and then resent it to the requetes and do next() to continue the process
  4. so in the client lib or the requests i provide a "x-parse-tenant" header

you can see details in the screenshots its not perfect i know :D

enter image description here enter image description here

Upvotes: 0

Matt
Matt

Reputation: 879

It sounds like you want to develop a multi-tenant application.

In this case, you could uses sub-domains, for example tenant.lalalaetc.com.br.app, where the word tenant is replaced with a string unique to each tenant.

When the request comes into the server, you can parse out the sub-domain, passing it to a function that searches your API/Database by this tenant subdomain.

Upvotes: 1

Related Questions