Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
7b817b5
Add files via upload
RitaJind Sep 10, 2025
4cc760f
Adding temporary changes to Github
RitaJind Sep 10, 2025
55f3259
Add files via upload
RitaJind Sep 10, 2025
3902c45
Static pages
RitaJind Sep 10, 2025
5657235
uploaded imagesMerge branch 'main' of https://github.com/RitaJind/xrw…
RitaJind Sep 10, 2025
3f76020
partial user registration code
RitaJind Sep 10, 2025
d63ce73
Registration Code
RitaJind Sep 10, 2025
5f4eef3
API Endpoints
RitaJind Sep 11, 2025
601a61e
Build CarModel
RitaJind Sep 11, 2025
cec8f18
Code for proxy
RitaJind Sep 11, 2025
df3a2ae
React Pages
RitaJind Sep 12, 2025
2e55d5c
Create main.yml
RitaJind Sep 12, 2025
689571b
Update models.py
RitaJind Sep 12, 2025
818bfd5
Update populate.py
RitaJind Sep 12, 2025
9331e2a
Update restapis.py
RitaJind Sep 12, 2025
c3df062
Update urls.py
RitaJind Sep 12, 2025
47df03f
Update views.py
RitaJind Sep 12, 2025
5ae8526
Update settings.py
RitaJind Sep 12, 2025
8385985
Update urls.py
RitaJind Sep 12, 2025
e79dd76
Update views.py
RitaJind Sep 12, 2025
ab5c281
Create views1.py
RitaJind Sep 12, 2025
eb7023e
Update new views1.py
RitaJind Sep 12, 2025
44fb686
Update views.py
RitaJind Sep 12, 2025
d169efa
Delete server/djangoapp/views1.py
RitaJind Sep 12, 2025
42969a3
Update New1 models.py
RitaJind Sep 12, 2025
9df64b5
Update New1 populate.py
RitaJind Sep 12, 2025
255e502
Update New1 urls.py
RitaJind Sep 12, 2025
8f6b4b4
Update New1 restapis.py
RitaJind Sep 12, 2025
1f62916
Update New2 populate.py
RitaJind Sep 12, 2025
e3463c9
Update New2 models.py
RitaJind Sep 12, 2025
a9b13ec
Update New2 urls.py
RitaJind Sep 12, 2025
6e3c92c
Update New2 views.py
RitaJind Sep 12, 2025
a3d7296
Update New2 settings.py
RitaJind Sep 12, 2025
e764f3b
Update N3 settings.py
RitaJind Sep 12, 2025
778f6a7
Update N4 settings.py
RitaJind Sep 12, 2025
74fdcf5
Update N5 settings.py
RitaJind Sep 12, 2025
5824aef
Update settings.py
RitaJind Sep 12, 2025
4570896
Update settings.py
RitaJind Sep 12, 2025
ecfed35
Update settings.py
RitaJind Sep 12, 2025
607640f
Update 2views.py
RitaJind Sep 12, 2025
028118a
Update 3views.py
RitaJind Sep 12, 2025
28772ac
Update views.py
RitaJind Sep 12, 2025
ffd6ebb
Update views.py
RitaJind Sep 12, 2025
943e88b
Update views.py
RitaJind Sep 12, 2025
2071b94
Update views.py
RitaJind Sep 12, 2025
62b19e4
Update populate.py
RitaJind Sep 12, 2025
f6e34ec
Update populate.py
RitaJind Sep 12, 2025
40a2266
Update populate.py
RitaJind Sep 12, 2025
6a96d19
Update views.py
RitaJind Sep 12, 2025
cb31c34
Update views.py
RitaJind Sep 12, 2025
21f0acf
Update views.py
RitaJind Sep 12, 2025
44c3661
Update views.py
RitaJind Sep 12, 2025
c000e82
Update views.py
RitaJind Sep 12, 2025
d200998
Update populate.py
RitaJind Sep 12, 2025
8821822
Update populate.py
RitaJind Sep 12, 2025
11b8448
Update populate.py
RitaJind Sep 12, 2025
a42cb12
Update urls.py
RitaJind Sep 12, 2025
545990f
Update urls.py
RitaJind Sep 12, 2025
edee361
Update urls.py
RitaJind Sep 12, 2025
8007a39
Update settings.py
RitaJind Sep 12, 2025
b40ec0a
Update models.py
RitaJind Sep 12, 2025
aa60a2a
Update app.js
RitaJind Sep 12, 2025
d5070f9
Create .jshintrc
RitaJind Sep 12, 2025
6f1a034
Update app.js
RitaJind Sep 12, 2025
0f03a41
Update .jshintrc
RitaJind Sep 12, 2025
0087689
Update app.js
RitaJind Sep 12, 2025
5a0a734
Update app.js
RitaJind Sep 12, 2025
08bc762
Create Dockerfile
RitaJind Sep 13, 2025
d3e77d1
Create entrypoint.sh
RitaJind Sep 13, 2025
04cc377
Create deployment.yaml
RitaJind Sep 13, 2025
ac77a45
Update README.md
RitaJind Sep 22, 2025
08bba16
Update settings.py
RitaJind Sep 22, 2025
df826fb
Update settings.py
RitaJind Sep 22, 2025
e0ebe7b
Update requirements.txt
RitaJind Sep 22, 2025
9298a5a
Create build.sh
RitaJind Sep 22, 2025
88a9993
Delete server/Dockerfile
RitaJind Sep 22, 2025
8d10f8c
Create Dockerfile
RitaJind Sep 22, 2025
c787a38
Update LICENSE
RitaJind Sep 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'Lint Code'

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]

