Skip to content

A comprehensive project template to jump start a Node.js back-end development in TypeScript. ESLint, Jest, Mongoose, Prettier, Winston logger, morgan, code examples and type definitions, are included.

License

Notifications You must be signed in to change notification settings

atheodosiou/TypeScript-Node-Express-Starter

Repository files navigation

TypeScript Node Express Starter

thumb

TypeScript version Node.js version MTI Build Status - GitHub Actions

👩🏻‍💻 Developer Ready: A comprehensive template. Works out of the box for most Node.js projects.

All basic 🛠 included and configured:

  • TypeScript 4.5
  • Express, fast,unopinionated, minimalist web framework for Nodejs
  • Mongoose 6.1.1 to work with MongoDB
  • Swagger documentation also available via swagger-ui-express pakage
  • ESLint with some initial rules recommendation
  • Jest for fast unit testing and code coverage
  • Logging functionality with Winston Logger and Morgan Logger from network requests
  • Type definitions for Node.js, Express and Jest
  • Prettier to enforce consistent code style
  • NPM scripts for common operations
  • Simple example of TypeScript code and unit test
  • Also includes .prettierrc for consistent file format
  • Improve your commits and more thanks to Husky
  • Pre-added hook for pre-commit that runs prettier, lint and your test before commit
  • Contains also a light wrapper over Axios as a sigleton class called HttpClient
  • Example configuration for GitHub Actions
  • Example configuration for [Travis CI][travis-ci]
  • Example code for mongodb connection
  • Example code for Express routes, controllers and middlewares
  • Example of api versioning

🆓 Free for all and forever: available under the MIT license.

Getting Started

This project is intended to be used with the latest Active LTS release of Node.js.

Use as a repository template

To start, just click the Use template link (or the green button). Start adding your code in the src and unit tests in the test directories.

Available Scripts

  • clear - remove coverage data and transpiled files,
  • prebuild - lint source files and tests before building,
  • build - transpile TypeScript to ES6,
  • dev - interactive watch mode to automatically transpile source files,
  • start- starting server from transpiled files (no watch mode),
  • lint - lint source files and tests by indicating errors and warnings,
  • lint-fix - lin source file and test by fixing erros and warnings where possible,
  • test - run tests,
  • format-check - run format check for source files and tests,
  • format - formating source files and tests
  • test:watch - interactive watch mode to automatically re-run tests
  • prepare - husky install

Additional Informations

Documetation provided by swagger-ui-express, can be accessed under /api-docs

Writing tests in JavaScript optional

Writing unit tests in TypeScript can sometimes be troublesome and confusing. Especially when mocking dependencies and using spies.

License

Licensed under the MIT. See the LICENSE file for details.

About

A comprehensive project template to jump start a Node.js back-end development in TypeScript. ESLint, Jest, Mongoose, Prettier, Winston logger, morgan, code examples and type definitions, are included.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published