←

Node Backend Setup

TypeScript, Node and Express project setup


Init pnpm project

pnpm is a fast, disk space-efficient package manager.

pnpm init

Add dependencies

Express is a Node web application framework.

Zod is a TypeScript schema validation library.

pnpm add express zod

Add dev dependencies

TypeScript extends JavaScript by adding types to the language.

TypeScript Execute (tsx) is the easiest way to run TypeScript in Node.

@types/node package contains type definitions for node.

@types/express package contains type definitions for express.

pnpm add --save-dev typescript tsx @types/node @types/express

Formatter and linter

Biome is a high-performance, Rust-based toolchain for web projects that unifies code formatting and linting.

pnpm add -D -E @biomejs/biome

TypeScript ORM

MikroORM is a TypeScript ORM for Node built on Data Mapper, Unit of Work, and Identity Map patterns.

node-postgres (pg) is a non-blocking PostgreSQL client for Node.js, serving as a collection of modules that allow Node.js applications to interface with PostgreSQL databases.

pnpm add pg @mikro-orm/core @mikro-orm/migrations @mikro-orm/postgresql
pnpm add --save-dev @mikro-orm/cli

@types/pg package contains type definitions for pg.

pnpm add --save-dev @types/pg