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
daigo3
April 30, 2024
Programming
350
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
450
ChatGPT を読書の供にする - Webナイト宮崎 Vol.17
sdaigo
0
490
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
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
0
1.8k
「人を評価する AI」の設計と実装
ryoyanara
0
190
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
550
React本体のコードリーディング
high_g_engineer
1
140
AIが無かった頃の素敵な出会いの話
codmoninc
1
420
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
170
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
500
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
320
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
220
仕様駆動開発の消費期限
watany
20
8.2k
VibeCodingからAgenticWorkflowへ
starfish719
0
420
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Done Done
chrislema
186
16k
エンジニアに許された特別な時間の終わり
watany
108
250k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
290
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Context Engineering - Making Every Token Count
addyosmani
9
1k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
The Spectacular Lies of Maps
axbom
PRO
1
900
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
270
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
WENDY [Excerpt]
tessaabrams
11
39k
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