jobs:
lint_python:
name: Lint Python Files
runs-on: ubuntu-latest

steps:

- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8

- name: Print working directory
run: pwd

- name: Run Linter
run: |
pwd
# This command finds all Python files recursively and runs flake8 on them
find . -name "*.py" -exec flake8 {} +
echo "Linted all the python files successfully"

lint_js:
name: Lint JavaScript Files
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14

- name: Install JSHint
run: npm install jshint --global

- name: Run Linter
run: |
# This command finds all JavaScript files recursively and runs JSHint on them
find ./server/database -name "*.js" -exec jshint {} +
echo "Linted all the js files successfully"
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 8
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.
1. Definitions as below:

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
Expand Down
93 changes: 92 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,92 @@
# coding-project-template
# 🚗 Car Dealership Network - Full Stack Application

A **full-stack car dealership platform** built with Django, React, Node.js, and MongoDB featuring dealership discovery, customer reviews, and AI-powered sentiment analysis.

![Django](https://img.shields.io/badge/Django-5.0+-green.svg)
![React](https://img.shields.io/badge/React-18+-blue.svg)
![Node.js](https://img.shields.io/badge/Node.js-18+-brightgreen.svg)
![MongoDB](https://img.shields.io/badge/MongoDB-7.0+-darkgreen.svg)
![Python](https://img.shields.io/badge/Python-3.9+-yellow.svg)
![Docker](https://img.shields.io/badge/Docker-24+-blue.svg)

## 🚀 Project Overview

Full-stack microservices application that enables users to explore car dealerships, read and post reviews, and discover vehicle inventory across different locations. Features Django REST API, React frontend, Node.js microservice, and AI-powered sentiment analysis.

**Key Technologies:** Django | React | Node.js | MongoDB | NLTK | Docker

## 📋 Features

**Core Functionality:**
- 🏢 **Dealership Directory** - 50+ dealerships across multiple states with location-based search
- 🚗 **Vehicle Inventory** - Car catalog with make/model management and search filters
- 📝 **Review System** - Customer reviews with AI sentiment analysis (NLTK/VADER)
- 👤 **User Management** - Registration, authentication, and profile management
- 📱 **Responsive Design** - Mobile-optimized interface with Bootstrap styling

## 🏃‍♂️ Quick Start

**Prerequisites:** Python 3.9+, Node.js 18+, MongoDB 7.0+

```bash
# Clone repository
git clone https://github.com/RitaJind/xrwvm-fullstack_developer_capstone.git
cd xrwvm-fullstack_developer_capstone

# Start services (in separate terminals)
# Django backend
cd server && pip install -r requirements.txt && python manage.py runserver

# Node.js database service
cd server/database && npm install && docker-compose up -d && node app.js

# Sentiment analysis
cd server/djangoapp/microservices && pip install -r requirements.txt && python app.py

# React frontend
cd server/frontend && npm install && npm start
```

**Endpoints:** Frontend: http://localhost:3000 | Backend: http://localhost:8000 | Database: http://localhost:3001

## Application Flow

**User Journey:** Homepage → Dealership Listings → Dealer Details → Vehicle Inventory → Review System → User Account

**Admin Features:** Dealership Management, Inventory Control, Review Moderation, User Management, Analytics Dashboard

## 🏗️ Architecture

**Microservices:** React SPA ↔ Django API ↔ Node.js API ↔ MongoDB + Sentiment Analysis Service (Flask/NLTK)

**Tech Stack:** Django 5.0+ | React 18+ | Node.js 18+ | MongoDB 7.0+ | Python 3.9+ | Docker

## API Documentation

**Key Endpoints:**
- `GET /djangoapp/get_dealers/` - Fetch all dealerships
- `GET /djangoapp/get_dealers/{state}/` - Fetch dealerships by state
- `POST /djangoapp/add_review/` - Submit a new review
- `POST /djangoapp/login/` - User authentication
- `GET /dealerships` - Node.js: Get all dealerships
- `POST /reviews` - Node.js: Add new review
- `POST /analyze/{text}` - Sentiment analysis

## 🧪 Testing

```bash
# Backend testing
cd server && python manage.py test djangoapp

# Frontend testing
cd server/frontend && npm test

# API testing
curl -X GET http://localhost:8000/djangoapp/get_dealers/
```

## 👨‍💻 About the Developer

**Rita Jindal** - Full Stack Developer

*Passionate about building modern, user-friendly web applications with clean code and efficient architecture. Experienced in React ecosystem, state management, and responsive design principles.*
22 changes: 22 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.12.0-slim-bookworm

ENV PYTHONBUFFERED 1
ENV PYTHONWRITEBYTECODE 1

WORKDIR /app

# Install the requirements
COPY server/requirements.txt /app/
RUN pip3 install -r requirements.txt

# Copy the rest of the files
COPY . /app/

EXPOSE 8000

# Create entrypoint script
RUN echo '#!/bin/bash\ncd server\npython manage.py migrate\npython manage.py collectstatic --noinput\nexec "$@"' > /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "3", "--chdir", "server", "djangoproj.wsgi"]
9 changes: 9 additions & 0 deletions server/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# exit on error
set -o errexit

cd server
pip install -r requirements.txt

python manage.py collectstatic --no-input
python manage.py migrate
71 changes: 43 additions & 28 deletions server/database/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const express = require('express');
const mongoose = require('mongoose');
const fs = require('fs');
const cors = require('cors')
const app = express()
const cors = require('cors');
const app = express();
const port = 3030;

app.use(cors())
app.use(cors());
app.use(require('body-parser').urlencoded({ extended: false }));

const reviews_data = JSON.parse(fs.readFileSync("reviews.json", 'utf8'));
Expand All @@ -19,21 +19,21 @@ const Reviews = require('./review');
const Dealerships = require('./dealership');

try {
Reviews.deleteMany({}).then(()=>{
Reviews.insertMany(reviews_data['reviews']);
Reviews.deleteMany({}).then(() => {
Reviews.insertMany(reviews_data.reviews);
});
Dealerships.deleteMany({}).then(()=>{
Dealerships.insertMany(dealerships_data['dealerships']);
Dealerships.deleteMany({}).then(() => {
Dealerships.insertMany(dealerships_data.dealerships);
});

} catch (error) {
res.status(500).json({ error: 'Error fetching documents' });
}


// Express route to home
app.get('/', async (req, res) => {
res.send("Welcome to the Mongoose API")
res.send("Welcome to the Mongoose API");
});

// Express route to fetch all reviews
Expand All @@ -58,36 +58,51 @@ app.get('/fetchReviews/dealer/:id', async (req, res) => {

// Express route to fetch all dealerships
app.get('/fetchDealers', async (req, res) => {
//Write your code here
try {
const documents = await Dealerships.find();
res.json(documents);
} catch (error) {
res.status(500).json({ error: 'Error fetching dealerships' });
}
});

// Express route to fetch Dealers by a particular state
app.get('/fetchDealers/:state', async (req, res) => {
//Write your code here
try {
const documents = await Dealerships.find({ state: req.params.state });
res.json(documents);
} catch (error) {
res.status(500).json({ error: 'Error fetching dealerships by state' });
}
});

// Express route to fetch dealer by a particular id
app.get('/fetchDealer/:id', async (req, res) => {
//Write your code here
try {
const document = await Dealerships.find({ id: parseInt(req.params.id) });
res.json(document);
} catch (error) {
res.status(500).json({ error: 'Error fetching dealer by id' });
}
});

//Express route to insert review
app.post('/insert_review', express.raw({ type: '*/*' }), async (req, res) => {
data = JSON.parse(req.body);
const documents = await Reviews.find().sort( { id: -1 } )
let new_id = documents[0]['id']+1
const data = JSON.parse(req.body);
const documents = await Reviews.find().sort({ id: -1 });
let new_id = documents[0].id + 1;

const review = new Reviews({
"id": new_id,
"name": data['name'],
"dealership": data['dealership'],
"review": data['review'],
"purchase": data['purchase'],
"purchase_date": data['purchase_date'],
"car_make": data['car_make'],
"car_model": data['car_model'],
"car_year": data['car_year'],
});
id: new_id,
name: data.name,
dealership: data.dealership,
review: data.review,
purchase: data.purchase,
purchase_date: data.purchase_date,
car_make: data.car_make,
car_model: data.car_model,
car_year: data.car_year,
});

try {
const savedReview = await review.save();
Expand All @@ -100,5 +115,5 @@ app.post('/insert_review', express.raw({ type: '*/*' }), async (req, res) => {

// Start the Express server
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
console.log('Server is running on http://localhost:' + port);
});
2 changes: 1 addition & 1 deletion server/database/data/reviews.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@
"id": 49,
"name": "Jo-anne Szwandt",
"dealership": 7,
"review": "Self-enabling maximized focus group",
"review": "Excellent Dealership! Highly recommended.",
"purchase": true,
"purchase_date": "01/26/2021",
"car_make": "Mercedes-Benz",
Expand Down
1 change: 1 addition & 0 deletions server/database/xrwvm-fullstack_developer_capstone
Submodule xrwvm-fullstack_developer_capstone added at d63ce7
29 changes: 29 additions & 0 deletions server/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: dealership
name: dealership
spec:
replicas: 1
selector:
matchLabels:
run: dealership
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
run: dealership
spec:
containers:
- image: us.icr.io/your-name-space/dealership:latest
imagePullPolicy: Always
name: dealership
ports:
- containerPort: 8000
protocol: TCP
restartPolicy: Always
4 changes: 2 additions & 2 deletions server/djangoapp/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
backend_url =your backend url
sentiment_analyzer_url=your code engine deployment url
backend_url=https://rjindal-3030.theiadockernext-1-labs-prod-theiak8s-4-tor01.proxy.cognitiveclass.ai
sentiment_analyzer_url=https://sentianalyzer.207iqmm6nwv7.us-south.codeengine.appdomain.cloud/
Empty file removed server/djangoapp/__init__.py
Empty file.
9 changes: 5 additions & 4 deletions server/djangoapp/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# from django.contrib import admin
# from .models import related models
from django.contrib import admin
from .models import CarMake, CarModel


# Register your models here.
# Registering models with their respective admins
admin.site.register(CarMake)
admin.site.register(CarModel)

# CarModelInline class

Expand Down
Loading