Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Next.js in Practice
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
daigo3
April 30, 2024
Programming
370
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Next.js in Practice
daigo3
April 30, 2024
More Decks by daigo3
See All by daigo3
OCaml -> Melange -> fun
sdaigo
0
470
ChatGPT を読書の供にする - Webナイト宮崎 Vol.17
sdaigo
0
500
Mapbox for Web Application
sdaigo
0
200
Spring with React for Enterprise Application
sdaigo
0
8.8k
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
910
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
260
iOSDC2026登壇資料.pdf
riofujimon
0
180
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
170
Workers Cache を知る
syumai
0
190
Are APIs Still Relevant in the AI Era?
soyuka
0
300
AHC070解法紹介
eijirou
0
130
Java 27新機能 / Java 27 new features
kishida
2
160
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
460
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
120
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
110
Featured
See All Featured
Accessibility Awareness
sabderemane
1
220
Scaling GitHub
holman
464
140k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
How STYLIGHT went responsive
nonsquared
100
6.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Transcript
Next.js App Router in Practices WebφΠτٶ࡚ Vol.20 2024.4.26 @sdaigo
ઃᒜ େޛ Frontend dev @sdaigo
Intro Next.js App Router Ͱ monolith ͳ ϑϧελοΫ ΞϓϦέʔγϣϯΛߏங͢ΔͨΊʹ ࠾༻͍ͯ͠ΔΞʔΩςΫνϟʹ͍ͭͯ
• Modular and Layered architecture • Tools https://ja.next-community-docs.dev/docs/app-router Next.js App Router ͷυΩϡϝϯτͷ༁Λެ։͠·ͨ͠ʂ
. ├── LICENSE ├── README.md ├── apps │ ├── blog
│ └── web ├── biome.json ├── bun.lockb ├── lefthook.yml ├── package.json ├── packages │ ├── design - system │ └── ui └── turbo.json ҙͷཻͷΞϓϦέʔγϣϯ σβΠϯγεςϜʢσβΠϯτʔΫϯʣ σβΠϯγεςϜΛ࣮ͨ͠ Atomic ίϯϙʔωϯτ Monorepo /w Turbopack
packages/design-system σβΠϯτʔΫϯͷఆٛ • Panda CSS ͷ τʔΫϯఆٛू • Primitive ͳτʔΫϯͷఆٛͱɺίϯςΩετΛදͨ͠
Semantic ͳτʔΫϯΛఆٛ͢Δ • Preset (≒ theme) Λग़ྗͯ͠ packages/uiɺ apps/* ͔Β༻͢Δ
None
packages/ui σβΠϯτʔΫϯΛ༻ͨ͠ڞ༗ίϯϙʔωϯτ • Custom Component or Ark UI ϕʔεͷίϯϙʔωϯτ •
͜ΕҎ্ࡉԽͰ͖ͳ͍ʢͯ͠ҙຯ͕ͳ͍ʣ୯ҐͷίϯϙʔωϯτूʢAtomic Componentʣ • Design System ʹ͓͚ΔίϯϙʔωϯτදతͳͷͰ͔͠ͳ͍ͷͰ͚ͯΔ
Design System accent: { DEFAULT : { value: "{colors.ultra.950}" },
inverted: { value: "{colors.white}" }, fg: { value: "{colors.ultra.50}" }, emphasized: { value: "{colors.ultra.800}" }, muted: { value: "{colors.ultra.700}" }, subtle: { value: "{colors.ultra.100}" }, disabled: { value: "{colors.ultra.200}" }, }, Component Structure and Functionality Custom Components 💅
apps/* ҙͷཻͷΞϓϦέʔγϣϯ • ཧ۶্ Next ʹݶΒͣɺWeb ϑϨʔϜϫʔΫ্ʹߏங͞ΕΔΞϓϦέʔγϣϯ • ϑϨʔϜϫʔΫͷϧʔϧͱɺΞϓϦέʔγϣϯͷυϝΠϯͷ࣮Λ͢Δ •
Next.js Ͱ͋ΕɺϑΝΠϧن্ @… […]ɺ(…)ͳͲͷσΟϨΫτϦ͕ग़ͯ͘ΔͷͰ FW ͷ࣮ͷৄࡉͷதʹϏδωεϧʔϧΛॻ͖ͨ͘ͳ͍ • Next.js߹ͷϞδϡʔϧΛԡ͠ࠐΊΔ • ͍ͭͰ Next.js ΛࣺͯΒΕΔΑ͏ʹ͓ͯ͘͠
src/app ├── favicon.ico ├── globals.css ├── layout.tsx ├── not -
found.tsx ├── page.tsx ├── posts │ ├── [ ... slug] │ │ ├── loading.tsx │ │ └── page.tsx │ ├── loading.tsx │ └── page.tsx └── tags └── [tag] ├── loading.tsx └── page.tsx App Directory •Route Segment ͷఆٛ •page / layout ͳͲϑΝΠϧن͕͋Δͷ͚ͩ
src/boundary ├── posts │ ├── action │ │ ├── posts.ts
│ │ └── tags.ts │ ├── domain │ │ ├── post.ts │ ├── presenter │ │ ├── post.ts │ │ └── tags.ts │ └── ui │ ├── archives │ └── featured └── shared ├── consts.ts └── ui Boundary ʹ ίϯςΩετڥք͝ͱͷϞδϡʔϧΛఆٛ͢Δ action : side-effects / server actions domain: data, calculation presenter: data transformation ui: Object Level Components
None
Bun JavaScript Runtime https://bun.sh/ • ମײϨϕϧͰૣ͍ • Vercel ͰରԠ͍ͯ͠Δ TOOLS
Biome Rust Ͱॻ͔Εͨ Formatter / Linter ΛؚΉπʔϧ https://biomejs.dev/ • Alt
ESLint / Prettier • Opinionated • Biome ͷϧʔϧʹै͍ɺؾʹೖΒͳ͍ϧʔϧ্͚ͩॻ͖ઃఆ͢Δ TOOLS
{ "$schema": "https: // biomejs.dev/schemas/1.6.3/schema.json", "organizeImports": { "enabled": true },
"linter": { "rules": { "recommended": true } }, "formatter": { "formatWithErrors": true, "indentStyle": "space", "lineWidth": 100 }, "javascript": { "formatter": { "arrowParentheses": "asNeeded" } } }
Panda CSS-in-JS https://panda-css.com/ • RSCʹରԠͨ͠ CSS-in-JS • Stitches ʹࣅͯΔͷͰݸਓతʹ͍͍͢ •
σβΠϯτʔΫϯΛఆٛͰ͖ΔͷͰɺσβΠϯγεςϜΛߏங͍͢͠ TOOLS
ts-belt FP utilities for TypeScript ReScript ʢچBuckleScriptʣ ͷ API https://mobily.github.io/ts-belt/
• Ramda + TypeScript ͕ਏ͍ • OptionɺResultɺpipe ts-pattern Bring Pattern Matching for TypeScript https://github.com/gvergnaud/ts-pattern • TSͰύλʔϯϚονϯά ™︎ TOOLS