├── .dockerignore ├── .gitignore ├── .npmignore ├── README.md ├── bin └── cli.js ├── package-lock.json ├── package.json ├── src ├── index.ts ├── logger.ts ├── plugins.ts ├── proxy-cache.ts ├── ssr-build.ts ├── ssr-proxy.ts ├── ssr-render.ts ├── types.ts └── utils.ts ├── test ├── build.ts ├── docker │ ├── docker-compose.yml │ ├── nginx.Dockerfile │ ├── nginx.conf │ ├── ssr-proxy-js.config.json │ └── ssr.Dockerfile ├── package-lock.json ├── package.json ├── proxy.js ├── proxy.ts ├── public │ ├── iframe.html │ ├── index.css │ ├── index.html │ ├── index.js │ ├── nested.dot │ │ ├── index.dot.css │ │ └── index.html │ ├── nested │ │ ├── index.css │ │ └── index.html │ └── page.html ├── ssr-build-js.config.json ├── ssr-proxy-js.config.json ├── test-request.js ├── test-stream.js └── tsconfig.json ├── tsconfig.json └── webpack.config.js /.dockerignore: -------------------------------------------------------------------------------- 1 | # Node.js .dockerignore 2 | 3 | **/dist 4 | **/logs 5 | **/*.log 6 | **/node_modules/ 7 | **/npm-debug.log 8 | **/.git 9 | **/.vscode 10 | **/.gitignore 11 | **/.dockerignore 12 | **/README.md 13 | **/LICENSE 14 | **/.editorconfig 15 | **/Dockerfile 16 | **/*.Dockerfile 17 | **/docs 18 | **/.github -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Node.js .gitignore 2 | 3 | **/dist 4 | **/node_modules 5 | output.html 6 | 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | pnpm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | lerna-debug.log* 15 | 16 | # OS 17 | .DS_Store 18 | 19 | # Tests 20 | /coverage 21 | /.nyc_output 22 | 23 | # IDEs and editors 24 | /.idea 25 | .project 26 | .classpath 27 | .c9/ 28 | *.launch 29 | .settings/ 30 | *.sublime-workspace 31 | 32 | # IDE - VSCode 33 | .vscode/* 34 | !.vscode/settings.json 35 | !.vscode/tasks.json 36 | !.vscode/launch.json 37 | !.vscode/extensions.json -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | test/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [](https://www.npmjs.com/package/ssr-proxy-js) 2 | [](https://www.npmjs.com/package/ssr-proxy-js) 3 | 4 | # SSRProxy.js 5 | 6 | Modes:\ 7 | [SSR Build - Static Site Generator](#ssr-build-static-site-generator-mode)\ 8 | [SSR Proxy - Server Rendering](#ssr-proxy-server-rendering-mode) 9 | 10 | A Node.js tool for Server-Side Rendering (SSR) and Static Site Generation (SSG) using headless Chrome via Puppeteer. 11 | 12 | Server-Side Rendering, or SSR for short, is a technique used to serve Single-Page Applications (SPAs, e.g. React.js, Vue.js and Angular based websites) with Web Crawlers in mind, such as Googlebot. Crawlers are used everywhere in the internet to a variety of objectives, with the most known being for indexing the web for search engines, which is done by companies such as Google (Googlebot), Bing (Bingbot) and DuckDuckGo (DuckDuckBot). 13 | 14 | The main problem of serving SPAs "normally" (i.e. Client-Side Rendering) is that when your website is accessed by a Web Crawler, it's usually only able to read the source HTML code, which most probably does not represent your actual website. In case of a React App, for example, a Crawler might be only able to interpret your website like so: 15 | 16 | ```html 17 | 18 | 19 |
20 | 21 |