Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hono v3 and v4
Search
Yusuke Wada
November 19, 2023
Programming
4
3.9k
Hono v3 and v4
JSConf JP
Nov 19, 2023. Yusuke Wada
Yusuke Wada
November 19, 2023
Tweet
Share
More Decks by Yusuke Wada
See All by Yusuke Wada
Remix on Hono on Cloudflare Workers
yusukebe
2
400
僕がつくった48個のWebサービス達
yusukebe
20
17k
Honoの来た道とこれから
yusukebe
20
4.6k
JS RPCを理解する
yusukebe
5
710
Honoとhtmx
yusukebe
6
1.8k
Cloudflare Workersの環境を再現することについて
yusukebe
7
1k
Hono v4
yusukebe
11
4.9k
The power of Web-standards
yusukebe
4
1.7k
実践エッジユースケース
yusukebe
7
2.2k
Other Decks in Programming
See All in Programming
useSyncExternalStoreを使いまくる
ssssota
2
380
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
640
競技プログラミングで 基礎体力を身につけよう / You can get basic skills through competitive programming
mdstoy
0
150
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
350
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.3k
たのしいparse.y
ydah
3
110
WebAssembly Unleashed: Powering Server-Side Applications
chrisft25
0
2.1k
Recoilを剥がしている話
kirik
0
1k
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
240
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
130
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
150
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
140
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
890
Rails Girls Zürich Keynote
gr2m
94
13k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Six Lessons from altMBA
skipperchong
27
3.5k
Thoughts on Productivity
jonyablonski
67
4.3k
The Cult of Friendly URLs
andyhume
78
6.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Transcript
Hono v3 and v4 JSConf JP Nov 19, 2023. Yusuke
Wada
ࣗݾհ • Yusuke Wada • Web framework developer • Developer
Advocate @Cloud fl are • Bokete co-founder • Creator of Hono • https://github.com/yusukebe
ࠓͷτϐοΫ 1. Hono v3.*ͷػೳ 2. Hono v4ͰͲ͏ͳΔͷ͔ʁ
Honoͱʁ • Web-framework runs on any JavaScript runtime. • Fast,
Lightweight, Web-standards. • Works on… • Cloud fl are Workers • Deno • Bun • Node.js • Fastly Compute • AWS Lambda • Vercel • Others! https://hono.dev
GitHub Stars ⭐
Who is using Hono? • cdnjs API Server • Poly
fi ll.io • Deno Docs • Ultra • Cloud fl are Blog • Workers SDK • Cloud fl are D1 • Drivly • SticAI • Skill Struck • Reejs • toddle • LanderLab • OpenStatus • Loglib • repeat.dev • Nodecraft • Hwy • Unkey • AI.LS • ExpenSee • Others!
v2·ͰͷҰൠతͳػೳ • ϧʔςΟϯά • Request/ResponseΛѻ͏ • Text/JSON/HTMLϨεϙϯεΛฦ͢ • ϛυϧΣΞΛ͏ •
BindingsɺมΛѻ͏ • Cloud fl are WorkersɺDenoɺBunͰಈ͔͢
v3.*ͰೖͬͨػೳΛհ͠·͢ • v3.0.0 => 2023/02/18ʹϦϦʔε • v.3.10.0 => 2023/11/13ʹϦϦʔε •
جຊతʹsemverΛक͍ͬͯΔͷͰminorϦϦʔεΛհ • ͋ͳ͕ͨΒͳ͍͔͠Εͳ͍Hono
v3.0.0 - 2023/02/18 • HonoRequest • RegExpRouter becomes the fastest
router • Good-bye StaticRouter • New Validator • RPC • Adapter • Muti-runtime CI Support • Support WinterCG Runtime Keys • create-hono • @honojs to @hono
RegExpRouter becomes the fastest router 20232݄࣌ͷϕϯνϚʔΫͰ͢ • RegExpRouter͕ JavaScriptքͰ1൪ ͍ϧʔλʔͷͻͱ
ͭʹͳͬͨ
New Validator • ബ͘ͳͬͨ • ZodɺValibotɺTypeBox ͳͲ֎෦ͷValidatorΛ ༻͢Δ3rd-partyϥΠϒ ϥϦ •
ܕ͚
RPC-mode • ΫϥΠϯτΛੜ͢Δ`hc()`Λಋೖ • αʔόʔଆͷܕΛड͚͠ɺAPIεϖοΫΛڞ༗͢Δ • tRPCͷΑ͏͕ͩɺ͍ͭͷΞϓϦΛ؆୯ʹҠߦͰ͖Δ • ྫ͑Zod/Zod Validator/hcͷελοΫͰͰ͖Δ
None
Multi-runtime CI Support 202311݄ݱࡏɺMainͷଞʹ7ͭͷϥΠϯλΠϜͷςετ͕Δ
v3.1.0 - 2023/03/17 • Improve RPC-mode • `env` for getting
environment variables for multi-runtimes • AWS Lambda Adapter • basePath() • c.req.path • Allow passing RequestInit to c.json() etc.
`env` for getting environment variables for multi-runtimes • ϥϯλΠϜʹґଘͤͣಁաతʹڥมΛऔಘ͢ΔͨΊͷ`env()`
AWS Lambda Adapter • AWS LambdaʹରԠ
v3.2.0 - 2023/05/19 • New Routers • Presets: `hono/tiny`, `hono/quick`
• app.mount() • Node.js adapter server v1.0.0 has been released • Support for routing includes a hostname
New Routers • LinearRouter • ϧʔςΟϯάͷొ͕͍ϧʔλʔ • PatternRouter • ͱʹ͔͘খ͍͞ϧʔλʔ
ܭ5ͭͷϧʔλʔʹͳͬͨ TrieRouter RegExpRouter SmartRouter LinearRouter PatternRouter
Presets: `hono/tiny`, `hono/quick` • `hono/tiny` • PatternRouterͷΈ • খ͍͞ •
13KB • `hono/quick` • LinearRouterͱTrieRouter • ϧʔτͷొ͕͍
ͲͷPresetΛ͏͖͔ hono ͍ DenoɺBunɺNode.js Cloud fl are Workers hono/quick ొ͕͍
Fastly Compute hono/tiny খ͍͞ Ϧιʔε͕ݶΒΕ͍ͯΔڥ
app.mount() • ͲΜͳ`fetch` ΞϓϦέʔγϣϯͰmountͰ͖Δ
itty-router, Remix, Qwik City, Solid StartͳͲ͍͚Δ
֤ϑϨʔϜϫʔΫ͕ΞμϓλΛ࡞͍ͬͯͨ
HonoʹϚϯτͤ͞ΕͲΜͳϓϥοτϑΥʔϜͰಈ͘
Node.js adapter server v1.0.0 • Poly fi llͳ͠ɺNode.jsωΠςΟϒͳWeb-standards APIͷΈΛ༻
v3.3.0 - 2023/07/11 • Server-Timing Middleware • Lambda@Edge Adapter
Server-Timing Middleware • Server-Timing APIΛͬͯύ ϑΥʔϚϯεܭଌ͕Ͱ͖Δ
v3.4.0 - 2023/08/08 • Netlify Adapter • Cookie Middleware supports
Signed Cookies
v3.5.0 - 2023/08/21 • Secure Headers Middleware • Introduce “Helpers”
• Zod OpenAPI Hono
Secure Headers Middleware • ηΩϡϦςΟʹ·ͭΘΔϔο μͷઃఆ͕Ͱ͖Δ • ExpressͷHelmet૬
Introduce “Helpers” • ϛυϧΣΞͱҧ͍ศརϝιουΛఏڙ͢Δ
ࠓ͋ΔHelpers • Adapter • Cookie • Factory • html •
JWT • Streaming • Testing
Zod OpenAPI Hono • ͷOpenAPIαϙʔτ • HonoΛϥοϓͨ͠Ϋϥε • Zodͱ”Zod to
OpenAPI”Λ͍ͬͯΔ
1. ZodͰεΩʔϚΛॻ͘
2. ϧʔτΛ࡞Δ
3. ΞϓϦʹ͢Δ
4. JSONͷυΩϡϝϯτ͕ు͚Δ
None
5. Swagger UI MiddlewareͱΈ߹ΘͤΔ
None
ܕ͕ͭ͘
v3.6.0 - 2023/09/11 • Introduce `c.render()` • Introduce `c.var` •
`FC` for JSX • `$url()` in Hono Client • Vite dev-server for Hono • Deprecate some properties in HonoRequest • Replaced Jest with Vitest
Introduce `c.render()` • HTMLͷϨΠΞτΛ؆୯ʹͭͬͯ͘దԠ͘͢͠ Middleware Handler Result
Vite dev-server for Hono • `@hono/vite-dev-server` • Viteͷಠࣗdev serverΛఏڙ͢ΔVite plugin
• Viteܦ༝Ͱ`fetch`ΞϓϦΛ։ൃͰ͖Δ • ࠶ىಈɺϦϩʔυ͕͍ • ϑϩϯτରԠ • Cloud fl areͷBindingsαϙʔτ͍ͯ͠Δ
None
v3.7.0 - 2023/09/21 • `c.stream()` and `c.streamText()` • Testing Helper
• JWT helper
`c.stream()` and `c.streamText()` • ͷStreamରԠ • Zod OpenAPIͱ߹ΘͤͯAI readyʹ
None
v3.8.0 - 2023/10/19 • JSX Context API • JSX Renderer
Middleware • Streaming Helper • Factory Helper • `parseBody()` supports multi values • Improve path matching in the router
JSX Renderer Middleware • `c.render()`Ͱ͏ͨΊͷϨΠΞτΛ JSXͰఆٛ͘͢͠ • `useRequestContext()`ͰContextΦ ϒδΣΫτ͕औΕΔΑ͏ʹͳΔ
Streaming Helper • `streamSSE()`ͰServer-Sent Events͕ు͚Δ
Factory Helper • `createMiddleware()`͕ຯʹศར • ܕղܾΛͬͯ͘Δ
v3.9.0 - 2023/10/27 • Improving the Developer Experience for JSX
• Clerk Middleware • New Starter Template for Cloud fl are Pages
Improving the Developer Experience for JSX • λάʹܕ͕͍ͭͨɻΤσΟλͰิॿͯ͘͠ΕΔ
New Starter Template for Cloudflare Pages • `@hono/vite-dev-server`Λར༻ͨ͠৽͍͠ελʔλʔ
v3.10.0 - 2023/11/13 • JSX supports Async Components • Introduce
`Suspense` and `renderToReadableStream()` • JSX Renderer Middleware supports `stream` • Support `@jsx precompile` for Deno
JSX supports Async Components • JSXͷίϯϙʔωϯτͷதͰasync/awaitͰ͖Δ
Introduce `Suspense` and `renderToReadableStream()` • AsyncComponent`fetch`͕ऴΘΔ·Ͱawait͢Δ • SuspenseΛ`renderToReadableStream()`ͱ͏ͱ`fetch`͕ऴΘΔؒ fallbackΛදࣔɺղܾ͞ΕͨΒ݁ՌΛදࣔ
None
None
JSX Renderer Middleware supports `stream` • `stream: true`ʹ͢Δ͜ͱͰ StreamingͷϨεϙϯεʹͳΔ
v3.*Ͱಋೖ͞ΕͨػೳΛΈ͖ͯ·ͨ͠ • v3.0.0 => 2023/02/18 • v3.1.0 => 2023/03/17 •
v3.2.0 => 2023/05/19 • v3.3.0 => 2023/07/11 • v3.4.0 => 2023/08/08 • v3.5.0 => 2023/08/21 • v3.6.0 => 2023/09/11 • v3.7.0 => 2023/09/21 • v3.8.0 => 2023/10/19 • v3.9.0 => 2023/10/27 • v3.10.0 => 2023/11/13
ͬͯΈͯͩ͘ ͍͞
v4?
v4? When? What?
What is introduced in v4?
File-base Routing??
Thanks