Extracting PagedJS Previewer out of Editoria into its own server
Current architecture
- Hosted on the same backend as Editoria
- Input: HTML content from exporter & CSS stylesheet
- Output: Static HTML file, that includes the PagedJS library in a script tag
- Rendered in an iframe
Future direction
For security reasons since we’ll be adding script (JS) support, separation of concerns and to lighten the load on the resources of Editoria backend proper, the idea is to move PagedJS previewer to a separate server. It should accept the same input (HTML content, assets, CSS & JS files, all bundled in a zip file) and return the static HTML file that will be rendered
Important notes
- PagedJS does not support dynamic generation based on CSS changes. A new HTML file for rendering in the iframe should be generated every time there’s a change.
- JS editor as a whole should be turned off in Editoria by default, with the ability to turn it on through the config file.
- For a first iteration, the two servers (Editoria and this new service) should use the same secret so that we can do authentication using the same JWTs.