node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

island

island v1.5

An opinionated, full-stacked Microservices framework for node, powered by TypeScript.

Build Status NPM version Dependency Status Coverage Status Test Coverage Code Climate Issue Count

import * as island from 'island';
import * as keeper from 'island-keeper';
import { EndpointController } from './controller/endpoint.controller';
import { EventController } from './controller/event.controller';
 
const serviceName = 'hawaii';
 
class HawaiiIslet extends island.Islet {
  main() {
    const islandKeeper = keeper.IslandKeeper.getInst();
    islandKeeper.init('consul', 'island');
    islandKeeper.setServiceName(serviceName);
 
    const amqpChannelPoolAdapter = new island.AmqpChannelPoolAdapter({url: 'amqp://rabbitmq:5672'});
    this.registerAdapter('amqpChannelPool', amqpChannelPoolAdapter);
    const rpcAdapter = new island.RPCAdapter({amqpChannelPoolAdapter, serviceName});
    rpcAdapter.registerController(EndpointController);
    this.registerAdapter('rpc', rpcAdapter);
 
    const eventAdapter = new island.EventAdapter({amqpChannelPoolAdapter, serviceName});
    eventAdapter.registerController(EventController);
    this.registerAdapter('event', eventAdapter);
  }
}
 
island.Islet.run(HawaiiIslet);

Table of Contents

Installation

$ npm install island --save

Features

  • Free from service discovery
  • Support various types of communication
    • RPC(strong link between islands)
    • Event(weak link between islands)
    • Push messaging(to user) via socket.io
  • Ensure that each island gets proper parameters
  • Track communications per each request
  • Chain contexts with UUID per each request

v1.2

Changes

  • Support to expand langid from property name for @validate @sanitize #69
  • Fix singleton bug #64

v1.0

Changes

  • Loggers is no longer a part of island -> island-loggers #14
  • Di is no longer a part of island -> island-di #16
  • @endpoint decorator now provides 4 more methods #28
    • @endpoint('GET /test') still works
    • @endpoint.get('/test') - You can omit the GET method
    • @endpoint.post('/test') - You can omit the POST method
    • @endpoint.put('/test') - You can omit the PUT method
    • @endpoint.del('/test') - You can omit the DEL method

Breaking Changes

  • Require TypeScript@2.x
    • strictNullChecks

Building

In order to build the island, ensure that you have Git and Node.js installed.

Clone a copy of the repo:

$ git clone https://github.com/spearhead-ea/island.git

Change to the island directory:

$ cd island

Install prerequisites and dev dependencies:

$ npm install -g gulp typescript
$ npm install

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ RABBITMQ_HOST=localhost npm test

Environment Variables

Environment Notes
NODE_ENV When development, allows APIs which has options.developmentOnly
HOSTNAME TraceLog uses this as a name of node
ISLAND_RPC_EXEC_TIMEOUT_MS Timeout during execution (Defaults to 25000)
ISLAND_RPC_WAIT_TIMEOUT_MS Timeout during call (Defaults to 60000)
ISLAND_SERVICE_LOAD_TIME_MS Time to load service (Defaults to 60000)
ISLAND_LOGGER_LEVEL Logger level of category island
ISLAND_TRACEMQ_HOST MQ(formatted by amqp URI) for TraceLog. If omitted it doesn't log
ISLAND_TRACEMQ_QUEUE A queue name to log TraceLog
SERIALIZE_FORMAT_PUSH currently able Push format json and msgpack (Default to msgpack)
STATUS_EXPORT If it is true, use island-status-exporter (Defaults to false)
STATUS_EXPORT_TIME_MS Time to save file for instance status (Defaults to 10000)
STATUS_FILE_NAME island-status-exporter uses this as a name for file

Milestones

For details on our planned features and future direction please refer to our milestones

People

The original author of island is Wonshik Kim

The current lead maintainer is Kei Son

List of all contributors

License

MIT