#349 — July 30, 2020

Read on the Web

🎉 At the end of this week's issue we have an interview with Valeri Karpov, a.k.a. The Code Barbarian. We've linked to his content quite a lot over the years and he's answered some questions about MongoDB and Mongoose for us, so don't miss that 😁

Node Weekly

Ink 3 Released: Yep, You Can Build CLI Apps with React Too — If you love CLIs and you love React, you’ll love Ink – it lets you get the same component-based UI approach but at the command line. If you’re already familiar with Ink, v3.0 takes some nice steps forward. If you're totally new to it, ▶️ Harry Wolff's helpful video intro may come in handy.

Vadim Demedes

Node v14.7.0 (Current) Released — Another week, another release. Nothing huge here, npm upgraded to 6.14.7, plus a handful of tweaks to core libraries.

Myles Borins

Scout APM Now Available for Node.js — Scout’s intuitive UI helps you quickly track down issues so you can get back to building your product. Rest easy knowing that Scout is tracking your apps performance and hunting down small issues before they become large issues. Get started for free.

Scout APM sponsor

Building a Discord Bot with Node — How to create a bot from scratch for the popular chat system. You’ll use the Discord.js library, which allows users to directly interact with the Discord API.

Tom X

⚡️ Quick bytes:

  • Google Cloud Functions (Google's serverless platform) finally supports Node 12 – something many people have been waiting for.
  • Cloudflare's Workers platform is a V8-based 'serverless at the edge' system and is now being extended in an 'Unbound' variant for functions with extended execution times.

💻 Jobs

Backend Engineering Position in Beautiful Norway — Passion for building fast and globally scalable APIs with GraphQL using Node.js? 😎 Join our engineering team - remote friendly.

Crystallize

One Application, Hundreds of Hiring Managers — Use Vettery to connect with hiring managers at startups and Fortune 500 companies. It's free for job-seekers.

Vettery

🧑‍💻 Interested in running a job listing in this newsletter? There's more info here.

📗 Tutorials

Building Desktop Apps with Electron and Vue — In this tutorial, Timi Omoyeni explains what you need to keep in mind when building a desktop application with Vue.js using the Vue CLI Plugin Electron Builder.

Timi Omoyeni

Working with the Slack API in Node — Valeri covers the basics of how to send a Slack message from Node.

Valeri Karpov

Getting Started with Continuous Integration for Nest.js APIs — Learn how to build RESTful APIs with Nest.js, write tests for the business logic, and automate the tests using CircleCI.

CircleCI sponsor

Building a REST API Using Google Sheets — Not all apps need a database. Not all serverless functions need AWS Lambda or Cloudflare Workers.. This is an interesting look at using Google Cloud Run along with Google Sheets as a sort-of serverless data storage API.

Tek Loon

Advice to Myself When Starting Out as a Software Developer — Nothing earth shattering here, but solid advice generally. Keep reading, keep learning, figure out refactoring and testing, and teach.

Gergely Orosz

Working with Zip Files in Node

Valeri Karpov

🛠 Tools, Resources and Libraries

macintosh.js: A Virtual Macintosh Running in Electron — This is kinda impressive. A working (of sorts) virtual machine, emulating a 1991 Macintosh Quadra 900 with System 8, all running in Electron.

Felix Rieseberg

Git 2.28 Released: A Look at What's Newinit.defaultBranch is a new setting so that you can specify an alternative to master (such as main or trunk, say) for your initial, default branch.

Taylor Blau (GitHub)

Access Your C/C++ Code from Node.js. We'll Create Your Custom Binding

inspiredware sponsor

SheetSQL: A Library to Use Google Sheets as a Simple Database

Joway

png-img 3.0: A Light libpng Wrapper Library — Tested on Linux, macOS and Windows.

Yandex

AutoCannon: A Fast HTTP/1.1 Benchmarking Tool — Inspired by wrk and with support for HTTP pipelining and HTTPS.

Matteo Collina

Hexo 5.0: A Node Powered Blog Framework — Hexo is a mature blogging system built in Node that generates static files making it easy to deploy. 5.0.0 changelog and GitHub repo.

Hexo

Valeri, also known as The Code Barbarian, is a prolific author of JavaScript tutorials and books and was also the person to coin the term MEAN (as in the MongoDB, Express.js, Angular and Node.js stack). To celebrate the release of his new book, Mastering Mongoose, we've asked him a few questions:

(Note: We've had to edit this interview for length, but the full interview is here.)

Why should MongoDB still be considered for new apps when relational systems like Postgres have added so many NoSQL features in recent years?

From what I've seen, MongoDB's overall developer experience is far ahead of traditional relational systems. Many RDBMS's have added support for querying and indexing JSON objects in recent years, but MongoDB's query language makes handling deeply nested objects feel smooth and natural, especially with array filters in MongoDB 3.6.

As a developer, I love working with change streams and MongoDB's built-in geospatial queries and indexes. As a database operator, I don't know how I ever ran a production app without point-in-time backups and zero-downtime upgrades.

What does Mongoose give you that using the MongoDB client library directly doesn't?

Mongoose adds many of the features you might expect from a database framework: middleware, plugins, change tracking, data casting, and schema validation. Mongoose is like the MongoDB analog to an ORM: it lets you work with MongoDB using object-oriented programming, and fits neatly as the "M" in MVC. But, unlike an ORM, Mongoose does very little data transformation because of MongoDB's flexible document structure. With Mongoose, how your model instances look Node.js is almost identical to how your documents look in MongoDB.

If Mongoose provides structure and makes things easier when using MongoDB from Node, what gap does your book fill?

Writing docs requires a balancing act between providing enough structure vs being too opinionated. For example, when building Mongoose apps, I recommend avoiding using the aggregation framework and using middleware over setters when you need a setter that affects multiple properties. However, plenty of developers use these patterns and the online docs should help developers get unstuck fast, so I don't want to omit them from the docs or add a warning that can come off as pedantic.

What's the hardest part of self publishing your own technical books?

The hardest part of writing is coming up with code samples. A great code sample is short, clean, and provides more insight than hundreds of words of prose explanation. Just copy/pasting code from an app typically leads to a bad example: there's often too many implementation-specific details in a real app to make the example sufficiently isolated.

On the other hand, pseudo-code with a lot of "your code here" comments often is too hand-wavey to provide any real insight. That's why I spend most of my time writing obsessing over the details of code samples, and use a dedicated npm module to enable testing the code samples in Mocha.

The hardest part of self publishing overall is getting the word out. Like many developers, I'm introverted, so promoting my work has always been a challenge. Thanks to Peter and CooperPress for giving me this opportunity and making that part of self-publishing a little easier!

(Note: We've had to edit this interview for length, but the full interview is here.)

You can find Valeri on Twitter @code_barbarian or learn more about his Mastering Mongoose ebook here.