Nest framework TypeScript starter (node.js)
Switch branches/tags
Clone or download
Pull request Compare This branch is 188 commits ahead, 77 commits behind nestjs:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Nest Logo The Nest framework starter repository.

STACK

  • TypeScript
  • ESLint
  • Mocha
  • TypeORM
  • Stryker

INSTALLATION

$ npm install

TASKS

Command Description
npm start Build and start application
npm run dev Start application in development mode with HMR (webpack)
npm run dev:nd Start application in debug mode (node-dev)
npm run dev:wd Start application in debug mode (webpack)
npm test Run all tests
npm run test:r Run unit tests
npm run test:w Run unit tests in watch mode
npm run tscheck:w Run TypeScript checks in watch mode
npm run tsclint:w Run TypeScript more stricter checks in watch mode
npm run eslint:w Run ESLint in watch mode
npm run eslint:fix Run ESLint in fix mode
npm run lint:w Run all linting commands in watch mode
npm run test:m Run mutation tests

FOLDER STRUCTURE

Folder/file Description
src/config.ts Configuration file
src/server.ts Main file, starts server
src/app Application files: controllers, services, entities, etc. grouped by feature
src/components Shared components: helpers, decorators, pipes, transformers, interceptors, middlewares, etc.
src/scripts Scripts which runs from cli to support database, cronjob, etc.
src/migrations TypeORM migrations

SCRIPTS

Database seed example:

npx ts-node src/scripts seed

SETUP ENVIRONMENT (EXAMPLE)

set TYPEORM_CONNECTION=mongodb
set TYPEORM_DATABASE=nest-typescript-starter
set TYPEORM_CONNECTION=sqlite
set TYPEORM_DATABASE=test

DEVELOPMENT

  • npm run dev:wd -- --env.devtool=inline-cheap-source-map Debug with webpack and HMR (show srouces as transformed code)
  • node -r ts-node/register/transpile-only --inspect src/database/scripts.ts migrate

WEBPACK DEVTOOL SETTING (HMR)

Value Valid stacktrace Source updates Breakpoints Rebuild Quality
cheap-eval-source-map No Yes No ++ transformed code
cheap-module-source-map Yes Yes Yes - original source
inline-cheap-module-source-map Yes Yes Yes - original source
inline-cheap-source-map No Yes Yes o transformed code
cheap-source-map No Yes Yes o transformed code
inline-source-map Yes Yes Yes -- original source
eval-source-map ? ? ? + original source
source-map Yes Yes Yes -- original source

RESOURCES