Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 

Repository files navigation

⚡ Yashoda Engineers — E-Commerce Website

A full-stack e-commerce website for Yashoda Engineers, a shop selling water motors, electric spray guns, chain saws, compressors, repair parts, hammers, and grinders. Built with React, Spring Boot, and Supabase — featuring an AI-powered product assistant chatbot.


🚀 Features

  • 🛍️ Product Catalog — Browse, search, and filter products by category
  • 🛒 Shopping Cart & Checkout — Add to cart and place orders
  • 👤 Auth System — Login/Signup with Supabase Authentication and JWT
  • 📦 Order Management — View and track your orders
  • 🔧 Repair Booking — Submit repair requests online
  • 🛠️ Admin Dashboard — Manage products, categories, orders, and repair requests
  • 🤖 AI Chatbot — RAG-powered product assistant using Google Gemini AI

🧠 AI Chatbot

The chatbot was built in 3 phases.

Phase 1 — Keyword Search Basic word matching. Customer types "water pump under 6000" and it finds pumps below that price.

Phase 2 — Gemini AI Understands natural language. Customer can type anything like "something for a 2-storey house" and the chatbot understands they need a booster pump. It also remembers the conversation history.

Phase 3 — RAG Vector Search Before asking Gemini, the chatbot converts the customer's question into a vector (3072 numbers representing the meaning) and searches the database for the 5 most similar products. Only those 5 are sent to Gemini — making it faster and smarter.

Example queries the chatbot understands

  • "Water pump for my 2-storey house"
  • "Something for cutting wood under Rs. 10000"
  • "Compare your compressors"
  • "I need to paint my wall"

🛠️ Tech Stack

Frontend

  • React
  • Axios
  • React Router

Backend

  • Spring Boot 3.2.5 with Java 21
  • Spring Security and JWT
  • Hibernate / JPA
  • HikariCP connection pooling

Database

  • Supabase (PostgreSQL)
  • pgvector for AI vector similarity search

AI

  • Google Gemini AI (gemini-2.5-flash) for natural language responses
  • Gemini Embeddings (gemini-embedding-001) for 3072-dimension text vectors

📁 Project Structure

Y_engineer/
├── y_eng_frontend/
│   ├── src/
│   │   ├── components/      # Reusable components (ChatWidget, Navbar, etc.)
│   │   ├── pages/           # Page components (Products, Cart, Dashboard, etc.)
│   │   ├── services/        # api.js
│   │   └── supabaseClient.js
│   └── package.json
│
└── y_eng_backend/
    ├── src/main/java/com/example/y_eng_backend/
    │   ├── controller/      # REST controllers
    │   ├── entity/          # JPA entities
    │   ├── repository/      # Spring Data repositories
    │   ├── service/         # Business logic and AI services
    │   └── security/        # JWT and Spring Security
    ├── src/main/resources/
    │   └── application.properties
    └── pom.xml

⚙️ Setup & Installation

Prerequisites

  • Java 21
  • Node.js 18+
  • Maven
  • Supabase account
  • Google AI Studio account for Gemini API key

1. Clone the repository

git clone https://github.com/your-username/Y_engineer.git
cd Y_engineer

2. Backend Setup

Go into the backend folder.

cd y_eng_backend

Create a .env file inside y_eng_backend/ with the following:

DB_URL=jdbc:postgresql://YOUR_SUPABASE_POOLER_URL:6543/postgres?sslmode=require
DB_USERNAME=postgres.YOUR_PROJECT_REF
DB_PASSWORD=your_supabase_password
JWT_SECRET=YourSecretKeyHere
GEMINI_API_KEY=your_gemini_api_key

⚠️ Never commit the .env file to GitHub. It is already listed in .gitignore.

Run the backend:

./mvnw spring-boot:run

Backend starts at http://localhost:8080


3. Frontend Setup

cd y_eng_frontend
npm install
npm start

Frontend starts at http://localhost:3000

4. Database Setup

Run these two commands in your Supabase SQL Editor:

CREATE EXTENSION IF NOT EXISTS vector;

ALTER TABLE public.products ADD COLUMN IF NOT EXISTS embedding vector(3072);

5. Generate Product Embeddings

This is a one-time setup step. After the backend is running, call this endpoint once using Postman or curl:

curl -X POST http://localhost:8080/api/chat/generate-embeddings

This generates and saves AI embeddings for all products in the database. You only need to run this again if you add new products.


🔑 Environment Variables

DB_URL — Supabase PostgreSQL connection URL. Use port 6543 for pgBouncer pooler.

DB_USERNAME — Supabase database username.

DB_PASSWORD — Supabase database password.

JWT_SECRET — Secret key used for signing JWT tokens.

GEMINI_API_KEY — Google Gemini API key from Google AI Studio.

📡 API Endpoints

Auth

  • POST /api/auth/login — Login and receive JWT token
  • POST /api/auth/register — Register a new user

Products

  • GET /api/products — Get all products
  • GET /api/products/{id} — Get a single product
  • POST /api/products — Create product (admin only)
  • PUT /api/products/{id} — Update product (admin only)
  • DELETE /api/products/{id} — Delete product (admin only)

Categories

  • GET /api/categories — Get all categories

Orders

  • POST /api/orders — Place a new order
  • GET /api/orders/my — Get current user's orders
  • GET /api/orders — Get all orders (admin only)

Repair Requests

  • POST /api/repair-requests — Submit a repair request
  • GET /api/repair-requests — Get all repair requests (admin only)

Chatbot

  • POST /api/chat/query — Send a message to the AI chatbot
  • GET /api/chat/suggestions — Get suggested questions
  • POST /api/chat/generate-embeddings — Generate embeddings for all products

🗄️ Database Tables

  • profiles — User profiles with role (customer or admin)
  • categories — Product categories
  • products — Products with name, price, stock, description, and embedding vector
  • orders — Customer orders
  • order_items — Individual items in each order
  • cart_items — Shopping cart items
  • repair_requests — Repair service requests

🚀 Deployment (Coming Soon)

  • Backend → Railway or Render
  • Frontend → Vercel
  • Database → Already hosted on Supabase

👨‍💻 Developer

Anjana E.H. Student ID: IT23754652 BSc (Hons) Information Technology — Year 3

About

Electric_shop

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages