Most libraries provide a way to do Server-Side Rendering (SSR), which is perfect for SEO. But SSR is not always possible, so a Pre-rendering application such as Rendergun is another solution.
Pre-rendering is recommended by Google. Visit https://developers.google.com/search/docs/guides/dynamic-rendering to learn more.
- 🚀 Uses a real, stable and up-to-date Chromium (Google Chrome): Built on top of puppeteer, an API for Headless Chrome
- 👩🏻⚕️ Self-healing: Rendergun constantly checks the health of the browser instance and restart it if necessary.
- ⚡️ Cache: Pages are cached to provide lightning fast responses.
- 🔀 Skip unnecessary requests: Rendergun can skip requests that are not required for rendering, such as CSS and Images files, which can greatly increase the performance of the rendering process.
- 🐳 Runs on Docker: Rendergun has an official Docker image. Just pull and run it!
How to install
Rendergun can be used as a Node.js CLI or Docker container.
Rendergun Node.js CLI
# install rendergun install NPM$ npm i -g rendergun# start rendergun with default configuration$ rendergun
Rendergun Docker Container
docker run --name rendergun -p 3000:3000 goenning/rendergun
- Use Case: Request an HTML rendered version of a webpage
- HTTP Method: GET or POST
|QueryString||url||Yes||which url to pre-render|
|Body||N/A||No||Rendergun will skip the initial page load of
||No||which chrome event to wait before returning the HTML. Possible values are
||No||timeout in milliseconds for Chrome to load the page|
|HTTP Header||x-rendergun-abort-request||No||a RegExp that aborts all requests that matches it. Useful to skip requests to CSS/Images files that are not required for pre-rendering|
|HTTP Header||x-rendergun-block-ads||false||No||true/false if Rendergun should skip requests to Ads/Trackers domains. This gives a small performance improvement and avoid unecessary tracking|
- Use Case: Check if Rendergun is healthy
- HTTP Method: GET
This is used to verify if Rendergun and the Headless Chrome instance are healthy. If everything is OK,
200 status code is returned, otherwise
500. Rendergun will constantly monitor the health of Headless Chrome instance and restart it if necessary.
Rendergun can be customized by using Environment Variables. The following settings are available.
||which port Rendergun should bind to|
||how many megabytes should Rendergun use for caching|
||how long (in seconds) should items be cached|