npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

kaonjs

v1.4.6

Published

Kaon.js is a react isomorphic framework, render your code from server side, with automatic code splitting

Downloads

148

Readme

kaon.js

Kaon.js is an react isomorphic app solution. it contains webpack build, hot reloading, code splitting and server side rendering.

From

Kaon is a Decepticon-controlled city-state in the southern hemisphere of Cybertron. Under Decepticon rule, its capitol is the fortress of Kolkular.

The pronounce

['keɑn]

The main stack

  • koa
  • react
  • redux
  • react-router
  • react-helmet
  • webpack
  • postcss
  • react-hot-loader
  • loadable-components
  • babel

Usage

install

npm install kaonjs

or with yarn

yarn add kaon

add your config

Config is a js file that default exported a Javascript object, it specified a lot ot configurations. The default path is <project_root>/config/kaon.config.js. But you can put it into anywhere of your project.

The config file is not required, Kaon will use the default config as below:

const kaonConfig = {
  ssr: true,
  app: {
    name: 'Kaon Config Template (production)',
    shortName: 'rib',
    port: 1827,
    routes: `${baseDir}/app/routes`,
    middlewares: `${baseDir}/app/middlewares`,
  },
  resources: {
    root: `${baseDir}/public`,
  },
  isomorphic: {
    routes: `${baseDir}/src/routes`,
    store: `${baseDir}/src/store/configureStore.js`,
    main: `${baseDir}/src/client`,
  },
  postcss: {
    path: `${baseDir}/config/postcss.config.js`,
  },
  webpack: {
    client: `${baseDir}/config/webpack.client.config`,
    server: `${baseDir}/config/webpack.server.config`,
  },
  build: {
    host: 'localhost',
    port: 1592,
    path: 'build/',
    target: `${baseDir}/public/build`,
  },
};

An configuration specified these optons:

ssr

Enable or disable server side side rendering. Disable ssr will improve start up speed.

i18n

app

  • app.name - The app name
  • app.shortName - The short app name.
  • app.port - App listening port.
  • app.routes - Customize koa routes.
  • app.middlewares - the js file that will apply your middlewares.

resources

  • resources.root - If resources.root is exist, kaon will serve all files inside the path as static server.

isomorphic

  • isomorphic.routes - The client routes path, should be an string, the default value is <project_root>/src/routes.
  • isomorphic.store - The client store path, should be an string, the default value is <project_root>/src/store/configureStore
  • isomorphic.main - The client entry

postcss

  • postcss.path - If use postcss, shoud specify postcss path.

webpack

  • webpack.client - your client webpack configuration, object or function.
  • webpack.server - your server webpack configuration, object or function.

build

  • build.host - The dev server will server at this host.
  • build.port - the dev server port.
  • build.path - the dev server url path.
  • build.target - the build result path.

command line

command: kaon <cmd> [options]

commands

kaon start [options]

available options:

  • config - specify config path

kaon build [options]

available options:

  • config - specify config path

nodejs APIs

You can use kaon as an npm modules instead of cli.

const Kaon = require('kaon');
const kaon = new Kaon(config);

kaon.start();

environment variables

ENABLE_SSR

yes or no. If select yes, server side rendering will be enabled, no will disable server side rendering temporary.

apply your middleware.

First, configure your middleware path, it should be a javascript file like below:

const logger = require('koa-logger');
const favicon = require('koa-favicon');
const path = require('path');

function applyMiddlewares(app) {
  app.use(logger());
  app.use(favicon(path.join(__dirname, '../../public/favicon.ico')));
}

module.exports = applyMiddlewares;

The app instance will be passed to your function, then just call app.use to apply the middlewares.

apply your routes.

Just like apply middlewares. just don't forget configure your routes path in your config file.

const Router = require('koa-router');

function applyRoutes(app) {
  const router = new Router();

  router.get('/', async (ctx) => {
    ctx.body = 'hello world.';
  });

  app.use(router.routes());
  app.use(router.allowedMethods());
}

module.exports = applyRoutes;

add your customize script, styles, head tags, ect.

You can use react-helmet.

apply your own webpack configuration.

ATTENTION! You cannot override default entry with yours.

pm2 graceful reload

add the below configuration to your pm2

module.exports = {
  apps : [{
    name: "api",
    script: "./api.js",
    wait_ready: true,
    listen_timeout: 3000,
  }],
}

License

MIT