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. johndoe.myapp.com), but the users should have the option to use a custom domain also (eg. johndoe.com).
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?
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.
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.
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.
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ā¦).
I have similar requirements. but when I use your explained method to get data on the fly in frontity.settings.js. It does not work for me. Error : Cannot read property āmapā of undefined.
It is still in development or you have added in frontity project??