https://github.com/jellydn/modern-nodejs-2024
Master the 2024 Node.js Development: Key Updates & Features from 18 to 22
https://github.com/jellydn/modern-nodejs-2024
nodejs
Last synced: 6 months ago
JSON representation
Master the 2024 Node.js Development: Key Updates & Features from 18 to 22
- Host: GitHub
- URL: https://github.com/jellydn/modern-nodejs-2024
- Owner: jellydn
- License: mit
- Created: 2024-05-11T14:59:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-18T00:51:16.000Z (12 months ago)
- Last Synced: 2025-03-28T10:50:30.930Z (7 months ago)
- Topics: nodejs
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Welcome to modern-nodejs-2024 👋
> Modern Node.js 2024 demo is a comprehensive guide to the latest features and capabilities of Node.js 18 to Nodejs 22. This demo includes built-in support for fetch, native `.env` file reading, and simplified testing with `node:test`. It also introduces the permission model, task runner with `node --run`, and importing ESM modules from CJS.

[](https://www.youtube.com/watch?v=HeuLPpc3x04)
## Table of Contents
- [Pre-requisites](#pre-requisites)
- [Usage](#usage)
- [Features](#features)
- [Node Fetch Without Polyfill](#node-fetch-without-polyfill)
- [Read .env File Natively](#read-env-file-natively)
- [Testing with `node:test`](#testing-with-nodetest)
- [Task runner with `node --run`](#task-runner-with-node-run)
- [Permission model](#permission-model)
- [Import ESM modules from CJS](#import-esm-modules-from-cjs)
- [Resources and Examples](#resources-and-examples)
- [Author](#author)
- [Show your support](#show-your-support)
- [📝 License](#📝-license)## Pre-requisites
- [Schniz/fnm: 🚀 Fast and simple Node.js version manager, built in Rust](https://github.com/Schniz/fnm) or any similar Node.js version manager.
- [pnpm: Fast, disk space efficient package manager](https://pnpm.io/)## Usage
```bash
pnpm install
```## Features
### Node Fetch Built-in
> [!NOTE]
> NodeJs 18```sh
cd examples/fetch
node index.js
```[](https://gyazo.com/4aedf45ff0747307dd231c4940711cbd)
### Read .env File Natively
> [!NOTE]
> NodeJs 20Seamless `.env` file support right out of the box.
```sh
cd examples/dotenv
node --env-file=.env.local index.js
```[](https://gyazo.com/69fc0f7279ba4946b51f4e686be0a0ff)
### Testing with `node:test`
> [!NOTE]
> NodeJs 20Perform simplified testing with the native `node:test` library.
```sh
cd examples/test-runner
node --test
```[](https://gyazo.com/ba01f3bbcce55a1da1118eedabac5dec)
### Task runner with `node --run`
> [!NOTE]
> NodeJs 22```sh
cd examples/task-runner
node --run start
```[](https://gyazo.com/9f95d9e7399bab3bb9422c051f89defc)
### Permission model
> [!NOTE]
> NodeJs 22 - Experimental Feature```sh
cd examples/permission-model
node --experimental-permission index.js
```[](https://gyazo.com/908b473c571103b7aecba6725c0025cb)
### Import ESM modules from CJS
> [!NOTE]
> NodeJs 22 - Experimental Feature```sh
cd examples/import-esm
node --experimental-require-module index.cjs
```[](https://gyazo.com/52a555700892cd7c246debb7d6d1324c)
## Resources and Examples
Please check the [`examples`](./examples/) folder for more detail and references resources.
Other resources:
- [What's new in Node js v22](https://youtu.be/eZfLkVDJPTg)
- [NodeJs can do WHAT now?](https://youtube.com/shorts/J3W3s5O9wAs)
- [Node.js Test Runner: A Beginner's Guide](https://betterstack.com/community/guides/testing/nodejs-test-runner/)
- [10 modern Node.js runtime features to start using in 2024](https://snyk.io/blog/10-modern-node-js-runtime-features/)
- [Node.js is Here to Stay](https://blog.platformatic.dev/nodejs-is-here-to-stay)## Pre-commit
This project uses [pre-commit](https://pre-commit.com/) to enforce code quality. Please install it before committing.
```bash
pre-commit install
```## Author
👤 **Dung Huynh Duc **
- Github: [@jellydn](https://github.com/jellydn)
## Show your support
Give a ⭐️ if this project helped you!
[](https://ko-fi.com/dunghd)
[](https://paypal.me/dunghd)
[](https://www.buymeacoffee.com/dunghd)## 📝 License
Copyright © 2024 [Dung Huynh Duc ](https://github.com/jellydn).
This project is [MIT](https://github.com/jellydn/modern-nodejs-2024/blob/master/LICENSE) licensed.