Skip to content

An online marketplace application covering core aspects, such as support for seller accounts, product listings, a shopping cart for customers, and payment processing

Notifications You must be signed in to change notification settings

soumanpaul/E-commerce-web-app

Repository files navigation

Marketpalce

Current Version build status npm version GitHub Stars GitHub Issues

About the project

Application will allow users to become sellers, who can manage multiple shops, and add the products they want to sell in each shop. Users who visit MERN Marketplace will be able to search for and browse products they want to buy, and add products to their shopping cart to place an order

Index


Demo

Live Demo

API Documentatioin here

Extensive API documentation with examples here


Features

  • Sign up: Users can register by creating a new account using an email address
  • User list: Any visitor can see the list of all registered users
  • Authentication: Registered users can sign in and sign out
  • Protected user profile: Only registered users can view individual user details after signing in
  • Authorized user edit and delete: Only a registered and authenticated user can edit or remove their own user account details
  • Users with seller accounts
  • Shop management
  • Product management
  • Product search by name and category
  • Shopping cart
  • Payment processing with Stripe
  • Order management

Built With


Installation

Running Locally

Make sure you have Node.js and npm installed.

  1. Clone or Download the repository

    $ git clone https://github.com/soumanpaul/Developers-Profile-web-app
    $ cd Developers-Profile-web-app
    
  2. Install Dependencies

    • run this commend in project directory
      $ npm install
    
    • run this commend in client directory
      $ yarn install
    
  3. Edit configuration file in /config/default.json with your credentials(see Setup Configurations).

  4. Start the application

  • To run both frontend and backend server together run :

    $ npm run dev
    

Your app should now be running on localhost:3000.

Deploying to Heroku

Make sure you have the Heroku Toolbelt installed.

  1. Create a new Heroku application, and push your chat application to a Git remote repository

    $ heroku create
    $ git push heroku master
    

    or

    Deploy to Heroku

  2. Now, you need to set up configuration variables on Heroku.

    1. Go to Settings -> Reveal Config Vars.
    2. Add configuration variables. All needed variables are inside app/config/index.js. Typically, these are the configuration variables you need to assign: { dbURI, sessionSecret, facebookClientID, facebookClientSecret, twitterConsumerKey, twitterConsumerSecret }(see Setup Configurations).
  3. Open your chat application in the browser

    $ heroku open
    

How It Works

Setup Configurations

The configurations on production will be assigned from Environment Variables on Heroku, while the development configurations reside inside app/config/config.json file.

MongoDB & MongoLab

You need to create a database on MongoLab, then create a database user, get the MongoDB URI, and assign it to dbURI.

Facebook & Twitter

You need to register a new application on both Facebook and Twitter to get your tokens by which users can grant access to your application, and login using their social accounts.

Registering the app on Facebook
  1. Go to Facebook Developers
  2. Add new app, and fill the required information.
  3. Get your App ID, App Secret.
  4. Go to Add Product -> Facebook Login -> Valid OAuth redirect URIs
  5. Add Valid Callback URIs
  6. Go to App Review -> Make your application public.

Now, you can assign the App ID to facebookClientID, and App Secret to facebookClientSecret.

Registering the app on Twitter
  1. Go to Twitter Apps
  2. Create new app, and fill the required information.
  3. Add Website & Callback URL
  4. Get your Consumer Key, Consumer Secret.

Now, you can assign the Consumer Key to twitterConsumerKey, and Consumer Secret to twitterConsumerSecret.

The Callback URL

Session

The session needs a random string to make sure the session id in the browser is random. That random string is used to encrypt the session id in the browser, Why? To prevent session id guessing.

Database

Mongoose is used to interact with a MongoDB that's hosted by MongoLab.

Schemas

There are two schemas; users and rooms.

Each user has a username, passowrd, social Id, and picture. If the user is logged via username and password, then social Id has to be null, and the if logged in via a social account, then the password will be null.

Each room has a title, and array of connections. Each item in the connections array represents a user connected through a unique socket; object composed of {userId + socketId}. Both of them together are unique.

Models

Each model wraps Mongoose Model object, overrides and provides some methods. There are two models; User and Room.

Session

Session in Express applications are best managed using express-session package. Session data are stored locally on your computer, while it's stored in the database on the production environment. Session data will be deleted upon logging out.

User Authentication

User can login using either a username and password, or login via a social account. User authentication is done using Passport. Passport has extensive, and step-by-step documentation on how to implement each way of authentication.

Support

I've written this script in my free time during my studies. If you find it useful, please support the project by spreading the word.

Contribute

Contribute by creating new issues, sending pull requests on Github or you can send an email at: paulchsouman@gmail.com

License

Built under MIT license.

  • Version: 1.0.0
  • License: MIT
  • Author: Souman Paul

About

An online marketplace application covering core aspects, such as support for seller accounts, product listings, a shopping cart for customers, and payment processing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published