Node Typescript Starter Template
This story has a new update with latest updated tools. Here: https://shuvrojit.medium.com/node-typescript-production-grade-setup-template-641164bd70ed
Today we’re going to create a node typescript setup or starter project. let’s make a directory with mkdir
. You can name it whatever you want. We’re going to initialize git into this directory. Git is version control software which manages the working state of our application. Here’s the link to the github repo.
git init
We need to initialize a npm project directory. We can do that with npm init -y
. -y
means yes to all the questions that npm init is going to ask you. It’s going to ask you a bunch of questions related to the project.
npm init -y
We can see the package.json result in the terminal.
We’re going to add all development packages that are needed one by one and learn along the way which packages does exactly what.
Typescript
Let’s setup typescript right away. Whenever we are working with typescript, always make sure to check that if the needed package has built-in types definition. If it does not then head to Definitely Typed and look for the type definitions for that package.
npm install --save-dev typescript @types/node
or you can do shortcut like this
npm i -D typescript @types/node