In Frontity projects, WordPress is used as a headless CMS. Frontity uses data from the WP REST-API and generates the final HTML that is displayed in the browser using React. This means that WordPress is merely used for managing the content.
A Frontity project will always require two servers:
- 1.A WordPress Server (PHP), either:
- An Apache or Nginx web server running PHP
- A hosted software-as-a-service (SaaS) platform with WordPress such as WordPress.com
- 2.A Frontity Server (Node.js), either:
- A server running Node.js
- A hosted function-as-a-service (FaaS) platform allowing serverless computing, such as AWS Lambda or Netlify functions
Depending on the mode used, the main domain (e.g.
www.domain.com) will be connected either to the Wordpress/PHP Server (in Embedded mode) or to the Frontity/Node.js server (in Decoupled mode). The main domain is the one used by site visitors to access the HTML of the site.
The other server will get a secondary role and its domain can be either a separate domain (e.g.
project-d418mhwf5.vercel.app) or a sub-domain of the main domain (e.g.
Both of the two possible Frontity architectures (i.e. Decoupled or Embedded Mode) feature:
- A similar distribution of functionality across the servers
- WordPress is used as a CMS - to manage the content
- Frontity is responsible for the presentation
Both of these architectures (or modes) require two different servers with two different URLs but the communication workflow between these two servers differs in each case.
In this mode site visitors access the site using the main domain and are served HTML pages directly from Frontity, and the secondary domain is used by content editors to access the WordPress admin pages. Frontity fetches data from the REST API located on the secondary domain, i.e. the WordPress installation.
Decoupled mode needs no additional structural elements, such as plugins.
- The secondary domain (which can be a subdomain of the main domain) points to Frontity.
- All the requests are handled by WordPress. No reverse proxy is needed.
- The PHP theme is replaced with an internal HTTP request to the Frontity server.
- Other WordPress URLs (i.e. those not handled by Frontity) work normally.
In Embedded mode the main domain points to the WordPress installation, and the secondary domain points to the node.js server running Frontity. In this mode both site visitors and content editors use the same domain, i.e. the main domain, to either visit the site or access the admin pages. The secondary domain is never directly accessed.
Since, in embedded mode, the Frontity site is never directly accessed the secondary domain can be anything - including free domains allocated by the node.js hosting service.