blitzzz
choo + dat + ssr
Last updated 7 months ago by kodedninja .
MIT · Original npm · Tarball · package.json
$ cnpm install blitzzz 
SYNC missed versions from official npm registry.

blitzzz

:zap: choo + dat + server-side rendering

(proof-of-concept)

Blitzzz acts as a seeder and serves a mirror to http://. The http:// version is server-side rendered, using a modular system to load and use the data.

Made from Jon-Kyle's project-starterkit. Thanks for that!

Why?

Most sites on the peer-to-peer web use JS to load and render the content (which is a super-power), but this has some drawbacks when the site's mirrored to http://. Without server-side rendering these sites don't work on no-JS environments and also search engines do not find them (which might be important for many people).

I think we should fix these problems, having a site based on peer-to-peer technologies should give you something more and not take away important functionalities.

SSR can also make the site faster.

Usage

First of all you need a site using a combination of Choo and the DatArchive API. For static sites blitzzz is useless.

Blitzzz was originally built with Enoki in mind, but it uses a modular system to load and provide data to the renderer. See the Providers section.

Site configuration

You must add a config.blitzzz.yml file into the root folder of the archive. In this you can set values specific to the site. The two most important values are app and content. app is the location of the Choo entry file in the archive, content is the path to the content data (this gets passed to the "provider").

In the site field you can specify values related to the automatically generated HTML, the one that will be wrapped around your app.

content: /bundles/content.json
app: /source
minifyHTML: false

site:
  title: '{page} - blitzzz'
  css: /bundles/bundle.css
  js: /bundles/bundle.js
  root: main
  meta:
    description: Blazing fast sites.

Server configuration

On you server machine you'll need another configuration file (default location is ~/.blitzzz.yml). In this you can set the port, the Dat key of the site (!!!) and other values: the path to the provider file (defaults to /providers/enoki.js) and whether Blitzzz should cache the pages or not. The cache is cleared every time your site is updated.

# app
port: 8080
dat: dat://52cdf81e7dae04c93964f792138e054537a5b5b1cc13baaa988b1e77c74faadc/
provider: providers/enoki.js
cache: false || number of pages to keep in cache
email: undefined || email to bind the https certs to

Providers

Providers are functions that return an object with two methods: getState and update.

API:

  • provider = Provider(contentPath)
  • provider.getState(state) - it should extend and return the default state of the Choo app with the content
  • provider.update() - triggered when the archive was updated and should re-read the content

Todo

  • archiver
  • handle updates
  • clean old archive data if key's changed
  • https via greenlock

Current Tags

  • 0.0.1                                ...           latest (7 months ago)

1 Versions

  • 0.0.1                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (20)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |