/nestjs-skeleton

skeleton for Nest.js + TypeScript + TypeORM

Primary LanguageTypeScript

nestjs-skeleton

FOSSA Status

Usage

period command description
development pnpm start:dev start server with auto reloading
development pnpm start start server without auto reloading
development pnpm start:debug start server with auto reloading and debugging
development pnpm format format source codes
development pnpm lint run eslint
development pnpm test run tests
development pnpm test:watch run tests with auto reloading
deploy pnpm compile compile executable source of plain node
deploy pnpm clean-compile cleanup, then compile executable source of plain node
deploy pnpm clean cleanup compiled dists
production pnpm start:prod start server

Note the following points:

  • The source codes are automatically formatted and linted before commit using husky.
  • By default, development requires pnpm.
  • pnpm start:prod will not automatically compile the sources.
  • Controllers in /src/controller and services in /src/service will be automatically loaded. As a consequence, those files cannot contain non-relevant function exports.

Development pipeline

Service

  • create/find relevant services in /src/service
  • add service to /src/app.module.ts

Controller

  • create/modify relevant controller in /src/controller
  • add controller to src/app.module.ts

Error

  • create exception in /src/common/errors.ts

Entity

  • create entity in /src/entity
  • generate migration with pnpm db migration:generate --name <migration_name>

Config

  • change IEnvironment in /src/common/config.ts
  • define schema according to compile errors

Default features

To-Dos

  • unit & integration tests
  • Docker support
  • controller & service generation

License

FOSSA Status