DEV Community

Cover image for A Modern Node.js + TypeScript Setup for 2025 🚀
Sibelius Seraphini for Woovi

Posted on

A Modern Node.js + TypeScript Setup for 2025 🚀

With the latest features and tools in Node.js, setting up a modern TypeScript project has never been easier—or more exciting. This guide will show you how to leverage the newest Node.js capabilities to create a lightweight and efficient development workflow.

Why Choose This Setup?

This setup emphasizes simplicity, native features, and minimal dependencies by leveraging:

  • Native ESM (ECMAScript Modules) for cleaner, modern syntax.
  • Experimental TypeScript Stripping (--experimental-strip-types) for running TypeScript files natively.
  • Built-in File Watching without third-party tools like nodemon
  • Native Environment Variable Support with .env files

Explore the repo for this setup: esm-pure-experimental-strip-types.

Node.js ESM

ECMAScript Modules (ESM) bring modern syntax with import and export.

Benefits of ESM:

  • Performance: Static analysis of imports/exports improves optimization compared to CommonJS (CJS).
  • Simplified Module Resolution: Requires explicit file extensions, speeding up module resolution. For example, instead of:
const module = require('./module');
Enter fullscreen mode Exit fullscreen mode

You now write:

import module from './module.js';
Enter fullscreen mode Exit fullscreen mode

Experimental TypeScript stripping (--experimental-strip-types)

The --experimental-strip-types flag lets you run .ts files directly in Node.js, eliminating the need for transpilers like Babel or SWC. Here's how to use it:

node --experimental-strip-types index.ts
Enter fullscreen mode Exit fullscreen mode

Requirements:

  • Use ESM syntax.
  • Include explicit file extensions (e.g., .ts) in imports.

Here’s a sample tsconfig.json to get you started:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "Node",
    "strict": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true,
    "isolatedModules": true,
    "resolveJsonModule": true,
    "outDir": "./dist",
    "rootDir": "./src",
    "noEmit": true,
    "types": ["node"],
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "incremental": true
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules", "dist"]
}
Enter fullscreen mode Exit fullscreen mode

Key Configurations:

  • allowImportingTsExtensions: Ensures .ts extensions are required in imports.
  • verbatimModuleSyntax: This avoids altering your import/export syntax. By using --experimental-strip-types, you can bypass tools like Babel, SWC, Webpack, or TSX, streamlining your toolchain significantly.

Built-in File Watching (--watch)

Forget nodemon! Node.js now supports file watching natively. Use the --watch flag for live reloads:

node --watch index.ts
Enter fullscreen mode Exit fullscreen mode

Benefits:

  • Faster and more efficient than nodemon.
  • Native support means fewer dependencies.

Native Environment Variable Support (--env-file)

You no longer need packages like dotenv or dotenv-safe to handle .env files. Simply use the --env-file flag:

node --env-file=.env index.ts
Enter fullscreen mode Exit fullscreen mode

Advantages:

  • Seamless integration with .env files.
  • Fully native functionality, reducing dependency bloat.

Closing Thoughts

This modern Node.js + TypeScript setup eliminates unnecessary complexity by leveraging the latest features. With native ESM, experimental TypeScript stripping, built-in file watching, and .env support, you can:

  • Reduce dependencies.
  • Improve performance.
  • Simplify your workflow.

By embracing these tools, you’ll boost productivity and focus on building, not configuring.

What are your favorite Node.js + TypeScript features? Let me know in the comments!


Woovi is a fintech platform revolutionizing how businesses and developers handle payments in Brazil. Built with a developer-first mindset, Woovi simplifies integration with instant payment methods like Pix, enabling companies to receive payments seamlessly and automate financial workflows.

If you want to work with us, we are hiring!

Top comments (12)

Collapse
 
aynuayex profile image
Ayne Abreham Alemayehu

Can you create a blog on express/typescript project deployment on vercel or render I have faced issues on that even after following their docs and YouTube tutorials?
Thank you again 💓

Collapse
 
abustamam profile image
Rasheed Bustamam

I can write one for you :)

Collapse
 
eezing profile image
Eric Zingeler

Figure it out yourself. Doing is the best way to learn.

Collapse
 
sujit510 profile image
Sujit Singh • Edited

Nice article Aasim Sibelius!

Just a small suggestion - may be you can also add appropriate node version/s which support these features and flags.

Collapse
 
bhataasim profile image
Bhat Aasim

This Article is not mine, you can check my articles here: @bhataasim

Collapse
 
gvsakhil profile image
G.V.S Akhil

I prefer using nestjs instead of doing all these myself. By the way nice article, Thanks 🙏

Collapse
 
eezing profile image
Eric Zingeler

This is a very basic setup that literally takes 5 minutes. It’s good for everyone to understand how to spin up a vanilla Node + TypeScript app.

Collapse
 
bhataasim profile image
Bhat Aasim

Hey, I'm looking for a role.
Here is my portfolio bhataasim-portfolio.vercel.app/

Collapse
 
varundeva profile image
Varun Deva

It's clean and structured
Is this repo available to fork and rebuild on top of it?

Collapse
 
bhataasim profile image
Bhat Aasim

Yes, checkout magic ui templates

Collapse
 
niklasschaeffer profile image
Niklas Schäffer

This setup alone probably does not get the job done at all. You don't have a buildin module Bundler in Node nore do you have an Html,Sass compiler. This is very basic but if you want you could do some basic coding.

Collapse
 
michael_nannola_e6bd1f8cf profile image
Michael Nannola

One thing, starting with Node v.23 you don't need the strip types flag. It's on by default.
nodejs.org/en/learn/typescript/run...