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
480
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
1B+ /day規模のログを管理する技術
broadleaf
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
280
自作OSでスライド発表する
uyuki234
1
3.9k
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
860
Foundation Models frameworkで画像分析
ryodeveloper
1
120
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
220
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
180
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
530
関数型プログラミングのメリットって何だろう?
wanko_it
0
180
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
3
1.5k
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
130
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
170
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
108
250k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
460
GraphQLとの向き合い方2022年版
quramy
50
15k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
210
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
750
What's in a price? How to price your products and services
michaelherold
247
13k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
270
Building Adaptive Systems
keathley
44
3.1k
The Spectacular Lies of Maps
axbom
PRO
1
860
Embracing the Ebb and Flow
colly
88
5.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
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