Node.js Icon

Node.js

Node.js is a tool for executing JavaScript in a variety of environments.
220 Stories
All Topics

Natasha Lekh crawlee.dev

Crawlee is a web scraping & browser automation library for Node.js

Here’s Natasha Lekh from Apify describing the project:

This project really is a culmination of 4 years of work trying to make the best library for web scraping in production. Web scraping is a very dynamic environment and what works today might not work tomorrow, so we at Apify had to go through a lot of trial and error to figure out the most reliable and convenient ways of crawling the web and scraping data. We hope that we finally cracked it and that now many developers will enjoy working with our new library and it will make their scrapers more reliable and time to production faster.

I like how it starts with simple HTTP-based scraping, but can switch to browser-based automation when a site has JavaScript rendering. I don’t love the built-in proxy rotation features. Not because they’re bad, per se, but because they make spammers lives easier…

TypeScript github.com

A headless, code-first CMS built with TypeScript

This looks very opinionated with the tech it chooses (Node, Express, MongoDB, React, TypeScript). But if you like those choices, that probably means you’ll like what they’ve cooked up.

  • Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You’ll understand how your CMS works because you will have written it exactly how you want it.
  • Bring your own Express server and do whatever you need on top of Payload. Payload doesn’t impose anything on you or your app.
  • Completely control the Admin panel by using your own React components. Swap out fields or even entire views with ease.
  • Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL, and Local Node APIs.

Node.js spin.atomicobject.com

Why I prefer Makefiles over package.json scripts

John Ruble:

On any moderately-sized Node.js project you’ve likely already outgrown the package.json “scripts” section. But because the growth was gradual, with no single acute pain point, you might not have noticed. There’s a better way.

I’ve never been able to get into Makefiles, but many people I respect love them. For me the syntax is too arcane, but I recognize the power. If the “scripts” section of your package.json is getting unwieldy, it might be time for a make over. (yes I went there)

Rails nikodunk.com

From Node to Ruby on Rails

A post from back in June resurfaced this week in light of the big Rails 7 release.

I learned to code in the JavaScript stack and am building a JavaScript based product. I never questioned this stack: many companies default to it, JS everywhere seems good, and the community is big. But for my new side project I decided to try Rails because despite some perception that Ruby on Rails is ‘over’, people in HN comments say it was somehow more enjoyable than the newer Node based stack. Having tried it I can say wow - coming from the current Javascript ecosystem makes discovering Rails a revelation.

If you make your technology choices because of “perception that $TECHNOLOGY is ‘over’”, you are missing out on a world of potentially great options.

Node.js github.com

Node `timers/promises` for browser and server

Node recently introduced timers/promises API which provides functionality such as setTimeout and setInterval but using Promises. Developers usually achieved that functionality with various 3rd-party packages but now they have full STD support with additional features like native cancellation.

So, I thought it would be useful to have that same API available in browsers (even down to IE11) and older Node versions!

Liran Tal github.com

The largest Node.js CLI Apps best practices list ✨

A bad CLI can easily discourage users from interacting with it. Building successful CLIs requires attention to detail and empathy for the user in order to create a good user experience. It is very easy to get wrong.

In this guide I have compiled a list of best practices across areas of focus which aim to optimize for an ideal user experience when interacting with a CLI application.

Node.js github.com

google/zx – a tool for writing better scripts

Bash is great, but when it comes to writing scripts, people usually choose a more convenient programming language. JavaScript is a perfect choice, but standard Node.js library requires additional hassle before using. zx package provides useful wrappers around child_process, escapes arguments and gives sensible defaults.

I wouldn’t say JavaScript is a perfect choice for this kind of scripting, but it’s definitely a suitable one (especially if it’s the language you already know well). Here’s what scripting looks like with zx:

#!/usr/bin/env zx

await $`cat package.json | grep name`

let branch = await $`git branch --show-current`
await $`dep deploy --branch=${branch}`

await Promise.all([
  $`sleep 1; echo 1`,
  $`sleep 2; echo 2`,
  $`sleep 3; echo 3`,
])

let name = 'foo bar'
await $`mkdir /tmp/${name}`

Top-level await sure makes things nicer. (Deno supports this out of the box, btw.)

Node.js acco.io

I finally escaped Node (and you can too)

This is one of the least ranty “I’ve switched from X to Y” posts I’ve read and it’s filled with knowledge regarding the importance of data structures:

If you have solid foundation, the house will come with little effort. If the foundation is mud and sticks on top of a trash heap, your life as a builder is going to be complicated.

