[0:00] [music] [0:04] Hello everyone, welcome back to my [0:06] channel. Today I want to demonstrate a [0:08] scalable SAS software as a service [0:10] platform that I have built using Laravel [0:13] and React. So my solution uses a [0:16] multi-tenency with multi- database [0:18] architecture. This means every time a [0:21] user create a new store on this [0:24] platform, the system automatically spin [0:26] up a completely isolated database just [0:29] for them. So let's start. So first of [0:32] all, I just simple uh [0:36] register a new user and I just simple [0:39] name this user as my name Afnan. And uh [0:42] in the email I just simple pass here my [0:44] email. And in the password I just simple [0:47] pass this [0:49] password. Okay just simple create [0:51] account. [0:53] And now here you can see a user account [0:56] is created. And now on the dashboard it [0:59] show and reflect here total store total [1:02] categories total products. So as I told [1:05] you earlier uh every user can create its [1:09] own store and its own categories and its [1:12] own product. Okay. So I just simple [1:14] simple uh show you the database overview [1:16] as well. And now here you can see this [1:19] is my database that is multi-reency. [1:20] Okay. And within this database I have a [1:23] users table and I just simple refresh [1:25] it. And here you can see this is the [1:27] user that we created and in the user I [1:30] have a role. So in the role I have a [1:33] simple user role and admin role. So [1:35] basically admin see all the users and [1:37] all the store that are created and user [1:40] just simply see its own store its own [1:42] store categories and products. Okay. So [1:45] this is the users table and I just [1:46] simple open the tenants table and in the [1:48] tenants table whenever user create a new [1:50] store it basically give uh give this [1:54] store a id and uh pass here the name [1:57] slug store name here in the ID place. [2:00] Okay. and uh in the store uh it [2:04] automatically add the store details, [2:06] user ID, name, description, tenant ID [2:09] and all the things. Okay. So this is it. [2:11] This is the basic structure. And also I [2:13] have a domain domains table as well. And [2:16] uh in this whenever a user create a new [2:19] store, it automatically add uh here the [2:22] domain name that user put and uh tenant [2:25] ID as well here. So these are the table [2:27] in my central database multi-tenency [2:29] database. Okay. So now uh I just simple [2:32] show you [2:34] uh we just simple come here and now I [2:36] just simple create a new store. And now [2:39] this page is showing very look good and [2:41] amazing. And now I on this page I just [2:44] simple create a new store. And I just [2:46] simple name this as pet shop. And in the [2:48] subdomain I just simple pass this name [2:50] here. And in the description [2:54] I just simple pass here. [2:57] And in the description I just simple [2:59] pass here all things related to pets [3:01] like this. Okay. So you can add any [3:03] other here. So I just simple create a [3:07] store. [3:10] And now here you can see uh the store is [3:14] created and it pass here the store name [3:16] pet shop and subdomain as well and [3:19] description as well. So I can uh just [3:22] simple click on this manage and uh and [3:25] now here you can see my store is created [3:27] and now uh I just simple show you a uh a [3:30] thing that is most important and now I [3:32] just simple come to database and uh just [3:34] go here in the tenants and I'll just [3:36] simple refresh it and now here you can [3:38] see it pass here the uh tenant name pet [3:40] shop and in the store as well it pass [3:43] the ID pet shop description tenant ID as [3:46] well and domain in the domain it pass [3:48] here petshop.lohost local host. So you [3:50] can change here for uh we can change [3:52] here uh the domain name as well. And now [3:56] in the domains it auto it also add here [3:59] the data petshop.lohost and tenet ID. So [4:02] that's great amazing and the most [4:05] important thing here it it create the [4:09] separate database for this uh store. And [4:12] now I just simple show you here uh I [4:15] just simple uh refresh it. And now here [4:18] I just simple search here pet shop. And [4:20] now here you can see tenant.patshop [4:23] and it create a separate database for [4:25] this specific store. And within this I [4:29] have a categories and products. Okay. [4:32] And now I just simple [4:36] and within this I have a categories [4:39] table and products table. Okay. So this [4:42] is it. This is the thing like uh each [4:45] store has its own uh database and uh [4:52] now let's manage this store. I will add [4:54] a category and a product uh in it. Okay. [4:59] So I just simple come to categories and [5:01] now this is uh the categories page and [5:03] I'll just simple add here a category [5:05] like uh [5:07] electronics. [5:10] Okay. And now here in the description [5:14] uh it uh related to [5:19] electric [5:21] products. Okay. And now I just simple [5:23] create this category. And now here you [5:26] can see category is created. I can add [5:27] it and delete it. But uh before this I [5:31] just simple come here and go to [5:33] categories. And now here as you can see [5:34] I don't have a categories table. when [5:35] I'll categories data when I'll just [5:38] simple refresh it add this category data [5:40] that we added in this table so this is [5:43] it this is uh this store thing that is [5:46] standard pet shop and that's why it add [5:49] this store categories in its own [5:52] database okay so this is it and now I [5:55] can also edit it as well [5:59] I just will pass here this and just [6:01] click on save changes and now it's [6:02] updated as well and in the database it [6:05] also updated. So that's it. And now I [6:07] just go to products and in the products [6:10] when I just simple click on add product [6:12] and now in the categories show me this. [6:15] So basically it is completely isolated [6:18] and each store has its own data and now [6:21] that's why it is showing here its own [6:24] store categories. Okay. And now I just [6:26] simple add here another category [6:30] like uh [6:33] clothing [6:35] and uh it's about clothes okay just [6:40] create and now go to products and uh [6:43] here in the categories table you also [6:45] add it and now I just simple add product [6:48] here and uh I just pass here headphones [6:52] and select the category and I just [6:55] select sect this category and pass here [6:58] all things related to electrics. Okay. [7:03] And I can pass here this uh price as [7:06] well and stroke as well. Just click on [7:09] add product. And now you can see my [7:11] product is added and it pass here this [7:14] category as well. And in the products [7:16] table I show you this is the product [7:20] that is added. So that's it. That's [7:23] amazing. Okay. So this is basically the [7:26] multi-ancy with multi- database [7:29] architecture that I make. Each user can [7:32] create its own store and so now here you [7:35] can see each store has its own [7:36] categories, products and create uh store [7:39] thing as well. Okay. So now uh I just [7:43] simple show you the overview from the [7:45] admin side as well. And now I just [7:47] simple login with admin. H and I already [7:50] have admin user. I just simple show you [7:52] from here from the multi-tenency. Here [7:55] you can see I have a admin user and its [7:58] role is admin. And now I just simple [8:02] login with it. [8:09] And now here you can see admin can see [8:12] all the store store owner its products [8:16] and its categories. Okay. So we can do [8:18] in it many things many things. uh as [8:21] well like separate domains. Uh already [8:24] we done it but we can add in it more [8:26] feature as well like each each user has [8:30] its own store multiple products multiple [8:33] add toart features checkout features and [8:35] uh payment gateways payment plan as [8:37] well. So this is the basic concept idea [8:40] of multi- uh multi- uh tensy with multi [8:44] database and uh I just simple show you [8:47] one uh more thing. And I just simple log [8:49] out here. And now I just simple uh [8:52] register with a new user. And I just [8:54] simple name this as unity and pass here [8:57] unity at the rategmail.com and password [9:01] and [9:02] password. Okay. And now here you can see [9:06] this user is created. And now I just [9:07] simple uh create a store. And here I [9:11] just name this as Jim. gym and it's uh [9:15] related [9:17] to [9:21] health products. Okay, just click on [9:23] create store. And now here you can see [9:25] this uh store is created successfully. [9:27] And now from the database, I just simple [9:29] show you this is the multi-nc database [9:33] that is the central database. And I'll [9:35] just simple go to tenants. And here you [9:37] can see I have this new store as well [9:39] that is gym. And uh I just simple [9:42] refresh my databases. And now just [9:46] simple search here gym. And now here you [9:48] can see it automatically create a new [9:49] separate database for gym as well. And [9:53] it's have its own categories products. [9:54] Okay. And on the admin side I just [9:57] simple show you. I just simple reloaded. [9:59] And now here you can see I have an other [10:02] store that is gym and its user is uh [10:04] different and its products and [10:06] categories are zero because we did not [10:08] add it yet. So this is it. This is the [10:11] basic concept idea of multi-tenency with [10:12] multi database. We can uh use this [10:16] concept this multi-tensy uh with multi [10:19] database concept in many other ways as [10:22] well. But this is the basic video basic [10:24] idea of how we can use this multiency [10:27] with multi- database architecture [10:30] uh in this uh store creation or store [10:34] like e-commerce project. You can use [10:36] this in many other project as well. So [10:40] this is it. This is the basic concept [10:41] idea and I hope you like this video and [10:44] if you want me to [10:46] to make complete video on this uh [10:50] project then comment below and uh I and [10:53] see you in the next video. Thank you for [10:55] watching.