The loopback4-microservice-catalog
is a collection of pre-built microservices that aim to reduce time to market for Enterprise projects. Large enterprises usually face a similar set of challenges when developing cloud native platforms as part of digital transformation efforts or the creation of new products. The services are implemented as LoopBack Extensions, allowing you to install them into existing LoopBack applications or use the LoopBack Command-line interface to generate standalone services. Our recommended approach is to deploy these services as standalone micro-services in Docker.
The current catalog consists of the following services:
- audit-service
- authentication-service
- in-mail-service
- notification-service
- scheduler-service
- video-conferencing-service
This repository also contains a set of example projects in the sandbox directory.
TODO: Establish LTS policy or document here that the catalog is still in development and has not reached an LTS release yet.
Version | Status | Published | EOL |
---|---|---|---|
For specifics of installing and configuring a particular service, please refer to that service's documentation. The guide here is intended to show the general method for installing and configuring the services. We are going to utilize a fictional service, @sourceloop/example-service
, as an example. All services load their environment configurations using dotenv
and dotenv-extended
.
Install the Loopback4 CLI
npm install -g @loopback/cli
Generate an application
lb4 app
? Project name: example-application
? Project description: Example Application For SourceLoop LoopBack4 Microservice Catalog
? Project root directory: example-application
? Application class name: ExampleApplicationApplication
? Select features to enable in the project Enable eslint, Enable prettier, Enable mocha, Enable loopbackBuild, Enable vs
code, Enable docker, Enable repositories, Enable services
force .yo-rc.json
create .eslintignore
create .eslintrc.js
create .mocharc.json
create .npmrc
create .prettierignore
create .prettierrc
create DEVELOPING.md
create package.json
create tsconfig.json
create .vscode\launch.json
create .vscode\settings.json
create .vscode\tasks.json
create .gitignore
create .dockerignore
create Dockerfile
create README.md
create public\index.html
create src\application.ts
create src\index.ts
create src\migrate.ts
create src\openapi-spec.ts
create src\sequence.ts
create src\controllers\index.ts
create src\controllers\ping.controller.ts
create src\controllers\README.md
create src\datasources\README.md
create src\models\README.md
create src\repositories\README.md
create src\__tests__\README.md
create src\__tests__\acceptance\home-page.acceptance.ts
create src\__tests__\acceptance\ping.controller.acceptance.ts
create src\__tests__\acceptance\test-helper.ts
npm WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN example-application@0.0.1 No license field.
added 637 packages from 816 contributors and audited 646 packages in 16.345s
87 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Application example-application was created in example-application.
Next steps:
$ cd example-application
$ npm start
Install dotenv
, dotenv-extended
and @sourceloop/example-service
.
cd example-application
npm i --save dotenv dotenv-extended @sourceloop/example-service
touch .env.example
Update src/application.ts
to use the new service and the environment variables.
import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {
RestExplorerBindings,
RestExplorerComponent,
} from '@loopback/rest-explorer';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {ServiceMixin} from '@loopback/service-proxy';
import path from 'path';
import {MySequence} from './sequence';
import { ExampleServiceComponent } from '@sourceloop/example-service';
import * as dotenv from 'dotenv';
import * as dotenvExt from 'dotenv-extended';
export {ApplicationConfig};
const port = 3000;
export class ExampleApplicationApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
) {
constructor(options: ApplicationConfig = {}) {
dotenv.config();
dotenvExt.load({
schema: '.env.example',
errorOnMissing: true,
includeProcessEnv: true,
});
options.rest = options.rest || {};
options.rest.port = +(process.env.PORT ?? port);
options.rest.host = process.env.HOST;
super(options);
// Set up the custom sequence
this.sequence(MySequence);
// Set up default home page
this.static('/', path.join(__dirname, '../public'));
// Customize @loopback/rest-explorer configuration here
this.configure(RestExplorerBindings.COMPONENT).to({
path: '/explorer',
});
this.component(RestExplorerComponent);
this.component(ExampleServiceComponent)
this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
controllers: {
// Customize ControllerBooter Conventions here
dirs: ['controllers'],
extensions: ['.controller.js'],
nested: true,
},
};
}
}
Modify the environment variable file to have the following contents:
NODE_ENV=dev
You can now run the example service with npm start
.
The loopback4-microservice-catalog
can support any Loopback 4 DataSource. While you may see existing DataSource
s and Database Migrations, it is not mandatory to use them.
Inside of the sandbox
folder, you will find example applications and Dockerfiles for each application. The loopback4-microservice-catalog
is agnostic of the Docker deployment strategy. Deploy the services into the platform of your choice.
The loopback4-microservice-catalog
utilizes many extensions created by SourceFuse.
- sourcefuse/loopback4-ratelimiter: A rate limiting extension for loopback4 applications (github.com)
- sourcefuse/loopback4-notifications: An extension for setting up various notification mechanisms in loopback4 application, vis-a-vis, Push notification, SMS notification, Email notification (github.com)
- sourcefuse/loopback4-s3: A loopback4 extension for AWS S3 integration (github.com)
- sourcefuse/loopback4-audit-log: A loopback-next extension for implementing audit logs in loopback applications for all DB transactions. (github.com)
- sourcefuse/loopback4-soft-delete: A loopback4 extension for soft delete feature (github.com)
- sourcefuse/loopback4-authentication: A loopback-next extension for authentication feature. Oauth strategies supported. (github.com)
- sourcefuse/loopback4-authorization: An authorization extension for loopback4 applications (github.com)
- sourcefuse/loopback4-helmet: A loopback4 extension for helmetjs integration (github.com)
- sourcefuse/loopback4-vault: A loopback-next extension for HashiCorp's Vault integration in loopback-next applications (github.com)
If you've noticed a bug or have a question or have a feature request, [search the issue tracker](Issues · sourcefuse/loopback4-microservice-catalog · GitHub) to see if someone else in the community has already created a ticket. If not, go ahead and make one! All feature requests are welcome. Implementation time may vary. Feel free to contribute the same, if you can. If you think this extension is useful, please star it. Appreciation really helps in keeping this project alive.
Code of conduct guidelines here.