New Project

Tips for initializing new blank projects

Typescript Environment

Basic environment for executing Typescript scripts.

Commands & Configs

Initialize Node Project

npm init --init-author-name "your-email" -y

Installing TS on Node

Node by default don't recognize Typescript only Javascript.

npm install --save-dev @types/node
npm install --save-dev typescript

Generate the tsconfig.json file:

npx tsc --init \
--outDir build \
--module commonjs \
--allowJs true \
--removeComments true

or for a more strict configuration:

You can add these to configure the folders to include and exclude in transpilation:

Configure Custom Running Commands

To be executed with npm.

The building output directory may be configured in the tsconfig.json file.

Optional: Install nodemon (For Cold Reloading)

To auto reload the project when files change.

Optional: Install dotenv (For Env variables)

Optional: Install tsconfig-path (???)

.gitignore

Running

To run + openning the browser:

Just running the server:

Express Environment

Basic environment for executing an Express (RestAPI) project.

Commands & Configs

Initialize the Project

Follow Commands & Configs from Typescript Env.

Install Main Dependencies

Optional: Mkdirp

To run mkdir -p for create folders if don't exist.

Optional: JWT Tokens (For JWT Token generation)

Optional: Async (Async/Parallel execution)

Optional: Mysql (Mysql connector)

Optional: Axios

Optional: Express-Validator

For Body, Query and Param data validation/sanitization.

Last updated