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
Next.js in Practice
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
daigo3
April 30, 2024
Programming
360
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
460
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
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.6k
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
420
【デモ】Kiroで体験する仕様駆動開発|設計からコーディングまでAIと進める開発フロー
cmkudo
0
530
リアルな遅延を測る仕様
kota_yata
1
130
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
850
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
200
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
560
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
240
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
280
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
600
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
590
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
140
Featured
See All Featured
Fireside Chat
paigeccino
42
4k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
700
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Claude Code のすすめ
schroneko
67
230k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
460
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
580
Prompt Engineering for Job Search
mfonobong
0
430
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
880
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