This week, weâre experimenting with our runtime features, learning about The Edgeâ˘ď¸, and (hopefully) avoiding accidental tax fraud.
Welcome to #97.
Some experiments pay off
Node gets experimental
Node 18 was released last week, and it celebrated becoming a legal adult by doing what lots of us did on our 18th birthday: vomiting tobacco and Flaminâ Hot Cheetos out our nose â¨experimenting with stuffâ¨.
All of the big new features in Node 18 come with that spooky (experimental)
flag, so make sure you know your limits when youâre trying them out. (I always recommend the buddy system.)
đŹ Experiment #1: global fetch
API â This provides a standard around fetching data via http requests thatâs similar to the popular node-fetch library but is âas close to browser spec-compliant as possible.â The Node team has been working on this for literally 4 years, but it turns out that itâs still impossible to please everybody.
đŹ Experiment #2: Test runner module â This new, built-in test runner lets you create and run Node tests without a third-party library. This is great news for smaller libraries looking to minimize dependencies and developers who just want to use Jest less (so, everyone).
đŹ Experiment #3: Web Streams API â This implementation of 17 different APIs is a lot. But the idea is that it allows you to use JavaScript to programmatically access streams of data and process them in a bunch of different ways.
The bottom line: Weâre just happy to see Node being so productive despite the abandonment issues they must have been dealing with ever since dad Ryan Dahl left.
Building notifications from scratch. [sponsored]
Courierâs new API saved me from my PM
You know that one person on your team who loves building complex notification systems?
Of course you donât.
Thatâs because notifications have become a special kind of hell with tons of different platforms to worry about â email, SMS, chat, web and mobile push, Slack and more.
Thatâs what makes Courierâs simple API so powerful. Itâs a one-stop shop for all notification platforms â so you can use the same API call to send your users an email, an SMS, a Slack message, or a push notification.
And their new Courier Elemental update gives you a JSON-based syntax to easily customize the design and content for each platform you send messages to.
This makes designing the actual notifications a lot less tedious, and it lets you create more dynamic notifications like magic login links and location based alerts.
So tell your PM to go as crazy as they want with notifications, because Courierâs got your back.
Check it out and get 10,000 free sends a month.
My innie trying to figure out wtf "the edge" is
Netlify and Deno are teaming up at The Edgeâ˘ď¸
Netlify and Deno just announced that theyâre partnering to deliver Edge Functions â a new serverless compute offering. Given that developers reference the âthe edgeâ more than my mother-in-lawâs flat earth Facebook group, we should probably address what the big deal is.
âThe Edgeâ, otherwise known as a spicy Content Delivery Network (CDN), has been around for a while. CDNs provide the infrastructure to cache static content and deliver it from the closest server to the end user. Cloudflare changed the game when they released Workers in 2017, making it possible to run JavaScript at the edge.
Since then, hosting providers have been aggressively pursuing their own âedge computeâ offerings. Like Workers, Deno & Netlifyâs new offering is built on top of the V8 JavaScript engine and has a similar API to service workers in the browser. Here are some of the highlights:
-
Cheap â 24x less expensive than standard serverless functions (3 million/month for free).
-
Fast â without the overhead of containers, edge functions can start faster and run closer to the user, reducing latency.
-
Web APIs â Because theyâre built on web standards, code can be moved from the client to the server without many of the previous tradeoffs.
-
New paradigm â Edge rendering can be nearly as fast as serving static files, potentially changing the paradigm for how developers think about building applications.
The Bottom Line: Itâs hard to be more stoked about âthe Edgeâ than I was in high school (closet U2 fan - terrible decision), but with companies like Cloudflare, Deno, and the rest of the homies working on it, âthe Edgeâ definitely seems like the next big thing.
Jobs
Synapse is a software consultancy (Node/React) with a focus on engineering excellence and tightly knit, low-ego teams. We believe devs want to feel productive, challenged, and supported and build our culture around those concepts. Come join our growing crew as we solve interesting challenges in healthcare, fitness, IoT, retail and more, for a variety of clients, at scale.
đŹ Spot the Bug â Sponsored by PostHog
PostHog is an open-source product analytics suite you can self-host. Heatmaps, Recordings, Funnels and more â all in a platform where you can build your own TypeScript plugins!
function calcPrice(price, tax, discount) {
tax = tax || 0.05;
discount = discount || 0;
return price - price * discount + price * tax;
}
Cool Bits
-
JSDB is a new tool that lets you use JavaScript as your database. Because when everyoneâs super a backend developer, no one will be đ
-
Eleventy didnât want to feel left out of EdgeWeekâ˘ď¸, so they announced plans for Eleventy Edge â a new plugin to run Eleventy in an Edge Function so you can easily add dynamic content to your sites.
-
React - The Road to Enterprise is a new, advanced React book thatâll teach you industry-level techniques, best practices and concepts like advanced component and state management patterns, performance optimisation, scalable and maintainable architecture, testing, and much more. [sponsored]
-
Ăscar Otero created this Deno cheat sheet for no other reason than to help you feel superior to your co-workers. Youâre welcome.
-
Misko Hevery wrote about how Hydration is Pure Overhead. That may be true, but Misko should know how important hydration is this time of year â especially when peopleâs allergies are acting up.
-
Marcin Wanago wrote this 10-part series on JavaScript testing that covers a range of beginner and advanced topics. Thankfully, we can just use Nodeâs built-in test runner for everything now, so weâll never have to read it.
-
David East from the Firebase team made this 30-minute crash course that shows how to use Firestore and Firebase Auth together.
-
Reasonable Colors is an open-source color system for building nice color palettes. Now if only we could get someone to create some Reasonable Tax Reform, so that I could pay the US government what I owe without having stress dreams about being thrown in prison for committing accidental tax fraud.
đŹ Spot the Bug â Sponsored by PostHog
The ||
operator checks for falsy values and 0
is a falsy value, which would accidentally apply the default tax rate. To fix this, instead of checking for a falsy value, you can use the nullish coalescing (??
) operator.
function calcPrice(price, tax, discount) {
tax = tax ?? 0.05;
discount = discount ?? 0;
return price - price * discount + price * tax;
}
The nullish coalescing operator works because it returns its right-hand side operand when its left-hand side operand is null
or undefined
(NOT 0), and otherwise returns its left-hand side operand.
Share Bytes
We work hard to make Bytes something you'd want to share with your
developer friends. And to make it a little easier, we'll give you free
stuff when you do.
Have a product you think our developers will love?
Advertise in Bytes
50 W Broadway Ste 333 PMB 51647 Salt Lake City, Utah 84101
Unsubscribe from Bytes