Skip to content

harshchill/boiler-plate

Repository files navigation

πŸš€ RentalHub - Modern E-Commerce Platform

Version License Status

A powerful, modern, and scalable e-commerce rental platform built with cutting-edge web technologies. Designed for seamless multi-role support including Customers, Vendors, and Administrators.

Live Demo β€’ Documentation β€’ Support


✨ Key Features

πŸ‘₯ Multi-Role System

  • Customers - Browse, rent, and manage orders
  • Vendors - Sell and manage rental inventory
  • Administrators - Oversee platform, approve products, and manage users

πŸ›οΈ E-Commerce Excellence

  • Product Catalog - Browse and search rental items
  • Smart Pricing - Hourly rental pricing strategy
  • Inventory Management - Real-time stock tracking
  • Shopping Cart - Add, modify, and manage items
  • Secure Checkout - PCI-compliant payments

πŸ“¦ Order Management

  • Order Tracking - Real-time order status updates
  • Delivery Options - COD and Pickup support
  • Invoice Generation - Automated invoice creation
  • Order History - Complete transaction records

🎯 Vendor Dashboard

  • Product Management - Add, edit, manage rental items
  • Order Fulfillment - Track and process customer orders
  • Analytics & Reports - Revenue insights and performance metrics
  • Customer Communication - Direct vendor-customer interface

πŸ” Security & Authentication

  • NextAuth Integration - Secure JWT-based authentication
  • Password Encryption - bcryptjs hashing
  • Role-Based Access Control - Route protection by user role
  • GSTIN Tracking - GST compliance for vendors

πŸ“± Modern UI/UX

  • Responsive Design - Mobile-first approach
  • Smooth Animations - Framer Motion transitions
  • Interactive Charts - Recharts analytics
  • Image Carousel - Swiper integration

πŸ› οΈ Technology Stack

Category Technologies
Frontend React Next.js Tailwind CSS
Backend Node.js Prisma
Database PostgreSQL
Authentication NextAuth bcryptjs
UI Libraries Framer Motion Swiper Recharts Lucide React
Utilities html2canvas jsPDF

πŸ“‹ Quick Start

Prerequisites

  • Node.js 16+
  • npm or yarn package manager
  • PostgreSQL database (Neon recommended)

Installation

  1. Clone the repository
git clone <repository-url>
cd boiler-plate
  1. Install dependencies
npm install
  1. Environment Configuration Create a .env.local file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@host/database"

# NextAuth
NEXTAUTH_SECRET="your-secret-key"
NEXTAUTH_URL="http://localhost:3000"

# Payment Gateway (if applicable)
NEXT_PUBLIC_PAYMENT_KEY="your-payment-key"
  1. Setup Prisma Database
# Generate Prisma Client
npx prisma generate

# Run migrations
npx prisma migrate dev --name init

# Seed database (optional)
npx prisma db seed
  1. Start Development Server
npm run dev

Open http://localhost:3000 to view the application.


πŸ“ Project Architecture

boiler-plate/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ api/                      # API Routes
β”‚   β”‚   β”œβ”€β”€ auth/                 # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ products/             # Product management
β”‚   β”‚   β”œβ”€β”€ cart/                 # Shopping cart
β”‚   β”‚   β”œβ”€β”€ checkout/             # Checkout flow
β”‚   β”‚   β”œβ”€β”€ payments/             # Payment processing
β”‚   β”‚   β”œβ”€β”€ admin/                # Admin operations
β”‚   β”‚   └── vendor/               # Vendor endpoints
β”‚   β”œβ”€β”€ admin/                    # Admin dashboard
β”‚   β”œβ”€β”€ vendor/                   # Vendor portal
β”‚   β”œβ”€β”€ user/                     # Customer dashboard
β”‚   β”œβ”€β”€ product/                  # Product details
β”‚   β”œβ”€β”€ cart/                     # Shopping cart UI
β”‚   β”œβ”€β”€ checkout/                 # Checkout page
β”‚   └── components/               # Reusable components
β”œβ”€β”€ components/                   # Shared components
β”‚   └── SessionProvider.js        # NextAuth provider
β”œβ”€β”€ lib/                          # Utility functions
β”‚   β”œβ”€β”€ auth.js                   # Authentication config
β”‚   β”œβ”€β”€ prisma.js                 # Prisma client
β”‚   └── toast.js                  # Toast notifications
β”œβ”€β”€ prisma/                       # Database
β”‚   └── schema.prisma             # Database schema
└── public/                       # Static assets


πŸ—„οΈ Database Schema

