How multisite works?

Hello @samnabi,

I’ve just discovered this thread and how you manage your install to build a multisite SaaS project.
It’s very interesting.

I wonder how you create a new “clients/client-new/” folders in your filesystem and set the domain when a new customer has just payed his subscription?

You do it manually or pragmatically?
If it’s pragmatically, could you explain us your method?

For now I do it manually. But I plan to fully automate the onboarding process soon.

Each client’s content is self-contained, so all I need to do is copy the _default folder and rename it. (The _default folder acts as a template.)

I have configured my site.php so that these folder names map to subdomains (e.g.

Of course, another part of the automatic onboarding process will have to check to make sure I have enough Kirby license keys available.

1 Like

To automate the folder creation, you intend to use php functions like exec(), copy(), rename() … ?

These functions are subject to some serious security vulnerabilities :-/ that’s why I wonder how to achieve this.

I would use the dir:: functions in the Kirby Toolkit. Of course, I would need to escape any user-generated input (namely, the folder/subdomain name).

What security vulnerabilities have you come across?

1 Like