Skip to content

hasnain-saeed/ebazaar-app

Repository files navigation

Ebazaar

Table of Contents

About the Project

Ebazaar is an ecommerce web application which stores and displays products from another ecommerce website and expose an API. There are two kinds of users: Customer and Staff. Customers can view all featured products, brands, categories and their products. Staff users can login to the application and update the product statuses (featured, active and out of stock). A customer can subscribe to a product if it is out of stock and will receive an email once the product item is available.

Built With

  • Django
  • Django Rest Framework
  • React
  • Redux
  • Scrapy
  • Celery

Getting Started

Native Installation

Prerequisites

For backend you need to have python and pip installed. If you don't have them installed on your machine, you can easily follow these shell commands on ubuntu.

$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt update
$ sudo apt install python3.8

To verify

$ python3 --version
Python 3.8.5

Installing virtualenv:

$ sudo apt-get install python3-venv
$ python3 -m venv env
$ source env/bin/activate #Activate virtual environment
$ deactivate #Deactivate virtual environment

For React frontend, you need to have npm and node install globally on your machine. If you don't have them installed, you can follow these commands on ubuntu

$ cd ~
$ curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
$ sudo bash nodesource_setup.sh
$ sudo apt install nodejs

To verify

$ node -v
12.19.0

Backend Installation

Use the package manager pip to install dependencies (preferably in a virtual environment). Repository includes a requirements.txt for your convenience

(env) $ pip install -r requirements.txt

Run

(env) $ python3 manage.py makemigration && python3 manage.py migrate
(env) $ python3 manage.py runserver

Frontend Installation

Change directory to frontend/ebazaar and you can install dependencies by just:

$ npm install

Run

$ npm start

Super User

Since there is no superuser initially, you can create a super user using:

$ python3 manage.py createsuperuser

Using Docker

If you want to avoid the hassle of going through that installation process, you can always use docker. The project makes use of two containers from dockerhub: redis and postgres and project own separate containers for both Django backend and React frontend.

$ sudo docker-compose build

Run

$ sudo docker-compose up

Super User with Docker

$ sudo docker exec -it backend python3 manage.py createsuperuser

Usage

Staff User

Staff user needs to be register and logged in to update product status. In order to get registered, /register endpoint is available on React frontend e.g. http://localhost:3000/register

Staff user status will remain inactive until superuser makes the user active from the admin portal http://localhost:8000/admin

Staff user can then login once its status is active: http://localhost:3000/login

About

Django application and api for ebazaar application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published