Setting up a static website generator with Cloudflare Pages


We are dev team working on a new feature on top of our platform for restaurant reservations management.

We would like to start offering to our clients simple websites, which we would generate with a “restaurant website generator”.
From our Admin Panel, ou team would setup a restaurant website from the restaurant profile, parameter it with domain name, set texts, upload logo and photos and “launch” it.
We already have 3 custom restaurant website templates in HTML (only a few pages, index.html, contact.html, menu.html, privacy-policy.html), all data needed can already be created in our backend and is accessible through our API.

We’re looking into the best technical solution to achieve this and to host the websites as static websites for the best SEO, likely on Cloudflare Pages.
Whatever the solution chosen we will likely have to setup on the server/infrastructure each new domain and have a SSL certificate generated.

We are thinking about generating static websites : we generate the websites’ HTML on demand from our backend app and send them to the infrastructure through an API.
Is Cloudflare Pages the right way for that?
We would not have a repository for each website, just static HTML files. Can we create new websites, setup domain name, upload HTML files via the Cloudflare API?

An alternative would be a Dynamic Website Generator : the website is generated by the frontend depending on the domain name requested, with data fetched from our API. We initially thought we would use Astro (JS framework) for this, we built websites this way before, but we can’t manage to retrieve the domain name and send it to the API. We are looking to use Nuxt or Next instead.

Thanks for anyone that could help us figure out if Cloudflare Pages is the thing we shoud look into.
Of what I see we would need an Enterprise plan to allow apex domains directly.

Sounds like it could work well and is similar to what others do

You can generate the site, make a new project (in wrangler or through the API) and then upload the files through Wrangler
Then to attach a domain use the API.

Yep this is another way. In Functions you can use the request URL for the hostname (or host header)

You do not need Enterprise, any plan can add apex domains as custom domains on Pages or Cloudflare

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.