Lesson 03: Project Architecture - strvcom/frontend-academy-2022 GitHub Wiki
Speaker: Matej Polak
- Pull Request
- Recording (Gdrive)
- Slides (Google Slides)
- Slides (PDF)
- Removal of
pages/api/hello,public/vercel.svg,styles/Home.modules.css, and placeholder code inpages/index git commit -m 'refactor: next.js bootstrap cleanup'
2. src/
- Create
src/and move all the app related files into it git commit -m 'refactor: moved app related code into src/ dir'
- Add
features/with following structure
- features/
- events/
- pages/
- CreateEventPage/
- index.jsx
- DashboardPage/
- index.jsx
- login/
- pages/
- LoginPage/
- index.jsx
- Implement all these pages into Next.js routing (
src/pages/) git commit -m 'feat: added features dir and implemented navigation'
4. Path aliases
- Configure
~/*path alias intsconfig.json - Update nested imports in
src/pages/to use the new alias git commit -m 'refactor: add path aliases'
- Create
constants/to specifyRoutesenum (to be used in<Header />) - Create
<Header />and<Layout />and its flavor<DefaultLayout /> - Use all these in all previously created pages
git commit -m 'feat: created and implemented Header and Layout components'
6. Theme
- Create
theme/dir with examplepalette.tsandcolors.ts - Move
globals.cssfromstylestotheme git commit -m 'feat: added theme dir with example palette and colors'
- create
utils/ - create example
example.tswith exportedgetExampleValue: () => number git commit -m 'feat: added example utility'
8. Example hook
- create
hooks/ - create example
useExampleValue.tswith exporteduseExampleValue: () => {exampleValue: number, setExampleValue: (newValue: number) => void} git commit -m 'feat: added example hook'