Skip to content

KSaiPrashanth/Car_Dealership_Full_Stack_App

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Best Cars Dealership Application

best car dealearship

Table of Contents


Introduction

A national car dealership with local branches spread across the United States recently conducted a market survey. One of the suggestions that emerged from the survey was that customers would find it beneficial if they could access a central database of dealership reviews across the country.

You are a new hire at the company. You are assigned the task of building a website that allows new and existing customers to look up different branches by state and look at customer reviews of the various branches. Customers should be able to create an account and add their review for any of the branches. The management hopes this will bring transparency to the system and also increase the trust customers have in the dealership.

After thorough research and brainstorming, the team developed use cases for anonymous, authorized, and admin users.

Use cases for anonymous users:

  1. View the Contact Us page.
  2. View the About Us page.
  3. View the list of dealerships.
  4. Filter the list of dealerships by state:
    1. Select Show all or a specific state from the State dropdown on the dealership page.
    2. View all states if nothing is selected in the dropdown.
    3. View a table of dealerships for the selected state when the form is submitted.
  5. Click on a dealership to view the reviews for that dealership on the details page with each review displayed on a bootstrap card.
  6. Log in using their credentials.

Use cases for authorized users:

In addition to the above, authorized users should be able to write a review for any dealership on the dealership's page. In order to enable authorized users to write their reviews:

  1. A Review button should be provided against each dealer listed in the dealership table.
  2. Clicking on the Review button should take the user to the review page.
  3. Filling the form on the review page and submitting it should add the review.
{
    "user_id": 1, => from Django
    "name": "Berkly Shepley", => from Django
    "dealership": 15, => from the form
    "review": "Total grid-enabled service-desk", => form textbox
    "time": "", => current time
    "purchase": true, => form checkbox
    "purchase_date": "07/11/2020", => form calendar (bootstrap)
    "car_make": "Audi", => from django dropdown
    "car_model": "A6", => from django dropdown
    "car_year": 2010 => form django dropdown
}
  1. On submission, the user should be taken back to the dealership detail page with the submitted review featured at the top of the reviews list, sorted on time.

Use cases for admin users:

  1. Log in to the admin site with a predefined username and password.
  2. Add new make, model, and other attributes.

Architectural Overview

  1. Django Application:

    • Add user management using the Django user authentication system.
    • Create Django models and views to manage car model and car make.
    • Create Django proxy services and views to integrate dealers and reviews together.
  2. React Frontend:

    • Implement user management using the Django user authentication system.
    • Create a React frontend for the application.
  3. Backend Services:

    • Create a Node.js server to manage dealers and reviews using MongoDB.
    • Dockerize the Node.js server.
    • Deploy the sentiment analyzer on Code Engine.
  4. Sentiment Analyzer:

    • Deploy and integrate the sentiment analyzer as a backend service.

Architecture

Detailed Services

The user interacts with the "Dealerships Website", a Django website, through a web browser.

Django Application

The Django application provides the following microservices for the end user:

  • get_cars/ - To get the list of cars.
  • get_dealers/ - To get the list of dealers.
  • get_dealers/:state - To get dealers by state.
  • dealer/:id - To get dealer by id.
  • review/dealer/:id - To get reviews specific to a dealer.
  • add_review/ - To post review about a dealer.

The Django application uses an SQLite database to store the Car Make and the Car Model data.

Dealerships and Reviews Service

The "Dealerships and Reviews Service" is an Express Mongo service running in a Docker container. It provides the following services:

  • /fetchDealers - To fetch the dealers.
  • /fetchDealer/:id - To fetch the dealer by id.
  • /fetchReviews - To fetch all the reviews.
  • /fetchReview/dealer/:id - To fetch reviews for a dealer by id.
  • /insertReview - To insert a review.

"Dealerships Website" interacts with the "Dealership and Reviews Service" through the "Django Proxy Service" contained within the Django Application.

Sentiment Analyzer Service

The "Sentiment Analyzer Service" is deployed on IBM Cloud Code Engine and provides the following service:

  • /analyze/:text - To analyze the sentiment of the text passed. It returns positive, negative, or neutral.

The "Dealerships Website" consumes the "Sentiment Analyzer Service" to analyze the sentiments of the reviews through the Django Proxy contained within the Django application.


Technologies

Frontend Backend Services Other
React Django Docker (for containerization) Python (for the Django application)
Bootstrap (for form and UI components) Node.js Code Engine (for deploying the sentiment analyzer) JavaScript (for the Node.js server and React frontend)
MongoDB

Installation

1. Clone the repository

git clone https://github.com/KSaiPrashanth/Car_Dealership_Full_Stack_App
cd Car_Dealership_Full_Stack_App/server

2. Set up virtual environment for your Django application to run

pip install virtualenv
virtualenv djangoenv
source djangoenv/bin/activate

3. Install necessary Python packages in your virtual environment

python3 -m pip install -U -r requirements.txt

4. Perform migrations to create necessary tables

python3 manage.py makemigrations
python3 manage.py migrate --run-syncdb

5. Start the local development server

python3 manage.py runserver

best car dealearship landing page


Node.js Mongo DB Dockerized Server

1. Open a new terminal, Change to the directory with the data files.

cd Car_Dealership_Full_Stack_App/server/database

2. Run the following command to build the Docker app.

docker build . -t nodeapp

3. The docker-compose.yml has been created to run two containers, one for Mongo and the other for the Node app. Run the following command to run the server:

docker-compose up

Run Client-side (REACT for Dynamic pages)

Open a new terminal and build your client by running the following commands:

cd Car_Dealership_Full_Stack_App/server/frontend
npm install
npm run build

Create Django Proxy Services of Backend APIs

1. Start code engine by creating a project.

Code Engine

2. Once the code engine set up is complete, you can see that it is active. Click on Code Engine CLI to begin the pre-configured CLI in the terminal below.

Active Code Engine


Deploy sentiment analysis on Code Engine as a microservice

1. In the code engine CLI, change to server/djangoapp/microservices directory.

cd Car_Dealership_Full_Stack_App/server/djangoapp/microservices

2. Run the following command to docker build the sentiment analyzer app

docker build . -t us.icr.io/${SN_ICR_NAMESPACE}/senti_analyzer

3. Push the docker image by running the following command.

docker push us.icr.io/${SN_ICR_NAMESPACE}/senti_analyzer

4. Deploy the senti_analyzer application on code engine.

ibmcloud ce application create --name sentianalyzer --image us.icr.io/${SN_ICR_NAMESPACE}/senti_analyzer --registry-secret icr-secret --port 5000

5. Open djangoapp/.env and replace your code engine deployment url with the deployment URL you obtained above.

It is essintial to include / at the end of the URL. Please ensurethat it is copied

sentiment_analyzer_url=your code engine deployment url

Sentiment analyzer on a review from client

Dealer review

About

IBM Full Stack Application Development Capstone Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 36.1%
  • Python 33.1%
  • HTML 16.8%
  • CSS 12.2%
  • Dockerfile 1.4%
  • Shell 0.4%