Skip to content

A comprehensive full-stack web application for store rating and management system with role-based access control.

Notifications You must be signed in to change notification settings

adarsh47-bug/Store-Rating-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸͺ Store Rating System

Live Demo React Express MySQL TypeScript

A comprehensive full-stack web application for store rating and management system with role-based access control.

🎯 Project Overview

The Store Rating System is a modern web application built as part of a FullStack Intern Coding Challenge. It enables users to submit ratings (1-5 stars) for registered stores with a sophisticated role-based authentication system supporting three distinct user types: System Administrators, Normal Users, and Store Owners.

🌟 Key Features

  • πŸ” Role-Based Authentication: Secure login system with JWT tokens
  • ⭐ Store Rating System: Interactive 1-5 star rating functionality
  • πŸ“Š Admin Dashboard: Comprehensive analytics and user management
  • πŸ” Advanced Search & Filtering: Search stores by name, address, and ratings
  • πŸ“± Responsive Design: Mobile-first design with TailwindCSS
  • πŸš€ Real-time Updates: Dynamic rating calculations with database triggers
  • πŸ›‘οΈ Security First: Input validation, password hashing, and CORS protection

πŸŽ₯ Live Demo

πŸ”— Visit Live Application

πŸ§ͺ Test Accounts

Role Email Password Access Level
System Admin admin@storerating.com Password123! Full system access
Store Owner owner@techmart.com Password123! Store management
Normal User demouser@xyz.com Demo@123 Rating & browsing

πŸ› οΈ Tech Stack

Frontend

  • βš›οΈ React.js 18+ with TypeScript
  • 🎨 TailwindCSS for responsive styling
  • 🧭 React Router Dom for client-side routing
  • πŸ“‘ Axios for API communication
  • ⚑ Vite for fast development and building

Backend

  • πŸš€ Express.js with TypeScript
  • πŸ”’ JWT authentication & authorization
  • πŸ›‘οΈ bcryptjs for password hashing
  • βœ… express-validator for input validation
  • πŸ”§ CORS & Helmet for security

Database

  • 🐬 MySQL 8.0+ with connection pooling
  • ☁️ Aiven Cloud for production database hosting
  • πŸ”„ Database Triggers for automatic rating calculations

DevOps & Deployment

  • 🌐 Render for frontend hosting
  • ☁️ Cloud Platform for backend deployment
  • πŸ”„ GitHub Actions ready for CI/CD

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚   React.js      │◄──►│   Express.js    │◄──►│   MySQL DB      β”‚
β”‚   Frontend      β”‚    β”‚   Backend API   β”‚    β”‚   Database      β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                        β”‚                        β”‚
        β”‚                        β”‚                        β”‚
   TailwindCSS            JWT + Validation         Triggers + Indexes
   React Router            CORS + Helmet           Connection Pool

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • MySQL 8.0+ database
  • Git for version control

1️⃣ Clone Repository

git clone https://github.com/adarsh47-bug/Store-Rating-System.git
cd Store-Rating-System

2️⃣ Backend Setup

cd backend

# Install dependencies
npm install

# Configure environment variables
cp .env.example .env
# Edit .env with your database credentials

# Setup database and sample data
npm run setup-db

# Build and start development server
npm run build
npm run dev

3️⃣ Frontend Setup

cd ../frontend

# Install dependencies
npm install --legacy-peer-deps

# Configure environment variables
cp .env.example .env
# Update VITE_API_URL if needed

# Start development server
npm start

4️⃣ Access Application

πŸ‘₯ User Roles & Permissions

πŸ”± System Administrator

  • βœ… User Management: Create/view users and admins
  • βœ… Store Management: Add and manage all stores
  • βœ… Analytics Dashboard: View comprehensive statistics
  • βœ… Advanced Filtering: Filter by name, email, address, role
  • βœ… User Details: Access detailed user information and ratings

