Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
通るURLだけ通す Monorepoで実現する型安全なリンク設計
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ya2s
November 22, 2025
87
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
通るURLだけ通す Monorepoで実現する型安全なリンク設計
ya2s
November 22, 2025
More Decks by ya2s
See All by ya2s
デザイン資産をレゴ化!MCPで誰でも作れるLP基盤
ya2s
0
540
Next.js Imageコンポーネントの 舞台裏をのぞく👀
ya2s
0
23
NEWT Tech Talk vol.7 Next.jsとTurborepoで挑む!マイクロフロントエンドのリアル
ya2s
0
120
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1370
210k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
300
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
AI: The stuff that nobody shows you
jnunemaker
PRO
8
720
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
390
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
540
Practical Orchestrator
shlominoach
191
11k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
Raft: Consensus for Rubyists
vanstee
141
7.5k
Transcript
௨Δ63-͚ͩ௨͢ .POPSFQPͰ࣮ݱ͢Δܕ҆શͳϦϯΫઃܭ
© 2025 Reiwa Travel, Inc. 2 #BDLHSPVOE d-*/&Ϡϑʔגࣜձࣾ ɹɹɹɹ%FW0QTɺ10ɺ1BZ1BZϑϦϚͷϑϩϯτΤϯυ dגࣜձࣾྩτϥϕϧ
ɹɹɹɹϑϩϯτΤϯυɺ&. /FYUKT3FBDU3FBDU/BUJWF&YQP5ZQFTDSJQU /PEFKT(SBQI2-/FPWJN 👶 ̎ࣇͷɹ🎲 ϘʔυήʔϜ 4/4 ྩτϥϕϧϑϩϯτΤϯυΤϯδχΞc&. ZBTTBO !ZBT@Y !ZBT
© 2025 Reiwa Travel, Inc. 3
© 2025 Reiwa Travel, Inc. 4
© 2025 Reiwa Travel, Inc. 5 TSKaigi Hokuriku 2025 参加者限定
特別クーポン
© 2025 Reiwa Travel, Inc. 今日お話しすること 社内におけるインシデントの恒久対応としてライブラリを開発してOSSに 課題はフロントエンド開発において遷移先のURLを型安全に扱いたい 6
© 2025 Reiwa Travel, Inc. 存在しないURLをリンク先にしてしまった <a href="/dasboard">Dashboard</a> // "dashboard"
を typo
© 2025 Reiwa Travel, Inc. Next.js TypedRoutes <Link href="..."> や
router.push("...") など「存在しないパス」を渡した時に コンパイル時に TypeScript エラーで検出する 8
© 2025 Reiwa Travel, Inc. Next.js TypedRoutesの限界 9 • Dynamic
Routeに弱い(非リテラル化でstringに落ちがち) • Pathのみ。queryの型付けがない • Monorepo(MFE)横断では価値が薄い(アプリ内限定)
© 2025 Reiwa Travel, Inc. ya2s / next-typed-url 10 Next.js
の Pages/App Router からルート情報をスキャンし ルートパラメータやクエリ型まで含めた型安全なURLビルダーを自動生成するCLI/ライブラリ 単一のNext.js.プロジェクトでも Monorepo(micro frontend)でも使える
© 2025 Reiwa Travel, Inc. ya2s / next-typed-url 11 プロジェクトルートで型付きURLの生成を実行
生成されたコードを使ってURLを組み立てる
© 2025 Reiwa Travel, Inc. <Link href={ urls.hotel.build({ route: “/tour/[tourId]",
params: { tourId: “12345", }, searchParams: { country: "jpn", } }).href } ya2s / next-typed-url 12
© 2025 Reiwa Travel, Inc. <Link href={ urls.hotel.build({ route: “/tour/[tourId]",
params: { tourId: “12345", }, searchParams: { country: "jpn", } }).href } ya2s / next-typed-url 13 ルート情報から候補を補完
© 2025 Reiwa Travel, Inc. <Link href={ urls.hotel.build({ route: “/tour/[tourId]",
params: { tourId: “12345", }, searchParams: { country: "jpn", } }).href } ya2s / next-typed-url 14 動的なパラメータも補完・型安全
© 2025 Reiwa Travel, Inc. <Link href={ urls.hotel.build({ route: “/tour/[tourId]",
params: { tourId: “12345", }, searchParams: { country: "jpn", } }).href } ya2s / next-typed-url 15 クエリパラメータも補完・型安全
© 2025 Reiwa Travel, Inc. ya2s / next-typed-url 16 Q.
クエリパラメータはどこから取得しているの? A. page.tsxにtype Queryを定義する(コロケーション)
© 2025 Reiwa Travel, Inc. <Link href={ urls.hotel.build({ route: “/tour/[tourId]",
params: { tourId: “12345", }, searchParams: { country: "jpn", } }).href } Monorepoの場合は、アプリごとの名前空間を補完 ya2s / next-typed-url 17
CONFIDENTIAL © 2025 Reiwa Travel, Inc. 18 ·ͱΊ 型安全なURLの生成のためのライブラリ(next-typed-url)を作成 存在しないURLをリンク先に指定することがなくなる
- Dynamic Routeやクエリパラメータにも対応 - MonoreopもアプリごとにURLを生成 OSSへのContributeお待ちしています!
Thank you! CONFIDENTIAL © 2025 Reiwa Travel, Inc. 19