Urgent.News

What's breaking now, across thousands of outlets.

Tech

๐Ÿš€ A Tiny Developer Tool I Built for My Node.js Workflow

While working on Node.js + Express projects, I noticed I was repeatedly generating JWT secrets for my .env files. Usually, I would either: โ†’ Search for an online secret generator โ†’ Run a long Node.js command manually โ†’ Copy the generated value โ†’ Paste it into .env It's not difficult, but when you're doing it repeatedly, why not automate it? So I created my own tiny Windows command called jwt .โ€ฆ

While crafting Node.js and Express applications, I observed a repetitive occurrence of generating JWT secrets for my .env files. Typically, I would either: seek an online secret generator, execute a lengthy Node.js command manually, or copy and paste the generated value into my .env file. Although straightforward, this task seemed redundant when performed frequently.

Thus, I devised my own compact Windows command named jwt. Now, I merely need to type jwt to obtain a secure random secret instantly. An added feature allows jwt 64 to generate a 64-byte random secret instead of the default 32-byte secret.

To develop this tool, I utilized Node.js's built-in crypto module, eliminating the need for supplementary npm packages. Initially, I generated a directory: C:\Users\YOUR_USERNAME\bin, where I subsequently created a file titled jwt.cmd. The contents of this file included:

@echo off

if %~1 == (

set bytes=32

) else (

set bytes=%~1

)

node -e "console.log(require(crypto).randomBytes(%bytes%).toString('hex'))"

In this process, %~1 symbolizes the initial argument supplied to the command. Consequently, jwt indicates no argument was provided, thus: bytes = 32. Conversely, jwt 64 sets: bytes = 64. Subsequently, Node.js executes crypto.randomBytes(bytes), generating cryptographically secure random bytes. Finally, .toString('hex') transforms these bytes into a hexadecimal string. For instance, jwt 32 results in 64 hexadecimal characters, while jwt 64 yields 128 hexadecimal characters.

Lastly, I ensured the bin folder was accessible system-wide by adding it to the Windows User PATH. I navigated to Windows Search, Environment Variables, edited the system environment variables, selected User variables โ†’ Path โ†’ Edit โ†’ New, and appended: C:\Users\YOUR_USERNAME\bin. After restarting my terminal, Windows could locate the jwt.cmd from any directory. Now, I can utilize CMD, PowerShell, or the VS Code terminal to simply execute: jwt or: jwt 64.

Although this may appear as a minor automation, it imparted valuable knowledge regarding Windows PATH, .cmd files, command-line arguments, and Node's crypto module. Significantly, it eliminated a repetitive task from my development workflow, illustrating that enhanced productivity often stems from automating mundane steps.

Written by urgent.news from Dev.to's reporting โ€” not their text. Machine-written โ€” may contain errors; check the original before relying on it.

Read the original at dev.to โ†’

More in Tech

How to Review a Wrong E-Challan in Punjab

Lahore Traffic Police has shared an online procedure for motorists who believe they have received a wrong e-challan and want โ€ฆ Read More The post How to Review a Wrong E-Challan in Punjab appearedโ€ฆ

A fault model is not a flag

I have a small consensus tool. It takes votes on stdin, keeps per-topic state in a JSON file, and supports two algorithms: a Byzantine-fault-tolerant mode with a 2/3 weighted quorum, and a Multi-Paxosโ€ฆ

  • Fault model in consensus tool not a flag, leading to inconsistencies
  • BFT and Multi-Paxos algorithms operate on same durable state without coordination
  • Fix involves recording algorithm that wrote state, preventing split-brain scenarios

Weekly Cybersecurity Roundup; Week of August 28, 2026

Two alleged TeamPCP members were arrested in Australia, closing a supply-chain saga that ran all summer. A multi-agent AI framework conducted a near-autonomous government intrusion in Taiwan โ€” theโ€ฆ

  • Two Australians, 21 and 23, arrested for supply-chain attacks
  • First publicly confirmed near-autonomous AI government intrusion in Taiwan
  • Citrix NetScaler CVE-2026-8452 exploited, web shells deployed

More from Saturday 29 August โ†’