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
340
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
440
ChatGPT を読書の供にする - Webナイト宮崎 Vol.17
sdaigo
0
480
Mapbox for Web Application
sdaigo
0
190
Spring with React for Enterprise Application
sdaigo
0
8.7k
Other Decks in Programming
See All in Programming
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
560
Oxlintのカスタムルールの現況
syumai
6
1.1k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
600
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
130
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
180
Vite+ Unified Toolchain for the Web
naokihaba
0
330
Claspは野良GASの夢をみるか
takter00
0
200
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
AIで効率化できた業務・日常
ochtum
0
140
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
180
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
120
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Between Models and Reality
mayunak
4
350
GraphQLとの向き合い方2022年版
quramy
50
15k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
560
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
430
Paper Plane (Part 1)
katiecoart
PRO
0
9.2k
4 Signs Your Business is Dying
shpigford
187
22k
The Spectacular Lies of Maps
axbom
PRO
1
820
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