Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/elmariofredo/elm-hn-pwa

Hacker News as a PWA built with Elm
https://github.com/elmariofredo/elm-hn-pwa

Last synced: 2 months ago
JSON representation

Hacker News as a PWA built with Elm

Lists

README

        

# Elm Hacker News Progressive Web App



Sample of [HNPWA](http://hnpwa.com) built with [Elm](http://elm-lang.org) version 0.18, using the official [Hacker-News API](https://github.com/HackerNews/API)

Available on [hnpwa.skingrapher.com](https://hnpwa.skingrapher.com)

## Progressive

- **100** on [lighthouse](https://hnpwa.skingrapher.com/lighthouse.html)
- **91** on [webpagetest](https://www.webpagetest.org/result/171012_1D_2e14b74f9e034fb5d5f2e88891be0791/) for a slow 3G connection
- service worker partially generated by [workbox](https://workboxjs.org) for static files precache
- offline caching of HN data
- no server-side rendering actually

## Reliable

- interactive under 5 seconds on a Moto 4G over 3G (see webpagetest below)
- first interactive (emerging markets): 4.8s
- first interactive (faster 3G): 3.2s

## Responsive

CSS file:
- built with [Sass](https://sass-guidelin.es/)
- inspired from [Material Design Lite](https://getmdl.io/components/index.html)
- less than 4kb
- inlined in index.html for better performance
- style supported by all devices (smartphones, tablets and larger screens)

## Accessible

- **100** on lighthouse (see link to report below)
- valid accessibility according to WCAG 2.0 (level AAA) guidelines
- contrast level AAA between background and text for all colors
- new ARIA **feed** role with **aria-posinset** and **aria-setsize** attributes exists in [WAI-ARIA 1.1](https://www.w3.org/TR/wai-aria-1.1/#feed)
- no error according to [a11y.css](https://ffoodd.github.io/a11y.css/)
- no bitmap pictures
- added **noopener** and **noreferrer** relations to links to prevent from target="_blank" vulnerability abuse

## Versions

### 0.11

stable release without pagination

## TODO

- testing background sync
- lazy loading for very extensive comments

## Build elm.js howto

elm make Hnpwa.elm --output elm.js

then the js file is minified and its code is incorporated as a part of the script in index.html

## Resources

- about PWA: read on [Google](https://developers.google.com/web/progressive-web-apps/) page for developers
- check the [awesome PWA](https://github.com/hemanth/awesome-pwa) list
- elm tutorials for SPA: [client elm](https://github.com/foxdonut/adventures-reactive-web-dev/tree/elm-010-todolist-feature/client-elm) by Fred Daoud, [elm spa example](https://github.com/rtfeldman/elm-spa-example) by Richard Feldman, [elmstagram](https://github.com/bkbooth/Elmstagram) by Ben Booth
- about service workers API: read on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)

## Credits

- github icon from [Entypo](https://entypo.com)
- original elm SVG logo [here](https://upload.wikimedia.org/wikipedia/commons/f/f3/Elm_logo.svg)
- SVG loader by [Sam Herbert](http://samherbert.net/svg-loaders/)