This is e-commerce project (online store)
We learn how to make an online store. During creation, we encountered a problem: Github is full of “helloworld” level tutorials, there are no examples of PRODUCTION READY, a well-designed application on which you can understand how to make your application better. We want to make an application using the current best practices and share it with community. We will accept any help with joy.
We use trello as task tool (right now it has tasks only on Russian but we can start using english only)
- express
- sequelize
- redis
- nunjucks
- Fully working MVP of store
- split project into "frontend server and api server"
- split "frontend server" and "administration section"(CRM\CMS) and rewrite it with vue.js
- add vue and SSR to frontend server
- performance optimizations
We adhere to the JSON.API standard, but, you know...
- session based cart, cart calculator
- mailing for new users, order and so on
- multi auth with passport.js
example: login\password: shop_server\shop_server_db
foo@bar:~$ sudo apt update
foo@bar:~$ sudo apt install postgresql postgresql-contrib
foo@bar:~$ sudo -u postgres createuser --interactive // type shop_server
Enter name of role to add: shop_server
Shall the new role be a superuser? (y/n) y
foo@bar:~$ sudo -u postgres createdb shop_server_db // creating db
foo@bar:~$ sudo adduser shop_server //create linux user with password shop_server
Добавляется пользователь «shop_server» ...
Добавляется новая группа «shop_server» (1001) ...
Добавляется новый пользователь «shop_server» (1001) в группу «shop_server» ...
Создаётся домашний каталог «/home/shop_server» ...
Копирование файлов из «/etc/skel» ...
Новый пароль :
Повторите ввод нового пароля :
passwd: пароль успешно обновлён
Изменение информации о пользователе shop_server
Введите новое значение или нажмите ENTER для выбора значения по умолчанию
Полное имя []:
Номер комнаты []:
Рабочий телефон []:
Домашний телефон []:
Другое []:
Данная информация корректна? [Y/n] y
foo@bar:~$ sudo -u shop_server psql shop_server_db // enter in postgress console
psql (12.1 (Ubuntu 12.1-1.pgdg19.04+1), server 11.6 (Ubuntu 11.6-1.pgdg19.04+1))
Type "help" for help.
shop_server_db=# in postgress console:
shop_server_db=# \password shop_server (change password to "shop_server")2. Install pgAdmin or DBeaver 6.1.5 ;)
3. Install Redis
foo@bar:~$ sudo apt-get install redis-server
foo@bar:~$ sudo systemctl enable redis-server.service
foo@bar:~$ sudo snap install redis-desktop-managerLinux Mint users have to add export PATH=$PATH:/snap/bin into .bashrc
if you dont have icons in apps menu:
foo@bar:~$ sudo ln -s /var/lib/snapd/desktop/applications/ /usr/share/applications/snap (if you dont get icons in search menu)4. Install NVM
foo@bar:~$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
After NVM installation complete tell NVM to install current version:
foo@bar:~$ nvm install nodeor install latest version:
foo@bar:~$ nvm install --ltsyou can change default node version
foo@bar:~$ nvm alias defaultInstall dependencies from package.json
foo@bar:~$ npm installor
Install dependencies from package-lock.json
foo@bar:~$ npm ci6. Install Gulp
foo@bar:~$ npm install --global gulpnpm rebuild node-sass --force
foo@bar:~$ gulpfoo@bar:~$ npm run seedmaybe switch sequelize to objection.js
sudo apt-get install build-essentialnode-express-sequelize-postgresql-association GIST
find process and kill it
foo@bar:~$ sudo netstat -nlp | grep :3000
foo@bar:~$ kill -9 process_id
foo@bar:~$ fuser -k 3000/tcphttps://www.tutorialspoint.com/expressjs/expressjs_restful_apis.htm
One day we will use full power of migrations https://gist.github.com/vapurrmaid/a111bf3fc0224751cb2f76532aac2465
npx sequelize-cli migration:generate --name [modelname]
npx sequelize-cli seed:generate --name users
npx sequelize-cli seed:create --name my-seed-file
npx sequelize-cli db:seed:all
npx sequelize-cli db:seed:undo:all
npx sequelize-cli db:seed:undo --seed name-of-seed-as-in-data
npx sequelize-cli db:seed --seed 20191011121208-update-feature.js
Nice advanced seeding https://medium.com/@edtimmer/sequelize-associations-basics-bde90c0deeaa