Giter Site home page Giter Site logo

pankod / moleculerjs-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
194.0 10.0 38.0 4.36 MB

A well-structured Moleculer JS Boilerplate with Typescript, CLI, Service Helpers, Swagger, Jest support and everything you'll ever need to deploy rock solid projects. https://pankod.github.io/moleculerjs-boilerplate/

License: MIT License

JavaScript 10.59% Dockerfile 0.48% TypeScript 81.96% HTML 6.72% Shell 0.26%
moleculer typescript nodejs jest supertest typeorm docker

moleculerjs-boilerplate's Introduction

Moleculer JS Microservice Boilerplate with Typescript, TypeORM, CLI, Service Clients, Swagger, Jest, Docker, Eslint support and everything you will ever need to deploy rock solid projects.


Moleculer JS Microservice Boilerplate with Typescript, TypeORM, CLI, Service Helpers, Swagger, Jest, Docker, Eslint support and everything you will ever need to deploy rock solid projects..


Created by Pankod

About

A microservice is a single self-contained unit which, together with many others, makes up a large application. By splitting your app into small units every part of it is independently deployable and scalable, can be written by different teams and in different programming languages and can be tested individually.

Moleculer is a fast, modern and powerful microservices framework for Node.js. It helps you to build efficient, reliable & scalable services.

This boilerplate make it easier to get started with a well-structured Node.js microservices with Typescript.


Features

This boilerplate includes the latest powerfull tools.

  • Moleculer - Moleculer is a fast, modern and powerful microservices framework for Node.js.
  • Typescript - Superset of JavaScript which primarily provides optional static typing, classes and interfaces. path support(allias)
  • Built-in Project CLI- Create services, entities, interfaces, and tests with one command by using built-in cli.
  • Docker - A tool designed to make it easier to create, deploy, and run applications by using containers.
  • Eslint - The pluggable linting utility.
  • Swagger - A framework backed by a large ecosystem of tools that helps developers design, build, document, and consume RESTful Web services.
  • Jest - Javascript testing framework , created by developers who created react
  • TypeORM - TypeORM is specifically an ORM that converts data between JavaScript / TypeScript to a variety of databases.
  • Service Helpers - Provides easy communication contract between services.

Setup & Documentation

Please refer to our setup guide to create a new app.

For more detailed documentation, check out https://pankod.github.io/moleculerjs-boilerplate/


Built-in CLI



moleculerjs-boilerplate is shipped with a CLI tool to streamline the creation of new microservices. By using the CLI tool, you may easily add entities, services to your project and have all the required interfaces and imports are automatically created for you.

To start the CLI, you may run the following npm command:

npm run cli

After answering questions it generates files in miliseconds.


License

Licensed under the MIT License, Copyright © 2019-present Pankod

moleculerjs-boilerplate's People

Contributors

batuhanw avatar dependabot[bot] avatar mikeporterdev avatar omeraplak avatar tmrdurgun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moleculerjs-boilerplate's Issues

Get and Post specific actions

Hi,

Sorry I have a newbie question that I thought it's best to ask here. I'm not sure if there is a Gitter or a channel where there are molecular fans?

Question 1) when using molecular typescript or this boilerplate code, how would you restrict an action to only GET or post ?

Question 2) or even how would you have same endpoint with different verbs?
GET /Defend
POST /Defend
UPDATE /Defend
DELETE /Defend

is this configured in the routes in the NAT or transporter? can we do it in the service itself ? (I can't see any option in the action decorator)
image

public async Defend(ctx: Context<IPlanet.DefendInDto>): Promise<IPlanet.DefendOutDto> {

error when run npm run dev

hi all,
Following this https://pankod.github.io/moleculerjs-boilerplate/docs/setup
After run command npm run dev i got this error. What wrong with me?

[Runner] ⨯ Unable to compile TypeScript:
moleculer.config.ts(33,2): error TS2322: Type '{ namespace: string; nodeID: undefined; logger: true; logLevel: "info"; logFormatter: string; logObjectPrinter: undefined; transporter: { type: string; options: { udpDiscovery: boolean; }; }; serializer: string; ... 19 more ...; replCommands: undefined; }' is not assignable to type 'BrokerOptions'.
  Object literal may only specify known properties, and 'logFormatter' does not exist in type 'BrokerOptions'.

Integrate Sequelize and postgresql

I want to integrate sequelize ORM in my project in place of TypeORM and also postgresql. Can I get support for it or if possible can I get any boilerplate for it.

Error: The project undefined isn't supported

I updated to [email protected], [email protected], and [email protected] as there are lodash vulnerabilities.

    Dependency: NPM - [email protected]
      RejectReasons (4)
          Type:          VULNERABILITY
          Name:          Prototype Pollution
          Severity:      high
          Description:   Versions of `lodash` before 4.17.5 are vulnerable to prototype pollution.

The vulnerable functions are 'defaultsDeep', 'merge', and 'mergeWith' which allow a malicious user to modify the prototype of `Object` via `{constructor: {prototype: {...}}}` causing the addition or modification of an existing property that will exist on all objects.

          Type:          VULNERABILITY
          Name:          Prototype Pollution
          Severity:      high
          Description:   Versions of `lodash` before 4.17.12 are vulnerable to Prototype Pollution.  The function `defaultsDeep` allows a malicious user to modify the prototype of `Object` via `{constructor: {prototype: {...}}}` causing the addition or modification of an existing property that will exist on all objects.

          Type:               VULNERABILITY
          Name:               SNYK-JS-LODASH-450202
          CVSS Score v3:      7.3
          Severity:           high
          Description Link:   https://snyk.io/vuln/SNYK-JS-LODASH-450202

          Type:               VULNERABILITY
          Name:               SNYK-JS-LODASH-73638
          CVSS Score v3:      7.3
          Severity:           high
          Description Link:   https://snyk.io/vuln/SNYK-JS-LODASH-73638

... and I am now getting the error message:

$ npm run cli

> [email protected] cli I:\dev\iahub-universe
> pankod-cli add

                  _       __ _                _
  _   _ _ __   __| | ___ / _(_)_ __   ___  __| |
 | | | | '_ \ / _` |/ _ \ |_| | '_ \ / _ \/ _` |
 | |_| | | | | (_| |  __/  _| | | | |  __/ (_| |
  \__,_|_| |_|\__,_|\___|_| |_|_| |_|\___|\__,_|

 »   Error: The project undefined isn't supported.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] cli: `pankod-cli add`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] cli script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\manch1uwook\AppData\Roaming\npm-cache\_logs\2020-06-19T13_37_38_826Z-debug.log

Postgres error incomplete startup packet

I am using the pankod boilerplate project with PostgreSQL. I am getting the following error when i run the application.

2019-10-14 09:17:24.580 UTC [21367] [unknown]@[unknown] LOG: incomplete startup packet
2019-10-14 09:17:39.581 UTC [21356] LOG: received fast shutdown request
2019-10-14 09:17:39.581 UTC [21356] LOG: aborting any active transactions
2019-10-14 09:17:39.582 UTC [21361] LOG: autovacuum launcher shutting down
2019-10-14 09:17:39.585 UTC [21358] LOG: shutting down
2019-10-14 09:17:39.691 UTC [21358] LOG: database system is shut down
2019-10-14 09:17:40.707 UTC [21458] LOG: database system was shut down at 2019-10-14 09:17:39 UTC
2019-10-14 09:17:40.709 UTC [21458] LOG: MultiXact member wraparound protections are now enabled
2019-10-14 09:17:40.712 UTC [21457] LOG: database system is ready to accept connections
2019-10-14 09:17:40.713 UTC [21462] LOG: autovacuum launcher started
2019-10-14 09:17:41.159 UTC [21468] [unknown]@[unknown] LOG: incomplete startup packet

I don't see when i stop the application. Is there any configuration/settings to be set to avoid this error. The main issue is when I call the api during the time this issue created then API gets fails and works normal on the next call..

Out-of-date libraries / old templates

From the first install, there are over 1700 vulnerabilities and out-of-date libraries. After doing npm audit fix --force it takes care of them, but there there is an issue of module.exports vs. export { Whatever } in the templates. I like the work that you've done, but I don't feel it is usable anymore.

Any intention to upgrade this boilerplate to support the moleculer v0.14?

Really great project, drew a lot of inspiration from it that I am pulling into an existing moleculer project.

I did notice however that the current project is not compatible with moleculer v0.14.

Notably the class declarations for services.

Is there any intention to keep this boilerplate up to date?

typeorm relationships failed

First of all great project. i love the idea.
however relationships with typeorm failing =(

	@OneToMany(type => Step, step => step.checklist)
	steps?: Step[];
	@ManyToOne(type => Checklist, checklist => checklist.steps)
	checklist?: Checklist;
Connection error! Error: Entity metadata for Checklist#steps was not found.

Is it me or typeorm really brittle and fragile ?

Debugger?

Hi,

How to add debugger / inspector for this boilerplate?

Thank in advance.

docker-compose configuration uses sqlite

The current docker-compose configuration does not work as it is trying to connect to sqlite.

A working solution would require:

  • db image / volume to docker-compose
  • updating the connection logic based on NODE_ENV
  • defining migration / setup logic for the containerized db

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.