Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3246 static pages #3256

Merged
merged 14 commits into from
Aug 1, 2019
Merged

Feature/3246 static pages #3256

merged 14 commits into from
Aug 1, 2019

Conversation

pkarw
Copy link
Collaborator

@pkarw pkarw commented Jul 18, 2019

Related issues

closes #3246

I've added a static page generator that will be combined with the SSR output cache at some point. The POC is a separate CLI tool that generates the static HTML files for all the products and categories one have in Elastic.

Short description and why it's useful

The whole static/ folder can be deployed to any static file hosting of one's wish - including Netlify, S3, and other providers. The load time for SSR requests will be extremely low (low 2-3ms).

Note: The API however still will be needed for the CSR requests + dynamic requests (like shopping cart updates).

Screenshots of visual changes before/after (if there are any)

Screenshot 2019-07-18 15 21 39

TODO:

  • page/size parameters supported for generating the page structure
  • entityType parameter (product, category, cmsPage) support
  • generate promises throthling (currently we're running like 50 SSR requests at once - it should be configurable)
  • on-demand/on-request static page invalidation integrated into core/server.js
  • factory design pattern to support nnot only the static files but also S3, Netlify deployments

@pkarw pkarw added the not ready for merge PR is holded. Needs some clarifications or things that need to be finished. label Jul 18, 2019
@pkarw pkarw changed the base branch from master to develop July 18, 2019 13:33
@filrak
Copy link
Collaborator

filrak commented Jul 18, 2019

This is awesome!

@pkarw pkarw changed the title [WIP] Feature/3246 static pages POC Feature/3246 static pages POC Jul 25, 2019
@pkarw pkarw requested review from patzick and filrak and removed request for patzick July 25, 2019 14:39
@pkarw
Copy link
Collaborator Author

pkarw commented Jul 25, 2019

done! @patzick and @filrak please do a review and merge; it's an experimental feature for now but as I've tested it works pretty OK. Initially, I wanted to integrate it with the SSR cache (in order to invalidate the static pages as the products and categories got changed); but as for now, I think we'll wait for the response from the users if this feature does have any real-world application :)

@pkarw pkarw removed the not ready for merge PR is holded. Needs some clarifications or things that need to be finished. label Jul 25, 2019
@pkarw pkarw changed the title Feature/3246 static pages POC Feature/3246 static pages Jul 26, 2019
Copy link
Collaborator

@filrak filrak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is prty amazing! :)

Can you briefly explain which parts in server js are specific to this static rendering mechanism? For the sake of modualrity it would be good to know this

@pkarw
Copy link
Collaborator Author

pkarw commented Aug 1, 2019

I moved everything out to helpers so no code duplicates with core server

@pkarw pkarw merged commit 61413e1 into develop Aug 1, 2019
@patzick patzick deleted the feature/3246_static_pages_poc branch August 1, 2019 21:13
@agcty
Copy link

agcty commented Aug 27, 2019

So if I understand this feature request correctly it allows for static page generation, which can then be hosted on netlify etc. so no node server is necessary any more? But the API will still need to be hosted somewhere?

@pkarw
Copy link
Collaborator Author

pkarw commented Aug 27, 2019

@agcty yeah, exactly as you wrote! API still needs to be hosted somewhere on node.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants