HomeProjectsBlogsContact

Blog Details

Backend

Express Typescript Eslint Prettier Setup

Ashikul Islam Nayeem

April 10, 2025
Express Typescript Eslint Prettier Setup
TypeScriptEslintPrettierExpressNode

This guide walks you through setting up a modern backend development environment using Express with TypeScript, along with ESLint for linting and Prettier for code formatting. This combination ensures a robust development workflow with type safety, consistent code style, and helpful tooling for catching errors early. Whether you're starting a new project or standardizing your stack, this setup provides a solid foundation for building scalable, maintainable Node.js applications.

  1. Initialize Project

    npm init

    npm i express

  2. Install Typescript

    npm i -D typescript

    Add typescript config file, for that we will use the below given command.

    tsc --init

    In the tsconfig.json file, remove the comments on the rootDir option and modify it, to set src as root directory for typescript.

    "rootDir": "./src"

    Similarly, do this for outDir option as well

    "outDir": "./dist",

  3. Install Eslint

    npm i -D eslint@9.14.0 @eslint/js @types/eslint__js typescript typescript-eslint

    Now eslint.config.mjs file in the root of the project directory will be created.

    npx eslint --init

    At this point you may see that your version of eslint: "^9.14.0" has been changed to eslint: "^9.15.0"

    if that happens remove the eslint : npm remove eslint


    Then re-install: npm i -D eslint@9.14.0

  4. Install Prettier

    npm i -D --exact prettier

    Now create .prettierrc and .prettierignore file in the root of your project.

    Include basic configurations for prettier in the .prettierrc file.