Home

Awesome

Node.js Typescript Modern Starter

While developing with Typescript and Node.js is awesome, setting up a new project is painful. This minimal and modern starter repo is here to help you get started with Node.js and Typecript without the pain.

Overview

This starter uses a bare-bones and minimal approach to get anyone up and running with a new project in no time. It provides:

Project Goals

Prerequisites

Quickstart

Scripts and their explanation

All scripts can be found inside the package.json file under the "scripts" attribute.

Debugging

An enourmous amount of people default to console log debugging since understanding the setup for debugging typescript can be somewhat awful and painful. This repo provides a debug config and guide ready to use for vscode and for vim using vimspector. Both use the mostly DAP compliant debugger vscode-js-debug.

Debugging Code

There are somewhat "different" ways of starting the debugger. Once is by starting the app and waiting for a debugger to connect and the other one is starting the app initiated by the debugger. I made the experience that the former works on any given code base, no matter the amount of transipilation or bundling steps and custom steups while the latter does fail in extremely customized scenarios. Therefore here only the first one is covered with examples.

Vim or Vscode

Debugging Tests

Vim or Vscode

Linting

This repo has eslint and typescript-eslint as well as an automated Github Action to check for linting set up and ready to go.

The rules in this project are my personal preference and reflect a subset of the recommended options. They also include a lot of the more strict options (NOT included in the recommended ones). My goal is to simplify having a consistent code base/code style, to avoid catchable bugs early and advocate for usage of newer features of the language.

However, I made it dead simple to enable the default/recommended eslint rules, if you want to use them instead. Everything is documented, just browse to ./.eslintrc.cjs and adapt the code.

Automated Dependency Updates

After using this repo (either via the github template or by simply cloning it) you have to set up a renovate bot. For github this can easily be done via the Github Apps renovate as well as renovate-approve. To be able to the mimic the approach used in this repo, you should set up: