vue-hackernews-2.0 README

The project's README from github.com/vuejs/vue-hackernews-2.0. As one markdown file: README.md.

vue-hackernews-2.0

HackerNews clone built with Vue 2.0 + vue-router + vuex, with server-side rendering.


Live Demo

Features

Note: in practice, it is unnecessary to code-split for an app of this size (where each async chunk is only a few kilobytes), nor is it optimal to extract an extra CSS file (which is only 1kb) -- they are used simply because this is a demo app showcasing all the supported features.

A Note on Performance

This is a demo primarily aimed at explaining how to build a server-side rendered Vue app, as a companion to our SSR documentation. There are a few things we probably won't do in production if we were optimizing for performance, for example:

It is therefore not recommended to use this app as a reference for Vue SSR performance - instead, do your own benchmarking, and make sure to measure and optimize based on your actual app constraints.

Architecture Overview

screen shot 2016-08-11 at 6 06 57 pm

A detailed Vue SSR guide can be found here.

Build Setup

Requires Node.js 7+

# install dependencies
npm install # or yarn

# serve in dev mode, with hot reload at localhost:8080
npm run dev

# build for production
npm run build

# serve in production mode
npm start

License

MIT

vue-hackernews-2.0 (vuejs/vue-hackernews-2.0)

single-page-app
Searching Database…

What is this?A demo app that clones Hacker News using Vue 2.0, vue-router and Vuex, with server-side rendering. It's built as a companion project to Vue's official SSR documentation.
Is this a framework or a sample app?It's a reference/demo application, not a framework or library. It's meant to be read and learned from, showing how to structure a real SSR Vue app.
How do I run it locally?Install dependencies with npm, then run the dev script which starts the Node server (npm run dev). For production, npm run build compiles client and server bundles before npm start serves them.
What do I need installed first?Node.js 7 or higher and npm 4 or higher. It uses Express for the server and Firebase's Hacker News API for data, plus vue, vue-router and vue-server-renderer for SSR.
Is this good to copy for a production SSR setup?No — the author warns against using it as a performance reference since things like code-splitting and CSS extraction are only included to showcase features, not because they're optimal at this app's small scale.
Where does the Hacker News data come from?It uses the Firebase-based HN API, which the author notes enables real-time updates but adds extra bundle size and no efficient batch-fetching.
Is it a Progressive Web App?Yes, it includes an app manifest and a service worker, and the demo claims a 100/100 Lighthouse score.
Does it do anything fancy with routing or list updates?It has route-level code splitting, preload/prefetch resource hints, and FLIP-animated real-time list updates when switching views.
How is state managed between server and client?Vuex handles state with server-side data pre-fetching, then the client hydrates the DOM and state from what the server rendered.
Creator
vuejs
Size
1 MB
Stars
10.8K
Updated
CommitJan 20
Age
10y
Commits · 90 Days