Multisite with new domains on the fly

Hi! I have an SaaS platform based on WordPress Multisite, and I’m wondering if Frontity would work for me. Basically, this is what I need:

I need my users to sign up and have a new website created on the fly. This website will initially have a subdomain of my main domain (eg., but the users should have the option to use a custom domain also (eg.

Can I achieve that with Frontity? While I still use my multisite WordPress install as the CMS?

In the docs I’ve noticed that Frontity have a configuration file that handles multiple domains… Is there a way to make this “domain adding” automatic?

Thanks so much for the help!

Hi @ronaldoscottis, welcome to the community :slightly_smiling_face:

Yes, you can achieve that with Frontity, although you would need to take care of all the configuration of your server, of course.

You can modify your frontity.settings.js on the fly but you need to rebuild the project each time you add a new site or a new package with npx frontity build.

We thought about a package system to replace frontity.settings.js with your own implementation but I’ve been thinking about it lately and we could just support an async function export in frontity.settings.js.

export default async () => {
  const settings = await fetchSettingsFromSomeAPIorDB();
  return settings;

I don’t see any reason not to do that instead of a more complex package system. We could also open the door for storing the settings in the PHP plugin.

import wpSettings from "@frontity/wp-settings";

export default async () => {
  const settings = await wpSettings({
    api: ""
  return settings;

What do you think? What approach are you going to use to modify the frontity.settings.js file on the fly?

Thanks for the warm welcoming @luisherranz!

I do not have a lot of experience with Frontity or React, I’m in the learning phase right now. But, if there was a solution to handle this new site adition without having to rebuild the project every time, it would be awesome!

If I understod it right, I should host the Frontity project on a static serverless host, so not having to “touch” this part of the code seens to be a better practice.

Fetching the websites lists from a external source, or from the Wordpress install using the API, would be a good solution. It would mimic the behaviour of the WP Multisite itself.

Specially as in this case the “list of sites” part would have constant updates, it seens more correct for it to be a dinamic resource than for it to be a configuration file.

At least to solve this specific problem, building a new package to replace the frontity.settings.js sounds like to much trouble for a small problem with simpler solutions.

I’m probably going to need a couple weeks before actually start building something with Frontity, but it is very good to know that it is possible.

That is unlikely to happen in the near future because the JavaScript files need to be transpiled and bundled together using Babel and Webpack.

I guess the workflow should be something like:

  • A new site is created.
  • Update frontity.settings.js file with the new site info.
  • Trigger a new npx frontity build.

Wouldn’t that rebuild cause a downtime for every other site that is using the same frontity project?

Not if you use a proper hosting that does the building in parallel and only points to the new build after it is completed, like Heroku. All serverless services also work that way (Zeit Now, AWS Lambdas, Firebase, GC Functions…).

1 Like