Giter Site home page Giter Site logo

ashraf-kabir / mern-ecommerce Goto Github PK

View Code? Open in Web Editor NEW
212.0 3.0 53.0 617 KB

MERN Stack ecommerce site

Home Page: https://ecommerce-ak.herokuapp.com/

License: MIT License

JavaScript 97.78% HTML 0.89% CSS 1.33%
ecommerce mern-ecommerce node-js react-js express-js mongodb-database

mern-ecommerce's Introduction

mern-ecommerce

Frontend-> React JS

Backend-> Node JS & Express JS

Database-> MongoDB

Installation process

  1. clone the repo using this command

    git clone https://github.com/ashraf-kabir/mern-ecommerce.git
  2. install npm packages

    1. install backend packages
    cd mern-ecommerce
    npm install
    1. install frontend packages
    cd client
    npm install
  3. go to the parent folder of mern-ecommerce & create .env for connection, JWT_SECRET, BRAINTREE_MERCHANT_ID, BRAINTREE_PUBLIC_KEY and BRAINTREE_PRIVATE_KEY.

    cd mern-ecommerce
    sudo nano .env

    (ctrl+x to save & nano follow instruction there)

    sample code for backend .env
    MONGODB_URI=YOUR_MONGODB_URI
    JWT_SECRET=YOUR_JWT_SECRET
    BRAINTREE_MERCHANT_ID=YOUR_BRAINTREE_MERCHANT_ID
    BRAINTREE_PUBLIC_KEY=YOUR_BRAINTREE_PUBLIC_KEY
    BRAINTREE_PRIVATE_KEY=YOUR_BRAINTREE_PRIVATE_KEY
  4. create another .env file inside client directory for REACT_APP_API_URL.

    cd mern-ecommerce/client
    sudo nano .env
    sample code for frontend .env
    REACT_APP_API_URL=YOUR_API_URL
    Instructions:
    1. for mongodb atlas database creation follow this tutorial->https://www.youtube.com/watch?v=KKyag6t98g8
    2. you can use any random string as JWTSECRET
    3. for localhost REACT_APP_API_URL is http://localhost:5000/api but for heroku (server deployment) it will be different
    4. note: add .env on .gitignore

    5. for server deployment use secrets directly
  5. deploy this project on your local server by using this command

    cd mern-ecommerce
    npm run dev

    note: both backend & frontend server will start at once with the above command.

  6. Database Structure: (Table: columns)

    1. categories: _id, name, createdAt, updatedAt;
    2. orders: _id, status, products (Array), transaction_id, amount, address, user (Object), createdAt, updatedAt
    3. products: _id, photo (Object), sold, name, description, price, category, shipping, quantity, createdAt, updatedAt
    4. users: _id, role, history (Array), name, email, salt, hashed_password, createdAt, updatedAt

App Description:

1. user can view all products
2. user can view single product
3. user can search products and view products by category and price range
4. user can add to cart checkout products using credit card info
5. user can register & sign in
6. admin can create, edit, update & delete products
7. admin can create categories
8. admin can view ordered products
9. admin can change the status of a product (processing, shipped, delivered, etc.)
  1. Deployed on: (No longer available due to heroku free dyno plan has deprecated)
    https://ecommerce-ak.herokuapp.com/
  2. raise a star to support me

mern-ecommerce's People

Contributors

ashraf-kabir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mern-ecommerce's Issues

not able to npm run dev

It gives the following error:

[email protected] dev
concurrently "npm run server" "npm run client"

[0]
[0] > [email protected] server
[0] > nodemon server.js
[0]
[1]
[1] > [email protected] client
[1] > npm start --prefix client
[1]
[0] [nodemon] 2.0.22
[0] [nodemon] to restart at any time, enter rs
[0] [nodemon] watching path(s): .
[0] [nodemon] watching extensions: js,mjs,json
[0] [nodemon] starting node server.js
[0] Server is running on port 3000
[0] The uri parameter to openUri() must be a string, got "undefined". Make sure the first parameter to mongoose.connect() or mongoose.createConnection() is a string.
[0] [nodemon] app crashed - waiting for file changes before starting...
[1]
[1] > [email protected] start
[1] > react-scripts start
[1]
[1] Something is already running on port 3000.
[1] npm run client exited with code 0

Admin role.?

Bro, how to access admin role. Unable to understand to access it, even i seen ur previous issues about it. After signin i seen i had login like user but not admin.. If i check in mongodb, it shows role as 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.