Portfolio /w Next.js(React-redux) + MongoDB
- author sungryeol park(sungryeolp@gmail.com)
- used tech stack:
- React
- Next.js(Client)
- Vue.js(Admin)
- Redux(Redux-thunk)
- Express
- Mongoose
- Mocha + Jest
- passport.js
- PostCSS + eslint + stylelint
- PWA
- TravisCI
- design process: Adobe Photoshop + Figma
Commands
initialize & register admin to db
# mongodb should be running background first
# api/
yarn install
yarn setup
# www/
yarn install
in case of changing lint setup
yarn lint:init
test run & analyzation
# for both www, api, admin
yarn dev
# only for www
yarn analyze
yarn analyze:server # only for server
yarn analyze:browser # only for browser
production deployment
# for both www, api
yarn build
yarn start
# for admin
yarn build:prod
# admin doesn't have server. use nginx to serve.
# docker part is still in progress
mocha test for api server
# only for api
yarn test:watch --grep ${targetString}
# or
yarn test:grep ${targetString}
as there is ServiceWorker working on background,
cache TTL/max-age should be set to 0
for displaying lint message in vscode,
must install vscode extensions for eslint & stylelint
solved & ongoing issues
-
jest
doesn't work properly withmongoose
testing → replaced withmocha
-
mocha --watch
doesn't work properly withmongoose
. → reference link - apply
https
→https should be served via nginx proxy → reference link - apply
scss
- apply
eslint
&prettier
for frontend(react) - apply
jwt
& cookie auth model - apply
eslint
&prettier
for backend - apply
typescript
(or ts type definition) → decided to substitute withJSDOC
- api separation
- doesn't properly compile on personal windows machine;fails on reading
JSX
. working fine on Mac; replacedSASS
module withPostCSS
-
replacescss
with better substitute: it breaks easily on different environment -
full: overhead is too biggraphql
adoption -
full:typescript
adoptiontypescript
is not appropriate for quick inidivual development. Instead, partially adopted typescript definition files → reference link - should be served via
Docker
- check server disk limit first - PWA optimization
file structure
use tree --dirsfirst -I 'node_modules|build|.git|yarn.lock|yarn-error.log|readme.md|.next|*.scss|.DS_Store' -L 2 -a -d
to refresh this list
├── .vscode
├── admin-vue
│ ├── mock
│ ├── public
│ ├── src
│ └── tests
├── api
│ ├── src
│ └── test
└── www-v2
├── .storybook
├── api
├── components
├── lib
├── pages
├── static
├── store
├── stories
└── styles