kites

1.0.1 • Public • Published

kites

Template-based Web Application Framework

Join the chat at https://gitter.im/nodevn/kites npm version npm downloads Travis

Kites is a framework providing dynamic applications assembling and Template-based extracting. Namely it contains a lot of templates and extensions to help building a new application quickly.

Installation

# install kites cli 
$ npm install -g @kites/cli
 
# init a project 
kites init my-project --template mvc
 
# move to project workspace 
cd my-project
 
# install dependencies 
npm install
 
# run app server, navigate browser at http://localhost:3000 
npm start

Development environment:

# start project in development mode 
npm run dev

To change environment use cmd set NODE_ENV=development or use options your IDE provides. If you don't specify node environment kites assumes development as default.

Documentation

  • See Overview for an overview of concepts, guides and general documentation.
  • See Templates for installation guides how to create a new project based on Kites Templates.

Templates

Here is the list of built-in templates and their implementation status:

  • mvc: Assembling all into complete ship (default)
  • basic: Template for building from scratch
  • apidoc: Template for API Documentation
  • express: Template for Express Application
  • chatbot: Template for generating an AI Chatbot

More templates, checkout issue #1

Extensions

Kites is an eco-system and has many modules which can be assembled into a larger application. You are welcome to write your own extension or even publish it to the community.

TODO:

  • Write an article for implementing custom kites extension

Extensions auto discovery

Kites by default auto discovers extensions in the application's directory tree. This means kites by default searches for files kites.config.js which describes the extensions and applies all the extensions that are found.

// let kites autodiscover the extensions
var kites = require('kites')({
    logger: {
        console: {
        transport: 'console',
        level: 'debug'
    }
});
 
// init the kites
kites.init().then(() => {
    kites.logger.info('done!')
})

Kites extensions auto discovery slows down the startup and can be explicitly using use function with mode discover: false

// do not let kites autodiscover the extensions
// do not load extensions from locations cache
var kites = require('kites')({
    discover: false,
    extensionsLocationCache: false,
    logger: {
        console: {
        transport: 'console',
        level: 'debug'
    }
});
 
// explicitly use extensions
kites.use(require('@kites/express')())
    .use(require('@kites/roomrtc')())
    .use(require('./path/to/your/extension')())
    .init().then((kites) => {
        kites.logger.info('done!')
    })

Logging

kites leverages winston logging abstraction together with debug utility. To output logs in the console just simply set the DEBUG environment variable

DEBUG=kites node app.js

on windows:

set DEBUG=kites & node app.js

kites exposes logger property which can be used to adapt the logging as you like. You can for example just add winston console transport and filter in only important log messages into console.

var kites = require('kites')();
var winston = require('winston');
kites.logger.add(winston.transports.Console, { level: 'info' });

License

MIT License

Copyright (c) 2018 Nhữ Bảo Vũ

The MIT License

Package Sidebar

Install

npm i kites

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

9 kB

Total Files

6

Last publish

Collaborators

  • vunb