The application uses Prisma ORM with PostgreSQL. Key models:

  • User - Customer, Vendor, and Admin profiles with roles
  • Product - Rental items with hourly pricing and inventory tracking
  • Category - Product categorization system
  • Order - Complete order lifecycle (Quotation β†’ Sale Order β†’ Invoiced)
  • OrderItem - Individual items within orders
  • Invoice - Generated invoices for transactions

πŸš€ Available Scripts

# Development
npm run dev              # Start dev server with hot reload

# Production
npm run build            # Build optimized production bundle
npm start                # Start production server

# Code Quality
npm run lint             # Run ESLint on codebase

# Database
npx prisma studio       # Open Prisma Studio GUI
npx prisma migrate dev   # Create and apply migrations
npx prisma generate      # Generate Prisma Client

πŸ“š API Documentation

Authentication

  • POST /api/auth/signup - Register new user
  • POST /api/auth/[...nextauth] - NextAuth endpoints
  • GET /api/auth/session - Get current user session

Products

  • GET /api/products - List all approved products
  • GET /api/products/[id] - Get product details
  • POST /api/products - Create product (Vendor)
  • PUT /api/products/[id] - Update product (Vendor)
  • GET /api/categories - Get product categories

Orders & Checkout

  • GET /api/cart - Get shopping cart items
  • POST /api/cart - Add to cart
  • POST /api/checkout - Create order from cart
  • GET /api/orders - Get user orders
  • GET /api/payments/create-order - Initiate payment

Admin Operations

  • GET /api/admin/stats - Admin dashboard statistics
  • GET /api/admin/users - Manage users
  • GET /api/admin/products/pending - Pending product approvals
  • POST /api/admin/products/approve - Approve vendor products

Vendor Operations

  • GET /api/vendor/products - Vendor's product list
  • GET /api/vendor/orders - Vendor's customer orders
  • GET /api/vendor/customers - Vendor's customers list
  • GET /api/vendor/reports - Vendor analytics & reports

🎨 UI Components

Core Components

  • Navbar - Responsive navigation (Customer, Vendor, Admin variants)
  • Carousel - Swiper-based image slider for product showcase
  • Cart - Shopping cart management and updates
  • Product Cards - Reusable product listing displays

Pages & Forms

  • Login - User authentication form
  • Signup - User registration with role selection
  • Checkout - Multi-step checkout flow
  • Dashboard - Analytics and management interfaces
  • Vendor Portal - Product and order management

πŸ” Security Features

βœ… Role-Based Access Control (RBAC) - Route and API protection
βœ… JWT Authentication - Via NextAuth sessions
βœ… Password Encryption - bcryptjs with salt rounds
βœ… Protected API Routes - Middleware validation
βœ… CSRF Protection - NextAuth built-in
βœ… Environment Variable Management - Sensitive data isolation
βœ… GSTIN Validation - GST compliance for invoicing


πŸ“Š Performance Optimization

  • ⚑ Next.js 16 App Router - Server & client components
  • πŸ–ΌοΈ Image Optimization - Automatic compression & lazy loading
  • πŸ“¦ Code Splitting - Route-based bundle splitting
  • 🎯 Tailwind CSS 4 - PurgeCSS for minimal bundle
  • πŸ”„ Database Query Optimization - Prisma query selection
  • πŸ’Ύ Caching Strategies - ISR and dynamic routes

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and commit (git commit -m 'Add amazing feature')
  4. Push to your branch (git push origin feature/amazing-feature)
  5. Open a Pull Request with detailed description

Development Workflow

# Create feature branch
git checkout -b feature/my-feature

# Make changes and test
npm run dev

# Run linter before commit
npm run lint

# Commit with meaningful message
git commit -m "feat: add new feature"

πŸ› Troubleshooting

Database Connection Issues

# Verify DATABASE_URL in .env.local
# Check PostgreSQL/Neon credentials
# Restart development server
npm run dev

Prisma Client Not Found

npm install
npx prisma generate
npm run dev

NextAuth Errors

  • Ensure NEXTAUTH_SECRET is set in .env.local
  • Verify NEXTAUTH_URL matches your domain
  • Clear browser cookies and cache
  • Restart development server

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“ž Support & Resources


πŸš€ Deployment

Vercel (Recommended)

# Push to GitHub and connect to Vercel
# Environment variables are configured in Vercel dashboard
# Automatic deployments on every push to main

Other Platforms

  • Railway - railway up
  • Render - Connect GitHub repository
  • AWS Amplify - Amplify Console deployment

Refer to Next.js Deployment Documentation for detailed instructions.


🌟 Show Your Support

Give a ⭐ if this project helped you!

Made with ❀️ by the RentalHub Team

⬆ Back to Top

About

A powerful, modern, and scalable e-commerce rental platform built with cutting-edge web technologies. Designed for seamless multi-role support including Customers, Vendors, and Administrators.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors