Skip to content

A Node.JS Typescript starter template using Inversify for DI and Jest for testing.

License

Notifications You must be signed in to change notification settings

bryopsida/node-ts-starter

Repository files navigation

Node-TS-Starter

Quality Gate Status Coverage Security Rating Vulnerabilities Code Smells Bugs

This template provides a few things to kick start a TypeScript Node.JS project, an IoC library (Inversify.JS), linting (ESLint and Prettier), automatic dependency updates (Renovate), logger (Pino), Dockerfile, Document generation (Typedoc). This template purposely avoids taking opinions on frameworks that would constrain the type of services/projects created.

NPM Scripts

The following scripts are included in the NPM project configuration

  • lintlints the source code using eslint
  • lint:fix automatically fixes any lint errors that can be fixed automatically
  • test uses jest to run test suites
  • build compiles the typescript into js and places it in the dist folder
  • build:docs generates the documentation pages from the code comments
  • build:image build the container image from the Dockerfile
  • start runs the compiled js in dist
  • start:dev runs using nodemon and will automatically rebuild and launch whenever a change is made under the source folder

Structure

This is meant to include service abstractions, ideally each service should provide an interface/contract exposing the functionality that other things in the application need.

This houses interfaces/models with little to no logic, the intent is these items can be passed/returned from the abstractions in services and avoid tight coupling to third party types.

This defines symbols for each type that will be configured in the IoC container, these are used to identify the type when using @inject(TYPES.Services.Echo) for example. For more information refer to inversify.

This file maps the types defined in ./src/types.ts to interface types. For more information refer to inversify.

After Using as Template Todo List

  1. Update Sonar Project Properties For Sonar Cloud
  2. Add SONARQUBE_KEY secret to your repo or org if not already present
  3. Point badges in README.md to correct location for you repo
  4. Update renovate.json to meet desired behavior for your needs, docs can be found here.
  5. Update this readme to reflect your project name and info

About

A Node.JS Typescript starter template using Inversify for DI and Jest for testing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages