Syntax - Tasty Web Development Treats

837: You Should Drop Express and Try Hono

· Summarized

Share this episode
Anyone with this link can open it.
Share Link
Start at 0:00

Key takeaways

  • Hono offers a modern alternative to Express, emphasizing simplicity and familiarity in route creation.
  • It's built on web standards, allowing for adaptability across various platforms and runtimes.
  • The backing from Cloudflare strengthens Hono's credibility and potential for future growth.
  • Hono's features, such as JSX support and built-in middleware, streamline backend development.
  • Hono can be effectively integrated with Next.js to achieve type-safe back-and-forth between frontend and backend.

Summary

Introduction to Hono

In this episode of Syntax, CJ Reynolds joins hosts Scott and Wes to discuss Hono, a fast, lightweight web application framework for JavaScript. They dive into the features that set Hono apart, particularly its user-friendly routing that resembles Express, making it familiar for many developers. CJ emphasizes how Hono is built on web standards, providing a streamlined approach to building backend applications.

Why Hono is Worth Trying

CJ elaborates on the reasons why developers should consider using Hono over traditional frameworks like Express. The discussion includes the simplicity of creating routes, support for various JavaScript runtimes, and enhanced type safety. They highlight how Hono has built-in middlewares and helpers that reduce the need for external libraries, promoting a smoother development experience.

Integration with Cloudflare

The conversation shifts to the backing Hono has received from Cloudflare. CJ notes that Cloudflare has hired the creator of Hono, which adds credibility and resources towards its development. The implications of this integration allow for seamless deployment on various platforms, enhancing Hono's appeal as a versatile framework.

Unique Features of Hono

The hosts discuss several unique features of Hono, including its JSX support, built-in validation, and JVM-like request handling through middleware. They explore ways in which Hono simplifies the process of building APIs by including features like JWT helpers and a straightforward testing method that enables developers to test requests without hitting the network.

Hono and Next.js

CJ explains how Hono can work seamlessly with Next.js, allowing developers to utilize Hono for their backend while still enjoying the frontend benefits of Next.js. This integration can be achieved by setting up a catch-all route handler in Next.js that forwards requests to Hono, promoting a type-safe communications between the frontend and the backend.

Community and Resources

The episode concludes with CJ sharing his positive experiences within the Hono community, highlighting the active discussions and quick responses in their GitHub repository. He provides resources for listeners to dive deeper into using Hono, including links to his YouTube videos, starter templates, and validation libraries.

Sponsors

  • Sentry.io · Check out Sentry at sentry.io/syntax. Sign up and get two months for free with coupon code atasty treat

Show notes

CJ joins Scott and Wes to dive into why he’s all-in on Hono, a fast and lightweight web framework for every JavaScript runtime. From familiar route creation to type-safe middleware, find out how Hono keeps things simple, powerful, and ready to use inside Next.js.
Show Notes 00:00 Welcome to Syntax!
00:46 Brought to you by Sentry.io.
01:11 What is Hono? Watch CJ’s Video Here

03:21 Syntax Meetup San Francisco.
04:02 Why I like Hono, and why you should try it.
04:08 Familiar route creation. Connect: an extensible HTTP server framework for node.

05:45 Supports every JS Runtime.
07:00 How a service worker works.
08:48 Helpers.
09:16 Middleware.
10:40 Sentry middleware.
10:55 JSX support.
13:21 Organizing route handlers while keeping Types.
14:24 Type safety. hono-open-api-starter.
zod-openapi.

15:46 Defining base type. Pinojs

17:36 Validation.
18:52 Hono RPC client.
22:09 Hono inside of Next.js.
23:30 Testing.
25:22 The community.
27:34 Type support.
Hit us up on Socials! Syntax: X Instagram Tiktok LinkedIn Threads
Wes: X Instagram Tiktok LinkedIn Threads
Scott: X Instagram Tiktok LinkedIn Threads
Randy: X Instagram YouTube Threads

Follow this show on AudioBrevity and new episodes get summarized for you. Create a free account

Couldn't load the audio. A blocker may be stopping the show's tracking links. Open the file