Hono's flame of eternal hope

Issue #167.March 6, 2023.2 Minute read.
Bytes

Today’s issue: The Shai-Hulud of JSON, Flamin’ Hot edge frameworks, and an ultimatum for Sundar Pichai.

Welcome to #167


Eyeballs logo

The Main Thing

man in underwear on motorcycle

Feel the power of the edge

Hono’s flame of eternal hope

Everybody’s racing to The Edge. By “The Edge”, we mean “running servers as close to your users as possible.” And by “Everybody” we mean “large hosting companies and OSS startups who smell a new monetization strategy.”

That’s not a bad thing, but these commercial incentives can often lead to fragmentation and vendor lock-in, which would be a real bummer for the EdgeLord community.

But that’s what makes Hono exciting. It’s an edge-first JavaScript framework that works everywhere — Cloudflare Workers, Fastly Compute@Edge, Vercel, Deno, Bun, Node.js, and others.

Because it uses only Web Standard APIs (plus a Node adapter), it’s able to run the same code on every platform, just with different entry points. And it’s got a few other tricks up its sleeve that make it extra fun and flirty fast and functional:

  • “Damn fast” routers — Hono claims that its RegExpRouter is the fastest router in the JavaScript world, because it intentionally avoids using linear loops (see internal benchmarks).

  • Batteries included — It comes with built-in middleware, custom middleware, and third-party middleware.

  • Types on types — It’s got first-class TypeScript support, and last month’s v3 release introduced Zod validator middleware for even more typey goodness.

Bottom Line: Hono means “flame” in Japanese — which I choose to interpret as, “the flame of eternal hope that one day we’ll be able to easily create super fast websites on the edge using simple frameworks with no vendor lock-in issues.”

It’s either that, or something about Flamin’ Hot Cheetos. Both sound great right about now.

        

CarbonQA logo

Our Friends
(With Benefits)

Dobby holding a sock

When you don't have to test the app yourself anymore.

CarbonQA sets you free

What’s the last thing on Earth you want to do after finishing a month-long feature sprint? Spend a few more days testing everything you just built 🤮.

That’s why so many dev teams use CarbonQA. They provide you with a dedicated, US-based testing team that handles all of your QA testing for you.

Here’s how it works:

  1. You give CarbonQA info about your stack, environments, app, and current testing practices.

  2. They set you up with a team of testers who work in your tools (Slack, Jira, GitHub, etc.) and fit right into your workflow.

  3. Your QA team learns your specific product and provides you with all of the custom, specialized testing you need — freeing up your dev team to focus on shipping features, not tests.

It’s cheaper than hiring your own full-time QA team, and it’s a lot cheaper than paying your developers to use their time on QA testing.

Check it out — and you’ll get less bugs, more money, happier developers. Triple win.


Pop Quiz logo

Pop Quiz

Sponsored by Stream

Build cross-platform messaging experiences with Stream Chat API. Sign up for Stream’s 30 day trial for free!

Nested loops aren’t ideal, but sometimes they’re unavoidable. Given the nested loop below, how can we break out of the nested loop when j === 2?

function loop () {
  for (let i = 0; i < 4; i++) {
    for (let j = 0; j < 4; j++) {
      if (j === 2) {
        // Break out here
      }
    }
  }
}

Cool Bits logo

Cool Bits

  1. Michal Warda wrote an article called How to contribute to a project you have no idea about. He’s talking about Bun, but I’ve used it to make my Twitter hot takes even more confidently incorrect.

  2. Courier built an out of the box notification service that manages templates and routing logic for multiple providers like Twilio, SendGrid, APNs, FCM, and Slack. See for yourself, and never build a notification service again. [sponsored]

  3. The ChatGPT API just got 90% cheaper than it was before. Is this the Singularity?

  4. Arktype is a type-safe runtime validator that understands TypeScript syntax.

  5. Feathers just released v5 of their framework for creating scalable web APIs and real-time applications.

  6. Sandworm is a command line tool that analyzes over 2 million JS packages to check for security issues in your app’s dependencies. Its friends call it the Shai-Hulud of security and license reports.

  7. Deoptigate is a slick tool that annotates your source code and shows you where the slow property access is. Here’s a quick demo.

  8. In If I died tomorrow, how long would my webapp keep running?, Caspar answers the most important questions regarding death.


Pop Quiz logo

Pop Quiz: Answer

Sponsored by Stream

It’s rarely used, but in JavaScript you can use a labeled statement to add a label to a for loop. This then allows you to break and interrupt the loop when needed – even from inside another loop.

function loop () {
  dance:
  for (let i = 0; i < 4; i++) {
    for (let j = 0; j < 4; j++) {
      if (j === 2) {
        break dance;
      }
    }
  }
}