This principle applies to tools in a broader sense. You want to do the least work possible when swinging a sledgehammer, so you design it such that the hammer is a much heavier material than the handle. This gives you leverage. If you designed your sledgehammer in the inverse, you’d have to swing it harder every time you used it.

TypeScript tRPC.io

A TypeScript toolkit for building end-to-end typesafe data layers

tRPC doesn’t generate code for you, add functions to your run-time, or require any additions to your build pipeline. It simply allows your client code to be aware of your server-side type annotations and declarations so you can have type-safety and autocompletion inferred from its API paths, input/output data, and errors.

A TypeScript toolkit for building end-to-end typesafe data layers

Node.js jam.systems

Jam is an OSS alternative to Clubhouse and Twitter Spaces

With Jam you can create audio rooms that can be used for panel discussions, jam sessions, free flowing conversations, debates, theatre plays, musicals and more. The only limit is your imagination.

The README has an excellent feature comparison to help you decide if Jam is right for you. They also have a PRIVACY file, which is nice to see.

Node.js github.com

UsTaxes – an open source tax filing web app

UsTaxes is an open source tax filing application that can be used to file the Federal 1040 form. It is different from paid tax preparation software in that it protects user privacy and is provided for free. It is available in both web and desktop formats.

The coolest thing about this (in addition to it being free-as-in-beer) is that it stores all data in the browser only, so your personal info never leaves your computer.

WIP Alert: You shouldn’t use it file your taxes for the 2020 / 2021 tax season, but it’s a great time to get involved and help this software become production-ready for the next go-around.

Ivan Novikov github.com

A log function with superpowers

1log is a new logging library for the browser and Node. This library provides a log() function which is like console.log, but with superpowers:

  1. It can be used in expressions - f(log(x))
  2. It supports plugins

There are plugins for setting a severity level, for adding badges, and for logging functions, iterables, promises, and RxJS observables. You can even use it in your tests. Instead of writing log messages to the console, you can inspect them in unit tests with help of Jest’s snapshots feature.

Angie Rojas stackbuilders.com

Does Deno mean goodbye to Node.js?

Angie Rojas shared some insights into what Deno brings to the TypeScript ecosystem and whether or not it will “render Node.js obsolete.”

During the last 10 years, Node.js has become a big player in the backend framework market, powering several large scale applications across the globe. Meanwhile, JavaScript has also evolved greatly, not only because of the efforts of its development team, but also based on community feedback. However, integrating some of these new language features into a 10-year-old framework is not really straightforward, and has a high level of complexity.

Therefore we could say that Node.js’ architecture hasn’t evolved as fast as the language. As a basic example, Node.js is still based on callbacks, while there are far better ways to deal with asynchronicity in modern JavaScript. This is something that its creator, Ryan Dahl, has acknowledged in the past few years, and it has moved him to work on a new framework that addresses some of these issues. It is called Deno, and in the following article, we would like to explore some of its concepts to determine if it will render Node.js obsolete.

Antoni Kępiński github.com

Fast & lightweight (157 bytes) date formatting for Node and the browser

After searching for a fast and lightweight universal date formatting library, I’ve decided to create my own! I managed to include the most common features in just 157 bytes. The thing is also more than 2 times faster than Moment’s format and 3,5 times faster than date-fns lightFormat. 😃

Formatting patterns are compliant with Unicode Technical Standard #35.

While only a basic set of features is included with the format function, I added an additional localeFormat for locale-based formatting (such as month names). I’m planning on extending the package in the future to potentially include string escape mechanism and time-zone formatting.

Node.js github.com

A lightweight and powerful wiki app built on Node

I’m not sure what makes this lightweight (their word, not mine), but it does load pretty fast from where I’m accessing it. I definitely see what they mean by powerful, though, as wiki.js boasts many features: multiple editors, multiple auth schemes, search functions, comments, multiple locales, the list goes on…

The demo is worth a thousand words.

Node.js github.com

An extremely fast and lightweight test runner for Node and the browser

uvu has minimal dependencies and supports both async/await style tests and ES modules, but it’s not immediately clear to me why it benchmarks so well against the likes of Jest and Mocha.

~> "jest"  took  1,630ms  (861  ms)
~> "mocha" took    215ms  (  3  ms)
~> "tape"  took    132ms  (  ???  )
~> "uvu"   took     74ms  (  1.4ms)

The benchmark suites are pretty basic, so it’d be cool to see a “production” grade library or application port their test suite to uvu for comparison.

  0:00 / 0:00