Orion
Orion is a pluggable framework for microservices.
Following "batteries included but removable" design philosophy. Providing default implementations, but everything is swappable. Comes with built in support for MessagePack codec and NATS transport for communication.
Features
- Async communication: event driven architecture (pub/sub)
- Sync communication: request-response transport layer
- RPC: clean and simple interface to build services
Components
- Broker: provides an interface to a message broker for async pub/sub communication
- Transport: provides an interface for sync request/response communication
- Codec: used for encoding and decoding messages before transporting across the wire
- Service: provides an interface to name your service and register request handlers
- Client: provides an interface to make requests to services
Example
Service:
import { Service } from 'orion';
const service = new Service('calc');
service.handle('add', (request, reply) => {
reply(request.params.a + request.params.b);
});
Client:
import { Client } from 'orion';
const client = new Client('calc');
client.add({ a: 3, b: 2 }, (res) => {
console.log(res);
client.close();
});
Check out the examples folder for more examples.
Development
$ docker run -p 4222:4222 -p 8222:8222 -d nats -DV
$ npm install
$ npm test
$ npm run lint