How I Started Using ES6 Modules in Node.js (2026 Update)

ES modules (ESM) are now a first-class way to write Node.js code. Node supports both CommonJS and ESM, and you can opt into ESM using file extensions or package.json settings. This update gives you two clear paths: JavaScript or TypeScript. Option A: JavaScript (ESM) 1. Create a project mkdir node-esm cd node-esm npm init -y 2. Tell Node to treat .js as ESM Add this to package.json: { "type": "module" } Node will treat .js files as ESM in this package scope. If you prefer, you can also use .mjs for ESM files and .cjs for CommonJS. When there are no explicit markers, Node inspects the source to decide whether a file is ESM or CommonJS. Use explicit markers for clarity. ...

February 5, 2026 · 2 min · Chris Achinga

Building a Weather and Time Telegram Bot using Node.js

Telegram bots are automated applications that run inside Telegram. Users can interact with bots by sending messages, commands, and inline requests. Today, we’ll walk you through how to build a simple Telegram bot using Node.js that provides weather and time information for any city. Prerequisites Before we start, make sure you have the following: Node.js and npm are installed on your machine. A Telegram account to create and manage bots. An API key from OpenWeatherMap. Setting Up Your Project Firstly, install the required Node.js packages: dotenv, node-telegram-bot-api, axios, and moment-timezone. ...

May 15, 2023 · 4 min · Chris Achinga

Building a GraphQL API with NodeJS: A Step-by-Step Guide

GraphQL is a powerful query language for APIs that allows developers to request and receive the data they need efficiently. In this step-by-step guide, we will walk you through the process of building a GraphQL API using Node.js, using airport data as a sample for the demo. Whether you’re a beginner or an experienced developer, this tutorial will provide you with the necessary knowledge to easily create your GraphQL API. ...

March 6, 2023 · 3 min · Chris Achinga