Slide 1

Slide 1 text

Yusuke Wada 2023-01-24 Serverless Frontend Meetup Hono v3 Do Everything, Run Anywhere, But Small, And Faster * will be released soon!

Slide 2

Slide 2 text

Me • Yusuke Wada • Supervisor at TravelBook Inc. • Web developer, Web framework developer • https://yusukebe.com/ • https://github.com/yusukebe 2

Slide 3

Slide 3 text

Ultrafast web framework for Cloudflare Workers, Deno, Bun, and Node.js 3 What's Hono?

Slide 4

Slide 4 text

Without Hono

Slide 5

Slide 5 text

With Hono

Slide 6

Slide 6 text

6 Web frameworks/routers for Cloudflare Workers •itty-router ~550 bytes •Sunder •Worktop •Hono

Slide 7

Slide 7 text

•Fast - 3+1 Routers •Tiny - about 20kB •Multi-runtimes - CF, Fastly, Deno, Bun, Lagon, Node.js •Fine DX - TypeScript •Batteries Included - Middleware 7 Hono Features

Slide 8

Slide 8 text

•Deno •Deno Benchmark •cdnjs •Ultra - Deno/React SSR Framework •Cloud fl are D1 example •substats •Kings League Project •react-starter-kit •Driv.ly 8 Who uses Hono?

Slide 9

Slide 9 text

Demo 1-minute deploy 9

Slide 10

Slide 10 text

Current version v2.7.5 shipped today 10

Slide 11

Slide 11 text

Going to "v3" Not released yet but will be soon. 11 Do Everything, Run Anywhere, But Small, And Faster

Slide 12

Slide 12 text

Run anywhere 12

Slide 13

Slide 13 text

13 Multi-runtimes CI support

Slide 14

Slide 14 text

Node.js support 14

Slide 15

Slide 15 text

Adapters 15 Cloud fl are Workers, Cloud fl are Pages, Bun, Deno are available

Slide 16

Slide 16 text

Cloudflare Pages

Slide 17

Slide 17 text

`/functions` 17

Slide 18

Slide 18 text

Next.js Edge API Routes

Slide 19

Slide 19 text

Use middleware on Vercel 19

Slide 20

Slide 20 text

Anywhere! thanks to Web Standard • Cloud fl are Workers • Cloud fl are Pages • Fastly Compute@Edge • Deno • Bun • Lagon • Vercel • Node.js • ... 20 Hono may work on every JavaScript runtime!

Slide 21

Slide 21 text

Faster 21

Slide 22

Slide 22 text

Performance improvement 22 15% faster! 3% slower:( Using https://github.com/SaltyAom/bun-http-framework-benchmark Measured on 2023-01-22

Slide 23

Slide 23 text

Small 23

Slide 24

Slide 24 text

A little fatter, but still small. 24 Express => 572 kB Fastify => 1.2 MB [email protected] => 48 kB

Slide 25

Slide 25 text

Pico - Ultratiny web framework 25 https://github.com/yusukebe/pico May be placed on @hono/pico ??

Slide 26

Slide 26 text

Do everything 26

Slide 27

Slide 27 text

RPC mode - like tRPC but integrated, too simple 27

Slide 28

Slide 28 text

1. Server: Write the schema 28

Slide 29

Slide 29 text

2. Use `zod-validator` Middleware 29

Slide 30

Slide 30 text

3. Write the endpoint with `jsonT()` and `build()` 30

Slide 31

Slide 31 text

4. Export "types" 31

Slide 32

Slide 32 text

5. Client: Use `@honoj/hc` and import "types" 32

Slide 33

Slide 33 text

6. Post JSON and parse the response 33

Slide 34

Slide 34 text

Share the API specs 34

Slide 35

Slide 35 text

Demo: https://github.com/honojs/hono/issues/727#issuecomment-1369078973 35

Slide 36

Slide 36 text

Great 👍 36

Slide 37

Slide 37 text

`create hono` command 37

Slide 38

Slide 38 text

@honojs to `@hono` ! 38 • We can make packages such middleware as `@hono/xxx` • Middleware • @hono/zod-validator • @hono/qwik-city • @hono/graphql-server - by @metrue • @hono/sentry by @sam-lippert • @hono/ fi rebase-auth by @Code-Hex • @hono/node-server • @hono/hc

Slide 39

Slide 39 text

Ecosystem 39 Hono Middleware hc node-server Adapter Pico `create hono`

Slide 40

Slide 40 text

@hono/qwik-city 40 Works on Cloud fl are Workers and Bun (also on Deno?)

Slide 41

Slide 41 text

It works on your runtime if it works on Hono 41

Slide 42

Slide 42 text

Others • `HonoRequest` • `HTTPException` • Router - regexp with slash support 42

Slide 43

Slide 43 text

Hono v3 will be released soon! 43