diff --git a/docs/QUICKSTART.md b/docs/QUICKSTART.md new file mode 100644 index 0000000..8da2d26 --- /dev/null +++ b/docs/QUICKSTART.md @@ -0,0 +1,99 @@ +# Quickstart guide + +This is a quickstart guide for deploying LibResilient on a website. This guide makes a few assumptions: +1. the website in question is a static site; +2. the administrators of the website have shell access on the hosting server, and ability to install software there; +3. LibResilient is going to be deployed for the whole site. + +These assumptions are made to simplify this quickstart guide and are *not necessary* for LibResilient to be able + +## The website + +We are going to assume a simple website, consisting of: + + - `index.html` + - `favicon.ico` + - an `/assets/` directory, containing: + - `style.css` + - `logo.png` + - `font.woff` + - a `/blog/` directory, containing two blog posts: + - `01-first.html` + - `02-second.html` + +In fact, this hypothetical website is very similar to (and only a bit simpler than) [Resilient.Is](https://resilient.is/), the homepage of this project. + +## First steps + +We shall start with a completely minimal (but not really useful) deployment of LibResilient, and then gradually add functionality. + +To start, we need: + + - [`libresilient.js`](https://gitlab.com/rysiekpl/libresilient/-/blob/master/libresilient.js)\ + This script is responsible for loading the service worker script. It can be included using a ` +``` + +Once we deploy these changes, our HTML files will load `libresilient.js` for each visitor, which in turn will register `service-worker.js`. That code in turn will load `config.json`, and based on it, will load the `/plugins/fetch.js`. + +Each user of our website, after visiting any of the HTML pages, will now have their browser load and register the Libresilient service worker, as configured. From that point on all initiated in the context of our website will always be handled by LibResilient, and in this particular configuration — the `fetch` plugin. + +This doesn't yet provide any interesting functionality, though. So how about we do that next. + +## Adding cache + +Bare minimum would be to add offline cache to our website. This would at least allow our visitors to continue to browse content they've already loaded once even if theya re offline or if our site is down for whatever reason.