Code Monkey home page Code Monkey logo

puzzle-js's Introduction

PuzzleJs Logo

PuzzleJs Framework

Micro frontend framework for scalable and blazing fast websites.

CircleCI npm npm Known Vulnerabilities codecov

New documentation and demo is under development

PuzzleJs makes it easy to create gateways and storefront projects that talk each other. It is inspired by Facebook's BigPipe, developed with lots of great features and passion.

Why?

The traditional model is very inefficient for modern websites.

  • Multiple teams working on the same code make everything harder to manage.
  • Time to first byte is as fast as the slowest api.
  • While backend is collecting data, user browser is wasting time waiting for first byte.
  • Features can't be online as soon as it is fully developed and tested, because other teams' features are not ready yet.
  • You can't use different technologies except from the existing one.
  • You can't scale specific process, because you are dependent to whole system.

Features

  • First Time To Byte PuzzleJs compiles html template into javascript function on compile time. This operation is fully independent from the request, so PuzzleJs can send the first chunk using this function.
  • Seo Friendly PuzzleJs is fully SEO friendly, as everything is prepared and rendered on server side.
  • Extensibility It is easy to extend PuzzleJs with your custom functions.
  • Easy You can easily create a gateway or storefront and connect them by providing a configuration file.
  • Independent You can use any technology on your gateways, PuzzleJs is fully independent from your technologies. ReactJs, Vue or anything else.
  • Scalable PuzzleJs can create storefront and gateways independent from each other. So you can easily scale single project on Dockerized environments.
  • Fail-Safe When your api required by a fragment is down, PuzzleJs guarantees other page fragments will be still working.

Getting Started

Checkout quick start guide for fastest implementation.

  1. Create one or more gateway projects.
  2. Create fragments and api on gateway projects.
  3. Create a storefront project and connect gateways with a config file.
  4. Create pages on storefront project and provide html files with desired fragments.

Please check the guide for full documentation.

How PuzzleJs works?

Compile time

  1. Gateways start exposing their fragments, api and gateway information.
  2. Storefront fetches registered gateways' information.
  3. Storefront downloads and caches required fragments, dependencies and assets.
  4. Storefront compiles html into in memory javascript function for fastest template rendering.

On Request

  1. Storefront sends a chunked response with the compiled function but doesn't close the connection. Users are now able to see your website with static contents and placeholders. It also sends backend requests to gateways to recieve rendered fragments.
  2. After any fragment is recieved from gateway, it sends it to browser as a chunk and replaces previously sended placeholder with the content.
  3. When all fragments are sent, PuzzleJs closes connection.

Documentation

Read the guide to familiarize yourself with how PuzzleJs works.

Showcases

trendyol international mweb
trendyol international mobile web site

(Please turn on devtool mobile emulator mod to view mweb site)

trendyol international web
trendyol international web site

trendyol turkey mweb
trendyol turkey mobile web site

(Please turn on devtool mobile emulator mod to view mweb site)

Contributions

Feel free to contribute to PuzzleJs, please read Contributions for detailed information.

puzzle-js's People

Contributors

acanguven avatar adeministratortr avatar antkaynak avatar barisesen avatar baspinarenes avatar cagataycali avatar cihadhoruzoglu avatar dependabot-preview[bot] avatar dependabot-support avatar efdalincesu-ty avatar emre-kul avatar erdoganoksuz avatar eylmz avatar fport avatar hasantezcan avatar mbirinci avatar mehmetsefabalik avatar merttosun avatar numankacar avatar sametaylak avatar scokmen avatar shaojieliu avatar sukrukirman avatar tolgacesur avatar yunusemredilber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puzzle-js's Issues

require('puzzle-microfrontends') failing

With,
`

node ./index.js

internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module 'base'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/Volumes/Backup/Workspace/netflix-micro-frontend/layout-service/node_modules/puzzle-microfrontends/dist/index.js:12:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
`

I think it's due to require("base"); in the dist\index.js, removing this working fine

Doubt about possible implementations.

Hello

I apologize in advance if this is not the right place to post this kind of inquiry, i couldn't find a forum / slack / discord out there . :/

I was reading the documentation and the architecture said

there are two types of implementation, storefront & gateway

I assumed i could use puzzleJS by either Storefront, Gateway or both.

I continued to read about the Storefront and the very first line said:

Storefront is the main application that handles requests coming from user's browser

This line made me doubt, so my question is: Does the gateway can live without the Storefront?. or i need the storefront in order to make puzzleJs to work properly.

Cheers

puzzle-warden with puzzle-js

puzzle-warden seems to be quite interesting, can this seat between the storefront and Gateway route and before the storefront pages, Thanks.

SEO Friendly?

Can you explain or add it to docs how it is SEO friendly?

Upgrading Helmet to the next major version

I'm the maintainer of Helmet. I plan to release the next major version this Sunday, 2020-08-22.

Is there anything I can do to help get this project upgraded to helmet@4?

If you'd like to try out the release candidate now, you can install it with npm install helmet@next. If you'd rather discuss things outside of this issue, feel free to reach out to me another way.

Hope I can be helpful!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.