The StarHQ Web Framework
StarHQ is a DI(dependency injection) included web framework for MSA(micro-service arcihtecture) using RabbitMQ, MongoDB, Redis and Consul.
StarHQ is inspired by Island, but made it easier to use.
Installation
$ npm i starhq
Service Topology
Client <-> GatewayStar <-> RabbitMQ <-> HelloStar <-> (RabbitMQ, Redis)
Getting Started
I personally you recommend to use Controller - Service - Repository
structure to build the app.
- Controller takes the responsibility for the taking and validating parameters.
- Service takes the responsilbilty for all the business logics.
- Repository takes the responsibility for dealing with Storages like MongoDB, Redis, Consul, etc.
Available Environment Variable
Name | Default | Description |
---|---|---|
CONSUL_URL | consul | |
CONSUL_PORT | "8500" | |
CONSUL_TOKEN | 01CE1A0F-F2CB-3BA5-B21F-3048816B5928 | |
MQ_URL | rabbitmq | |
MQ_PORT | "5672" | |
MONGO_URL | mongo | |
MONGO_PORT | "27017" | |
MONGO_DB | test | |
LOG_LEVEL | debug |
Example
// app.ts ; ;;;;;; // Your starting point new EchoStar'echo'.run; // Endpoint example // Event example // RPC example // Service // Repository
and run the server
$ tsc$ node app.js