πŸ‘€ Normal User

  • βœ… Self Registration: Sign up with email verification
  • βœ… Store Discovery: Browse and search stores
  • βœ… Rating System: Submit and modify ratings (1-5 stars)
  • βœ… Profile Management: Update password and personal info
  • βœ… Search & Filter: Find stores by name and address

πŸͺ Store Owner

  • βœ… Store Dashboard: View store analytics and ratings
  • βœ… Rating Insights: See who rated their store
  • βœ… Average Rating: Real-time store rating calculations
  • βœ… Profile Management: Update password and store info

πŸ“‹ API Documentation

πŸ” Authentication Endpoints

POST /api/auth/login        # User login
POST /api/auth/register     # User registration
GET  /api/auth/profile      # Get user profile
PUT  /api/auth/password     # Update password

πŸ‘‘ Admin Endpoints

GET  /api/admin/dashboard   # Admin dashboard data
POST /api/admin/users       # Create new user
GET  /api/admin/users       # List all users
POST /api/admin/stores      # Create new store
GET  /api/admin/stores      # List all stores

πŸ‘€ User Endpoints

GET  /api/user/stores       # List stores for rating
POST /api/user/ratings      # Submit store rating
GET  /api/user/ratings      # Get user's ratings

πŸͺ Store Owner Endpoints

GET  /api/store-owner/dashboard  # Store dashboard
GET  /api/store-owner/ratings    # Store ratings details
GET  /api/store-owner/summary    # Rating summary

πŸ›‘οΈ Security Features

  • πŸ”’ JWT Authentication: Secure token-based authentication
  • πŸ” Password Hashing: bcryptjs with salt rounds
  • βœ… Input Validation: Comprehensive form validation
  • πŸ›‘οΈ CORS Protection: Cross-origin resource sharing control
  • 🚫 SQL Injection Prevention: Parameterized queries
  • πŸ”‘ Role-Based Access: Route-level permission control

πŸ“Š Database Schema

Users Table

- id (Primary Key)
- name (20-60 characters)
- email (Unique, validated)
- password (Hashed, 8-16 chars with uppercase & special char)
- address (Max 400 characters)
- role (system_admin/normal_user/store_owner)
- status (Active/Inactive)
- created_at, updated_at

Stores Table

- id (Primary Key)
- name, email, address
- owner_id (Foreign Key to Users)
- average_rating (Auto-calculated)
- total_ratings (Auto-calculated)
- status, created_at, updated_at

Ratings Table

- id (Primary Key)
- user_id, store_id (Foreign Keys)
- rating (1-5, validated)
- status, created_at, updated_at
- Unique constraint: one rating per user per store

πŸ“ Form Validations

Field Validation Rules
Name 20-60 characters, required
Email Valid email format, unique
Password 8-16 chars, 1 uppercase, 1 special character
Address Maximum 400 characters
Rating Integer between 1-5

🎨 UI/UX Features

  • πŸ“± Responsive Design: Mobile-first approach
  • 🎯 Interactive Components: Star ratings, modals, tables
  • πŸ” Search & Filter: Real-time search functionality
  • πŸ“Š Data Visualization: Rating charts and statistics
  • 🎨 Modern UI: Clean, professional interface
  • β™Ώ Accessibility: ARIA labels and keyboard navigation

πŸš€ Deployment

Frontend (Render)

# Build command
npm run build

# Publish directory
./dist

# Environment Variables
VITE_API_URL=your_backend_url

Backend (Cloud Platform)

# Build command
npm run build

# Start command
npm start

# Environment Variables
DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME
JWT_SECRET, FRONTEND_URL

πŸ“ž Contact

Developer: Adarsh Kadam
GitHub: @adarsh47-bug
Project: Store Rating System


⭐ Star this repository if you found it helpful!

🌐 Live Demo β€’ πŸ“– Documentation β€’ πŸ› Report Bug β€’ πŸ’‘ Feature Request

About

A comprehensive full-stack web application for store rating and management system with role-based access control.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published