Skip to content

Instantly share code, notes, and snippets.

View basir's full-sized avatar

Bassir Jafarzadeh basir

View GitHub Profile
@basir
basir / deploy-nextjs-ecommerce-on-hostiger.md
Last active October 18, 2024 20:37
deploy-nextjs-ecommerce-on-hostinger

Intro

hello and welcome to my coding tutorial to build and deploy my nextjs e-commerce website on Linux Ubuntu operating system using Hostinger VPS server.

In this tutorial we will learn how to:

  • buy and configure VPS server and website domain on hostinger
  • clone my main amazona project from GitHub
  • connect to the hostinger Linux server
  • build and deploy automatically applications on every git push
@basir
basir / amazona-features.md
Last active March 9, 2024 06:19
Amazona Features

Dynamic Currency Support

There are a lot of features that we want to add to Amazona (An ecommerce website like amazon). Please vote for your features in the comment to prioritize them.

Dynamic currency

user should be able to change the currency.

  1. in site setting, admin define list of currency and the conversion ratio against the main currency
  2. in the site header, user can change the currency
  3. all price in the website accept the selected currency and update the price amount based on the conversion ratio.
import React, { useEffect, useState } from 'react';
import axios from 'axios';
import { loadStripe } from '@stripe/stripe-js/pure';
import StripeCheckout from '../components/StripeCheckout';
function OrderScreen(props) {
const [stripe, setStripe] = useState(null);
const dispatch = useDispatch();

Module not found: Error: Can't resolve 'fs'

add this line at the top of the file: import fs from 'fs';

Delete images on heroku after upload

it is because of heroku policy for free dyno. It delete all files after 30 mins idle. if you want to keep them you need to buy a paid dyno. get it from here: https://www.heroku.com/pricing

URL it is /product/undefined

Check why the product link does not contain the product id in HomeScreen.js and Product.js component.

import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { PayPalButton } from 'react-paypal-button-v2';
import { Link } from 'react-router-dom';
import axios from 'axios';
import { detailsOrder, payOrder, deliverOrder } from '../actions/orderActions';
import MessageBox from '../components/MessageBox';
import LoadingBox from '../components/LoadingBox';
import {
ORDER_PAY_RESET,

MERN Marketplace

Hello and Welcome to my coding course to build a multi-vendor ecommerce website by MERN stack. In this course you will learn the essential tools and skills to design, develop and deploy a fully-function marketplace website using React and Redux in frontend and Node and MongoDB in backend.

What You Will Learn

This is a practical coding course and we are gonna learn and build lots of stuff in this multi-vendor ecommerce website like:

  • create functional component by react
  • use react hooks to handle form inputs
  • manage application state by redux using custom hooks

Multi-Vendors (Sellers dashboard)

As a seller, I can sell my own products Senario:

  1. Click Become Seller on header menu
  2. Sign-in or Registr as seller
  3. Show seller dashboard including products and orders
  4. Manage products
  5. Manage orders
  6. Seller page as /seller/:sellerId
  7. Manage commissions and payouts

Amazona FAQ

If you can not find you question, put it as comment below. I will answer it and add it to the list.

Home Screen

TypeError: Cannot read property 'map' of undefined HomeScreen

It means that products is null. check the value of products when loading = true, It should be empty array [] Also, check the value of products when loading = false, It should be products array.

@basir
basir / Random-Number-Game.html
Created December 6, 2019 13:21
Random-Number-Game
<!DOCTYPE html>
<html>
<head> </head>
<body>
<script>
const max = 5,
min = 1,
prevGuesses = [];
let secretNum = null,