Store Rating System
Project Documentation
Comprehensive guide covering system architecture, API reference,
user roles & setup instructions.
9
Total Users
5
Total Stores
10
Total Ratings
3
User Roles
Version 1.0.0 · React + Node.js · June 2026
Project Overview
What is it?
A full-stack web application that allows customers to discover stores, submit ratings, and provide feedback.
Store owners monitor performance through a dedicated dashboard, while administrators manage the entire platform — users, stores, and ratings — from a single control panel.
Multi-role Auth
Separate JWT flows for User, Admin & Owner
Real-time Ratings
1–5 star system; average computed instantly
Search & Sort
Full-text search with name & rating sort
Admin Control
Add users, stores, assign owners & view stats
System Architecture
Frontend
React.js
UI rendering, routing, state management
Backend
Node.js + Express
REST API, business logic, auth middleware
Database
MySQL / PostgreSQL
Persistent data storage for users, stores, ratings
Auth
JWT Tokens
Stateless session management across roles
Request Flow
① Browser loads React app
② POST /api/auth/login → JWT
③ Auth header attached
④ verifyToken middleware
⑤ Role guard check
⑥ DB query → JSON
⑦ UI state re-renders
User Roles & Permissions
USER
Normal User
Browse all stores, search by name, sort results, and submit 1–5 star ratings. Can update own password. No admin/owner access.
OWNER
Store Owner
View Owner Dashboard: average rating, total review count, and breakdown of all individual ratings with reviewer names.
ADMIN
Administrator
Full control: add users (with role assignment), add stores, assign owners, view platform-wide stats and all registered users.
Permission
User
Owner
Admin
Features & Modules
Authentication
Store Listing
Owner Dashboard
Admin Panel
API Reference
All endpoints prefixed with /api · Protected routes require Authorization: Bearer <token>
Auth Endpoints
POST
/auth/login
Login for user/admin/owner
Public
POST
/auth/signup
Register a new normal user
Public
PUT
/auth/password
Update own password
JWT
Stores Endpoints
GET
/stores
List all stores (search, sort)
JWT
POST
/stores
Create a new store
Admin
GET
/stores/:id
Get single store details
JWT
GET
/stores/:id/ratings
Get all ratings for a store
Owner/Admin
Ratings Endpoints
POST
/ratings
Submit or update a rating (1-5)
User
GET
/ratings/my
Get current user's own ratings
User
Admin Endpoints
GET
/admin/stats
Platform statistics summary
Admin
GET
/admin/users
List all users with details
Admin
POST
/admin/users
Create a new user with role
Admin
Database Schema
USERS
id
INT
PK, AUTO_INCREMENT
name
VARCHAR(60)
NOT NULL (min 20, max 60)
VARCHAR(100)
UNIQUE, NOT NULL
password
VARCHAR(255)
Bcrypt hashed
address
VARCHAR(400)
Max 400 chars
role
ENUM
user | admin | owner
created_at
TIMESTAMP
DEFAULT NOW()
STORES
id
INT
PK, AUTO_INCREMENT
name
VARCHAR(60)
NOT NULL (min 20, max 60)
VARCHAR(100)
UNIQUE, NOT NULL
address
VARCHAR(400)
NOT NULL
owner_id
INT
FK → users.id
created_at
TIMESTAMP
DEFAULT NOW()
RATINGS
id
INT
PK, AUTO_INCREMENT
user_id
INT
FK → users.id
store_id
INT
FK → stores.id
rating
TINYINT
CHECK (1-5)
created_at
TIMESTAMP
DEFAULT NOW()
updated_at
TIMESTAMP
ON UPDATE NOW()
Foreign Keys: ratings.user_id → users.id · ratings.store_id → stores.id · stores.owner_id → users.id
Setup & Installation
Prerequisites
Node.js
>= 16.x
npm
>= 8.x
MySQL/PostgreSQL
8.0 / 14
Git
Any
Installation Steps
1
Clone Repository
git clone <repo-url>
cd store-rating-system
2
Backend Dependencies
cd backend && npm install
3
Configure .env
DB_HOST, DB_USER, DB_PASS
JWT_SECRET, PORT=5000
4
Run Migrations
npm run migrate
npm run seed # optional
5
Start Backend
npm start # localhost:5000
6
Frontend
cd ../frontend && npm install
npm start # localhost:3000
Tech Stack
Frontend
React.js 18.x
Component-based UI framework
React Router 6.x
Client-side routing & navigation
Axios 1.x
HTTP client for API requests
CSS3
Custom styling, flexbox layout
Backend
Node.js 18.x
JavaScript server runtime
Express.js 4.x
Minimal web framework for REST API
jsonwebtoken 9.x
JWT creation and verification
bcryptjs 2.x
Password hashing & comparison
cors 2.x
Cross-origin resource sharing
Database
MySQL 8.x
Primary relational database
mysql2 3.x
Node.js MySQL driver (Promise API)
All API endpoints return JSON · Error responses: { "error": "message" } · Version 1.0.0
Thank You
Store Rating System · v1.0.0
Author: Sanket Morde · June 2026