Package Exports
- faun
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (faun) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Faun
Faun is a light-weight library to easily make micro-frontend applications.
Introduction
If we treat a huge front-end application as a molecule application, we can just make several atomic applications, and then gather them together with some proper combinations and make it sense to constitute the molecule application. It is what micro-frontend aims for.
Yet, when we trying to break down a huge application into several independent sub-applications, we might stuck in trouble with some annoying problems, such as:
- The form to organize sub-applications
- Where to host sub-applications' bundles and static assets
- How could a sub-application communicate with other sub-application or framework
- The behavior when handling router change
- When route changes, what should be load, and what should be unload
- How to clean up the global variables, event listeners, and so on
To avoid making the rules for every applications repeatedly, we made a common rule for building micro-frontend applications, and abstracted them into a library, named Faun.
[NOTE]
Faunis only an implementation of the rules we made and the definition from Micro Frontend, which does not meanFauncould be used as a production-ready micro-frontend framework.
Features
- Light weight: only 54 kB with terser
- COMPLETELY framework-independent
- Control the sub-applications by sandboxes and snapshots
- Load sub-applications based on JavaScript entries
- Style isolation supported
- History routing cache supported
- Lifecycle hooks integration
- Global event bus integration for communication
Installation
The package is now under development mode, if you seriously want to play with it, just read Getting Started
Since the package was ready to switch itself as a published NPM package, its name would be faun at NPM registry, in the near future, it could be installed by:
$ npm install faunAnother way to install it is link the AMD-bundled faun.min.js through script tag:
<script src="https://unpkg.com/faun@latest/dist/faun.min.js"></script>Documentation
Seriously coming soon, now part of the documentation is already in docs folder.
Getting Started
To run the project and the examples, you should clone the repository from GitHub:
$ git clone https://github.com/lenconda/faun.gitThen install the dependencies. The repository's dependencies are managed by npm:
$ cd faun
$ npm iThen you would have to install the dependencies for framework application and sub-applications:
$ npm run install:vue
$ npm run install:react
$ npm run install:frameworkIf it is a mode that you think is troublesome and makes you dislike it, just run:
$ npm run example:installThis command will serially install all dependencies for those applications.
It is the time to run the examples:
$ npm run start:vue
$ npm run start:react
$ npm run start:frameworkOr by executing a simpler command:
$ npm startThis command will start framework and sub-applications in parallel.
After finishing the steps above, and if everything goes well, these examples may already be running correctly, the examples will listen to following addresses:
- Framework App:
http://localhost:8080, if there is another process listening on it, the framework will look backward to find a free port, such ashttp://localhost:8081 - Vue App:
http://localhost:8181 - React App:
http://localhost:8182
Make sure 8181 and 8182 are not listening by another process.
You just open the browser and visit the framework's address.
Todo
- Global key-value storage support
- Custom plugins support
- Global interceptors support
- Development kit support
- Higher test coverage
- API docs
FAQ
Checkout FAQ at here.
You can make some questions at issues with
FAQtag, or directly contact me at i@lenconda.top or prexustech@gmail.com.
Community
Contributing
Just tell us what can we do for you! Before contributing, please check the Issues first for existing bugs and/or suggestions.
Want to be a contributor? Please refer to our Contribution Guide.
Grazie to all contributors!
Acknowledgements
- single-spa What an awesome meta-framework for micro-frontends!
- umijs/qiankun 📦🚀Blazing fast, simple and completed solution for micro frontends.
- ice-lab/icestark 🐯 Micro Frontends solution for large application
License
Faun is licensed under WTFPL.