frank320 / breko-hub

Babel React Koa Hot Universal Boilerplate

Home Page:https://tomatao.gitbooks.io/breko-hub/content/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Circle CI

Babel React Koa - Hot Universal Boilerplate

Breko Hub

Greenkeeper badge

Breko hub is a github repository that helps anyone create new JavaScript applications. Giving you a technically sound and well tested starting point for your application.

Documentation

https://tomatao.gitbooks.io/breko-hub/content/ (outdated)

Features

  • Quick setup universal SPAs
  • Universal redux architecture
  • Hot reloading of CSS-modules
  • Fast server side hot updates
  • ES-next code-base
  • Hot reloading unit tests in a browser
  • A comprehensive integration and unit test suite
  • A lucid code-base
  • Great debugging tools

Prerequsits

Breko-hub will only work on node version 6 and above as it is making use of Koa v2 along with polyfills for async/await syntax. To make it work on a lower version of node, the runtime compilation would need to be applied to koa and other node_modules.

Quick Start

Use the following commands to get started on your new app using breko-hub.

git clone --depth=1 git@github.com:tomatau/breko-hub.git <directory-name>
cd <directory-name>
rm -rf .git
git init
npm i
mv example.env .env
npm start

With the default .env file, this will start your application in development mode on port 9001. It also provides a configuration for running the debugger with a useful console output.

Open a browser window at localhost:9001.

Blog

There is also a new blog that documents some of the techniques used in breko-hub. The blog was also created using breko-hub as a starting point.

Libraries

Breko hub uses the following libraries at its core:

Build tools
Server
  • koa - A lightweight server framework.
  • koa-router - Router middleware for koa.
  • socket.io - A node engine for WebSocket communication.
  • redux-via-socket.io - An adapter for sharing redux actions over WebSockets.
Universal Application
Utility
  • lodash - A popular modular utility library.
  • ramda - A modular utility library focused on functional programming.
Styling
  • SCSS - A popular CSS preprocessor.
  • PostCSS - CSS transformations with JavaScript.
  • css-modules - A build step for modular, local scoped CSS management.

Commands

Developing

npm run start [-- --open]

Builds and serves app with hot reloading and debugging support.

Build client-side app

npm run build

Creates bundles and assets into ./src/static directory. Reads .env but always uses production Webpack configuration.

Start the server

Set the NODE_ENV flag to production in your .env file.

npm start

Expects bundles and assets to exist in the ./src/static directory. Runs the server in production mode.

Unit test development server

npm run test:server

Start a test server using Mocha and Webpack-middleware. Provides a browser based testing environment. Loading tests from within ./src where extension is .test.js.

Unit test single run

npm run test:unit

Runs the test suite in a node environment through mocha, once.

integration tests run

npm run test:int

Runs integration tests inside ./test/integration directory.

Lint

npm run lint:js
npm run lint:styles

Reads .eslintrc and sass-lint.yml for linting configurations.

Coverage

npm run coverage
npm run coverage:check

Reads .istanbul.yml for thresholds in check.

Docker

There's a starting docker images you can use to get going. You'll probably wanr to modify the Dockerfile to your needs.

# production image built with assets
$ docker build -t tomatao/breko-hub .
# runs `npm start` with port at 9001
$ docker run -p 9001:9001 tomatao/breko-hub

About

Babel React Koa Hot Universal Boilerplate

https://tomatao.gitbooks.io/breko-hub/content/

License:MIT License


Languages

Language:JavaScript 98.2%Language:CSS 1.2%Language:Shell 0.6%