@nestcloud/common v0.7.17
NestCloud
NestCloud is a NodeJS micro-service solution, writing by Typescript language and NestJS framework. Consul, Etcd or Kubernetes all can be the service discovery center for NestCloud.
Install
You need install the packages by the service discovery that which you select.
Consul Backend
$ npm install --save @nestcloud/core
$ npm install --save @nestcloud/common
$ npm install --save @nestcloud/boot
$ npm install --save @nestcloud/consul
$ npm install --save @nestcloud/service
$ npm install --save @nestcloud/config
$ npm install --save @nestcloud/loadbalance
$ npm install --save @nestcloud/feign
$ npm install --save @nestcloud/logger
Etcd Backend
$ npm install --save @nestcloud/core
$ npm install --save @nestcloud/common
$ npm install --save @nestcloud/boot
$ npm install --save @nestcloud/etcd
$ npm install --save @nestcloud/service
$ npm install --save @nestcloud/config
$ npm install --save @nestcloud/loadbalance
$ npm install --save @nestcloud/feign
$ npm install --save @nestcloud/logger
Kubernetes Backend
$ npm install --save @nestcloud/core
$ npm install --save @nestcloud/common
$ npm install --save @nestcloud/boot
$ npm install --save @nestcloud/config
$ npm install --save @nestcloud/loadbalance
$ npm install --save @nestcloud/feign
$ npm install --save @nestcloud/logger
$ npm install --save @nestcloud/kubernetes
Docs
Examples
Starter
Components
Consul
Consul module.
Etcd
Etcd module.
Memcached
Memcached module.
Kubernetes
Kubernetes client module.
Boot
Get local configurations.
Config
Get & watch remote configurations from Consul KV or Kubernetes ConfigMap.
Service
Service registration and service discovery
Loadbalance
Software load balancers primary for rest calls.
Feign
A decorator and loadbalance http client.
Grpc
A loadbalance grpc client.
Proxy
A API proxy module.
Schedule
A job scheduler that supports distributed and decorator.
Logger
Logger module based on winston@2.x
Validations
Validate request params.
Rbac
Role based access control.
Quick Start
main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { NestLogger } from '@nestcloud/logger';
import { NestCloud } from '@nestcloud/core';
async function bootstrap() {
const app = NestCloud.create(await NestFactory.create(AppModule, {
logger: new NestLogger({
path: __dirname,
filename: `config.yaml`
}),
}));
await app.listen(NestCloud.global.boot.get('consul.service.port', 3000));
}
bootstrap();
app.module.ts
import { Module } from '@nestjs/common';
import { NEST_BOOT, NEST_LOADBALANCE, NEST_CONSUL } from '@nestcloud/common';
import { BootModule } from '@nestcloud/boot';
import { ConsulModule } from '@nestcloud/consul';
import { ConfigModule } from '@nestcloud/config';
import { ServiceModule } from '@nestcloud/service';
import { LoadbalanceModule } from '@nestcloud/loadbalance';
import { FeignModule } from '@nestcloud/feign';
import { LoggerModule } from '@nestcloud/logger';
import { TerminusModule } from '@nestjs/terminus';
@Module({
imports: [
LoggerModule.register(),
BootModule.register(__dirname, `config.yaml`),
ConsulModule.register({ dependencies: [NEST_BOOT] }),
ConfigModule.register({ dependencies: [NEST_BOOT, NEST_CONSUL] }),
ServiceModule.register({ dependencies: [NEST_BOOT, NEST_CONSUL] }),
LoadbalanceModule.register({ dependencies: [NEST_BOOT] }),
FeignModule.register({ dependencies: [NEST_BOOT, NEST_LOADBALANCE] }),
TerminusModule.forRootAsync({
useFactory: () => ({ endpoints: [{ url: '/health', healthIndicators: [] }] }),
}),
]
})
export class AppModule {
}
Samples
Who used
Stay in touch
- Author - NestCloud
License
NestCloud is MIT licensed.
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago