Skip to content

SIYAM1809/Pet-Shop-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

74 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿพ Pet Shop Management System

A production-ready, full-stack Pet Shop Management System with a premium UI, comprehensive admin dashboard, automated testing, containerization, and a live CI/CD pipeline.


๐Ÿš€ Live Deployment

Service Platform URL
Frontend Vercel pet-shop-management-system-siyam.vercel.app
Backend API Render pet-shop-backend-siyam.onrender.com
API Documentation Swagger UI /api-docs

Demo Credentials โ€” Email: admin@petshop.com ยท Password: admin123


โœจ Features

๐ŸŽฏ Public-Facing

  • ๐Ÿ  Homepage โ€” Hero section, featured pets, testimonials, interactive map
  • ๐Ÿถ Browse Pets โ€” Species/status filters, search, paginated grid view
  • ๐Ÿ“ Pet Inquiries โ€” Contact form with email notification
  • โญ Customer Reviews โ€” Submit & view approved testimonials
  • ๐Ÿ“… Appointment Booking โ€” Schedule shop visits
  • ๐Ÿ“ฆ Order Tracking โ€” Real-time status via order number
  • ๐Ÿ“ง Newsletter โ€” Subscribe for new-pet email alerts

๐Ÿ› ๏ธ Admin Dashboard

  • ๐Ÿ“Š Analytics โ€” Live stats, revenue charts (Recharts), activity feed
  • ๐Ÿ• Pet Management โ€” Full CRUD with grid/list toggle view
  • ๐Ÿ‘ฅ Customer CRM โ€” Customer database with full order history
  • ๐Ÿ›’ Order Processing โ€” Create orders, update status, generate printable invoices
  • โญ Review Moderation โ€” Approve, reject, or delete customer reviews
  • ๐Ÿ“… Appointment Manager โ€” View and action appointment requests
  • ๐Ÿ“ฎ Newsletter Admin โ€” View and manage subscriber list
  • โš™๏ธ Settings โ€” Profile, dark mode, staff account management

๐Ÿ’ก Technical Highlights

  • ๐ŸŒ™ Dark Mode โ€” Full theme support with smooth transitions
  • ๐ŸŽฌ Animations โ€” Framer Motion page transitions & micro-interactions
  • ๐Ÿ“ฑ Responsive โ€” Mobile-first, collapsible sidebar
  • ๐Ÿ” JWT Auth โ€” Role-based access control (Admin / Staff)
  • ๐Ÿ“ง Email Notifications โ€” Nodemailer + Gmail SMTP
  • ๐Ÿ“– Swagger UI โ€” Interactive REST API documentation at /api-docs
  • ๐Ÿงช Test Suite โ€” 41 automated tests (Vitest + React Testing Library)
  • ๐Ÿณ Docker โ€” Multi-stage production builds for both services
  • โš™๏ธ CI/CD โ€” GitHub Actions runs tests on every push

๐Ÿ› ๏ธ Tech Stack

Frontend

Technology Version Purpose
React 19 UI framework
Vite 6 Build tool & dev server
React Router 7 Client-side routing
Framer Motion 12 Animations & transitions
Recharts 2 Charts & analytics
Lucide React โ€” Icon library
React Hot Toast โ€” Toast notifications

Backend

Technology Version Purpose
Node.js 20+ JavaScript runtime
Express 5 Web framework
MongoDB Atlas NoSQL database
Mongoose 8 MongoDB ODM
JWT โ€” Authentication
bcryptjs โ€” Password hashing
Nodemailer โ€” Email notifications
Swagger UI Express โ€” API documentation

DevOps & Testing

Tool Purpose
Vitest Backend & frontend test runner
Supertest Backend integration testing
MongoDB Memory Server In-memory DB for tests (no secrets needed)
React Testing Library Frontend component testing
Docker + Compose Containerization
GitHub Actions CI/CD pipeline (tests + build + lint)
Vercel Frontend deployment
Render Backend deployment

๐Ÿงช Testing

The project includes 41 automated tests across backend and frontend, running in CI on every push.

# Run backend tests (18 integration tests)
cd server && npm test

# Run frontend tests (23 component tests)
cd client && npm test

# Generate coverage report
npm run test:coverage

What's Tested

Backend (supertest + MongoMemoryServer โ€” no real DB required):

  • โœ… Health check endpoint
  • โœ… Auth: login validation, wrong credentials, success, field checking
  • โœ… Pets: public listing, filters, pagination, invalid ID (CastError โ†’ 404)
  • โœ… Protected routes return 401 without token (orders, customers, admin)
  • โœ… Public routes: reviews, newsletter, inquiries

Frontend (React Testing Library + jsdom):

  • โœ… Button โ€” 13 tests (variants, sizes, loading, disabled, onClick, icon)
  • โœ… Card โ€” 10 tests (variants, padding, hover, className, prop forwarding)

๐Ÿณ Docker

Run the entire stack locally with a single command:

# Copy and fill in your environment file
cp .env.docker.example .env

# Start all services (MongoDB + backend + frontend)
docker compose up -d

# Seed the database
docker compose exec backend node seed.js

Then open http://localhost:3000.

# Stop all services
docker compose down

Services

Service Port Description
MongoDB 27017 Database
Backend API 5001 Express server
Frontend 3000 Nginx-served React app

โš™๏ธ CI/CD Pipeline

GitHub Actions runs automatically on every push to main:

Push โ†’ Tests (backend + frontend) โ†’ Lint โ†’ Docker Build โ†’ Deploy (Vercel auto)
Workflow Description
ci.yml Runs 41 tests + Docker build verification
code-quality.yml ESLint checks
docker-publish.yml Publishes Docker images on release tags

๐Ÿš€ Local Development

Prerequisites

  • Node.js 18+ ยท MongoDB (local or Atlas) ยท Gmail account (for email)

Setup

# 1. Clone
git clone https://github.com/SIYAM1809/Pet-Shop-Management-System.git
cd Pet-Shop-Management-System

# 2. Install dependencies
cd server && npm install
cd ../client && npm install

# 3. Configure environment (see below)

# 4. Seed database
cd server && node seed.js

# 5. Run both services
cd server && npm run dev      # Terminal 1 โ†’ http://localhost:5001
cd client && npm run dev      # Terminal 2 โ†’ http://localhost:5173

Environment Variables

server/.env

MONGODB_URI=mongodb://localhost:27017/petshop
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRE=7d
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_EMAIL=your-email@gmail.com
SMTP_PASSWORD=your-app-password   # Gmail App Password
FROM_NAME=Siyam's Praniseba
FROM_EMAIL=your-email@gmail.com
PORT=5001

client/.env

VITE_API_URL=http://localhost:5001/api

Gmail App Password: Google Account โ†’ Security โ†’ 2-Step Verification โ†’ App Passwords


๐Ÿ“ Project Structure

Pet-Shop-Management-System/
โ”œโ”€โ”€ .github/workflows/          # CI/CD pipelines
โ”‚   โ”œโ”€โ”€ ci.yml                  # Tests + Docker build
โ”‚   โ”œโ”€โ”€ code-quality.yml        # ESLint
โ”‚   โ””โ”€โ”€ docker-publish.yml      # Docker Hub publishing
โ”‚
โ”œโ”€โ”€ client/                     # React Frontend (Vite)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/         # Button, Card, Input, Modal, Sidebarโ€ฆ
โ”‚   โ”‚   โ”œโ”€โ”€ context/            # AuthContext, ThemeContext
โ”‚   โ”‚   โ”œโ”€โ”€ pages/              # Admin/ + Public/ pages
โ”‚   โ”‚   โ”œโ”€โ”€ services/api.js     # Centralized API layer
โ”‚   โ”‚   โ””โ”€โ”€ utils/              # Animation variants
โ”‚   โ”œโ”€โ”€ vitest.config.js        # Frontend test config
โ”‚   โ””โ”€โ”€ Dockerfile              # Multi-stage Nginx build
โ”‚
โ”œโ”€โ”€ server/                     # Node.js + Express Backend
โ”‚   โ”œโ”€โ”€ __tests__/api.test.js   # 18 integration tests
โ”‚   โ”œโ”€โ”€ config/                 # DB connection + Swagger spec
โ”‚   โ”œโ”€โ”€ controllers/            # Route handlers (auth, pets, ordersโ€ฆ)
โ”‚   โ”œโ”€โ”€ middleware/             # JWT auth + error handler
โ”‚   โ”œโ”€โ”€ models/                 # Mongoose schemas
โ”‚   โ”œโ”€โ”€ routes/                 # API route definitions
โ”‚   โ”œโ”€โ”€ app.js                  # Express app factory (for testing)
โ”‚   โ”œโ”€โ”€ server.js               # Entry point (starts server)
โ”‚   โ”œโ”€โ”€ seed.js                 # Admin + demo data seeder
โ”‚   โ”œโ”€โ”€ vitest.config.js        # Backend test config
โ”‚   โ””โ”€โ”€ Dockerfile              # Multi-stage Node build
โ”‚
โ””โ”€โ”€ docker-compose.yml          # Full-stack orchestration

๐Ÿ“– API Reference

Full interactive documentation available at /api-docs (Swagger UI).

Quick Reference

Resource Public Admin/Staff
GET /api/pets โœ… List + filter โ€”
POST /api/pets โ€” โœ… Create
PUT /api/pets/:id โ€” โœ… Update
DELETE /api/pets/:id โ€” โœ… Delete
GET /api/reviews โœ… Approved only โ€”
POST /api/auth/login โœ… Login โ€”
POST /api/auth/register โ€” โœ… Admin only
GET /api/orders โ€” โœ… All orders
GET /api/orders/track/:num โœ… Track by # โ€”
GET /api/dashboard โ€” โœ… Analytics
GET /api/health โœ… Health check โ€”

๐Ÿ” Security

  • JWT tokens with configurable expiry
  • bcrypt password hashing (10 salt rounds)
  • Role-based route protection (Admin / Staff)
  • Environment variables for all secrets
  • CORS configured for production origins

๐Ÿค Contributing

git checkout -b feature/your-feature
git commit -m "feat: add your feature"
git push origin feature/your-feature
# Open a Pull Request โ†’ CI runs automatically

๐Ÿ“„ License

MIT License โ€” see LICENSE for details.


Built by SIYAM1809 ยท GitHub Repo

โญ Star this repository if you find it helpful!

Made with โค๏ธ using React, Node.js, Express, and MongoDB

Releases

No releases published

Packages

 
 
 

Contributors

Languages