Skip to content

Latest commit

Β 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ShopLocal Logo ShopLocal - Discover Nearby Shops & Weekly Markets

ShopLocal is a modern full-stack local commerce platform that helps users discover nearby shops and weekly markets in their area. Users can explore local businesses, search and filter shops, browse products, view locations on interactive maps, manage their cart, place orders, and review shops, products, and markets, while shop owners can manage their business through a dedicated seller dashboard with product, order, customer, review, analytics, and shop management features.


πŸ“– Table of Contents


Overview

ShopLocal is a full-stack local commerce and discovery platform designed to connect customers with nearby shops and recurring weekly markets.

The platform allows users to discover local shops, search for products and businesses, view detailed shop information, find weekly markets, check locations on interactive maps, browse products, add items to their cart, place orders, and share their experience through reviews.

ShopLocal also provides a dedicated seller experience where shop owners can register their business and manage their shop, products, orders, customers, reviews, analytics, and settings from a centralized dashboard.

The platform also includes a community contribution system, allowing authenticated users to contribute information about local shops and weekly markets that can be added to the platform.

πŸͺ Built with the MERN stack, ShopLocal demonstrates practical full-stack development, geolocation-based discovery, MongoDB geospatial queries, interactive maps, e-commerce functionality, authentication, cloud image storage, REST APIs, and responsive UI development.


Live Demo

🌐 Access ShopLocal live here: Visit ShopLocal


Features

  • πŸͺ Local Shop Discovery

    • Discover local shops and explore detailed shop information.
  • πŸ”Ž Search & Filtering

    • Search across shops, products, and weekly markets and explore available results using relevant filters.
  • πŸ“ Location-Based Discovery

    • Use the user's current location to find nearby shops and calculate their distance.
  • πŸ—ΊοΈ Interactive Maps

    • View shop and market locations using MapLibre and MapTiler.
  • πŸ›οΈ Product Browsing

    • Browse products offered by local shops and view individual product details.
  • πŸ›’ Shopping Cart

    • Add products to the cart, update quantities, remove products, and review the cart before checkout.
  • πŸ’³ Checkout & Orders

    • Enter delivery information, select available payment methods, and place orders.
  • πŸ“¦ Order Management

    • Customers can view their orders and cancel eligible orders, while sellers can manage incoming orders and update their status.
  • πŸͺ Weekly Markets

    • Discover recurring weekly markets with information about their location, Market schedule, and category.
  • 🀝 Community Contributions

    • Authenticated users can contribute local shops and weekly markets to the platform.
  • πŸ“Š Seller Dashboard

    • Shop owners can manage their shop, products, orders, customers, reviews, analytics, and settings.
  • ⭐ Reviews & Ratings

    • Users can review shops, products, and markets, while sellers can reply to reviews.
  • πŸ” Secure Authentication

    • Separate customer and seller authentication with JWT-based protected routes and password hashing.
  • ☁️ Cloud Image Uploads

    • Shop, product, market, and contribution images can be uploaded and stored using Cloudinary.
  • πŸ“± Responsive Interface

    • The application adapts to desktop, tablet, and mobile screen sizes.
  • ⚠️ Error Handling

    • Handles authentication, API, validation, location, and other application errors with user-friendly feedback.

Location-Based Shop Discovery

Location-based discovery is one of the main features of ShopLocal.

The platform can use the user's browser location or a manually entered location to obtain latitude and longitude for finding nearby shops.

πŸ“ How Location Discovery Works

ShopLocal supports two ways to provide a location:

                    User Location
                         |
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              |                     |
              v                     v
       Allow Location         Enter Location
          Access                Manually
              |                     |
              v                     v
     Browser Geolocation      Forward Geocoding
            API                  (Nominatim)
              |                     |
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         |
                         v
                Latitude + Longitude
                         |
                         v
                  ShopLocal Backend
                         |
                         v
              MongoDB Geospatial Query
                         |
                         v
                  Nearby Shops
                         |
                         v
                Distance in Kilometers

Browser Location

When the user allows location access, ShopLocal uses the browser's Geolocation API to obtain the user's current latitude and longitude.

Manual Location

If the user does not want to use their current location, they can enter a location manually.

ShopLocal sends the entered location to the OpenStreetMap Nominatim API for forward geocoding.

Manual Location
      |
      v
Nominatim Forward Geocoding
      |
      v
Latitude + Longitude
      |
      v
Nearby Shop Search

The application uses the Nominatim base URL:

https://nominatim.openstreetmap.org

This converts a location such as a city, area, or address into geographic coordinates that can be used for nearby-shop discovery.

πŸ“ Distance Calculation

ShopLocal stores shop locations as GeoJSON Point coordinates.

The coordinate structure is:

[longitude, latitude]

The backend uses MongoDB's 2dsphere geospatial index and $geoNear aggregation to find shops based on their distance from the user's location.

The backend first calculates the distance in meters and then converts it into kilometers before returning the shop data.

User Coordinates
       |
       v
MongoDB $geoNear
       |
       v
distanceMeters
       |
       v
distanceKm
       |
       v
Nearby Shop Results

This allows ShopLocal to display shops according to their actual geographic distance instead of simply filtering by city or area.

πŸ“ Search Radius

The nearby-shop API accepts a distance parameter and uses a default search radius when no specific distance is provided.

This makes it possible to request shops within a particular geographic range around the user's selected or current location.

User Location
      |
      v
Search Radius
      |
      v
MongoDB Geospatial Query
      |
      v
Shops Within Radius

This location-based approach helps users discover relevant local shops based on their actual geographic proximity.


Maps & Location Services

ShopLocal uses interactive maps to make local discovery easier.

The frontend uses:

  • MapLibre GL
  • MapTiler

The map can display the location of shops and markets using their latitude and longitude coordinates.

πŸ—ΊοΈ Map Flow

Shop / Market
      |
      v
Latitude + Longitude
      |
      v
MapLibre GL
      |
      v
MapTiler Map Style
      |
      v
Interactive Location

πŸ“ Geocoding

Shop addresses can be converted into geographic coordinates using OpenStreetMap Nominatim.

ShopLocal supports:

  • Forward geocoding
  • Reverse geocoding
  • Address formatting
  • Latitude and longitude handling

Forward Geocoding

Address
   |
   v
Nominatim
   |
   v
Latitude + Longitude

Reverse Geocoding

Latitude + Longitude
          |
          v
       Nominatim
          |
          v
Readable Address

This allows the application to work with both human-readable addresses and geographic coordinates.


Shopping & Orders

ShopLocal provides a complete shopping flow for products offered by local shops.

πŸ›οΈ Shopping Flow

Shop
 |
 v
Browse Products
 |
 v
Product Details
 |
 v
Add to Cart
 |
 v
Cart
 |
 v
Checkout
 |
 v
Place Order
 |
 v
Order Success

Users can:

  • Browse products
  • View product details
  • Add products to their cart
  • Change product quantities
  • Remove products
  • Review cart totals
  • Enter delivery information
  • Select available payment methods
  • Place orders
  • View previous orders
  • Cancel eligible orders

πŸ“¦ Order Data

Orders contain information such as:

  • Customer
  • Seller
  • Shop
  • Ordered products
  • Product quantities
  • Product prices
  • Subtotal
  • Delivery fee
  • Total amount
  • Delivery address
  • Payment method
  • Order status
  • Cancellation information

The order stores the relevant product information at the time the order is created so that the order remains consistent even if product information changes later.


Weekly Markets

ShopLocal is not limited to permanent shops.

The platform also helps users discover weekly and recurring local markets.

Users can view market information such as:

  • Market name
  • Description
  • Category
  • Address
  • City
  • State
  • Pincode
  • Latitude
  • Longitude
  • Market schedule
  • Reviews
  • Market images

πŸͺ Market Discovery Flow

Weekly Markets
      |
      v
Search / Explore
      |
      v
Market Card
      |
      v
Market Details
      |
      +---- Location
      |
      +---- Schedule
      |
      +---- Contact
      |
      +---- Reviews

Markets have dedicated listing and detail pages so that users can explore them separately from local shops.


Community Contributions

ShopLocal allows authenticated users to contribute information about local shops and weekly markets.

This helps expand the platform beyond businesses that are already registered by sellers.

🀝 Contribution Types

Users can contribute:

Local Shop
    OR
Weekly Market

πŸͺ Shop Contribution

A shop contribution can include information such as:

  • Shop name
  • Category
  • Description
  • About
  • Address
  • City
  • State
  • Pincode
  • Phone
  • Email
  • Opening time
  • Closing time
  • Latitude
  • Longitude
  • Shop logo
  • Shop banner
  • Gallery images

πŸͺ Market Contribution

A market contribution can include:

  • Market name
  • Description
  • Category
  • Address
  • City
  • State
  • Pincode
  • Market day
  • Start time
  • End time
  • Latitude
  • Longitude
  • Phone
  • Email
  • Market image

πŸ”„ Contribution Flow

Authenticated User
        |
        v
Contribution Form
        |
        v
Client-side Validation
        |
        v
POST /api/contributions
        |
        v
Authentication Check
        |
        v
Server-side Validation
        |
        v
Image Upload
        |
        v
Create Shop / Market
        |
        v
Create Contribution Record
        |
        v
Approved Contribution

The contribution backend validates the submitted data and geographic coordinates before creating the corresponding Shop or Market document.

Uploaded contribution images are stored in Cloudinary.

The contribution record stores information about the submitting user and the document created from the contribution.

Currently, contributed shops and markets are automatically approved after successful validation and creation.


Seller Dashboard

ShopLocal provides a separate dashboard for shop owners.

The seller dashboard gives shop owners a centralized place to manage their business.

πŸ“Š Dashboard Sections

πŸͺ Shop Information

Sellers can create and manage their shop information, including:

  • Shop name
  • Category
  • Description
  • Contact information
  • Address
  • Opening hours
  • Shop images
  • Delivery and takeaway options
  • Payment methods
  • Other shop information

πŸ›οΈ Product Management

Sellers can:

  • Add products
  • Edit products
  • Delete products
  • Search products
  • Filter products
  • Manage product information
  • Manage availability
  • Manage stock
  • Upload product images

πŸ“¦ Order Management

Sellers can:

  • View incoming orders
  • Search orders
  • Filter orders
  • View order details
  • Update order status

πŸ‘₯ Customer Management

Sellers can:

  • View customers
  • Search customers
  • Filter customers
  • View customer details
  • View customer order information

⭐ Review Management

Sellers can:

  • View shop reviews
  • View product reviews
  • Search reviews
  • Filter reviews by rating
  • View review details
  • Reply to customer reviews

πŸ“ˆ Analytics

The analytics section provides seller-focused information such as:

  • Sales information
  • Order performance
  • Customer insights
  • Top products
  • Sales charts

βš™οΈ Settings

Sellers can manage account, shop, order, and notification-related settings from the settings section.


Reviews & Ratings

ShopLocal allows authenticated users to submit reviews for supported platform entities.

Reviews can contain:

  • Rating
  • Comment
  • Target type
  • Target ID

The platform supports reviews for:

  • Shops
  • Products
  • Markets

⭐ Review Flow

User
 |
 v
Shop / Product / Market
 |
 v
Write Review
 |
 v
Rating + Comment
 |
 v
Review API
 |
 v
MongoDB
 |
 v
Review Display

Sellers can also reply to customer reviews from their dashboard.

This allows communication between customers and shop owners while keeping reviews connected to the relevant shop or product.


Authentication & Security

ShopLocal uses separate authentication systems for customers and sellers.

πŸ” Customer Authentication

Customer authentication supports:

  • Signup
  • Login
  • Current-user access
  • Profile updates
  • Password updates
  • Logout

Customer routes are protected using authentication middleware.

πŸͺ Seller Authentication

Seller authentication supports:

  • Seller registration
  • Seller login
  • Current-seller access
  • Seller profile updates
  • Password changes
  • Logout

Seller dashboard routes are protected using dedicated seller authentication middleware.

πŸ”‘ JWT Authentication

JSON Web Tokens are used to authenticate protected API requests.

The frontend stores separate authentication tokens for customers and sellers and sends the appropriate token when communicating with protected backend routes.

Customer
   |
   v
Customer Login
   |
   v
JWT Token
   |
   v
Protected Customer Routes
Seller
   |
   v
Seller Login
   |
   v
JWT Token
   |
   v
Protected Seller Routes

πŸ”’ Password Security

Passwords are hashed using bcryptjs before being stored in the database.

Plain-text passwords are not stored directly.

πŸ›‘οΈ Backend Security

The backend uses:

  • Helmet for security-related HTTP headers
  • CORS for controlled cross-origin communication
  • JWT for protected authentication
  • bcryptjs for password hashing
  • Environment variables for sensitive configuration
  • Authentication middleware for protected resources

Image Uploads & Media

ShopLocal uses Cloudinary for cloud-based image storage.

Images are used for:

  • Shop banners
  • Shop logos
  • Shop gallery images
  • Product images
  • Market images
  • Community contribution images

☁️ Upload Flow

Frontend
   |
   v
Image Selection
   |
   v
Multipart Form Data
   |
   v
Express Backend
   |
   v
Multer
   |
   v
Cloudinary
   |
   v
Image URL
   |
   v
MongoDB Document

The backend uses Multer and Cloudinary integration to process uploaded images and store their resulting URLs with the relevant application data.


How It Works

ShopLocal follows a frontend β†’ backend β†’ database/services β†’ backend β†’ frontend architecture.

πŸ”„ Main Application Flow

  1. User opens ShopLocal

    • The React frontend loads the application.
  2. User chooses a location

    • The browser can provide the user's current latitude and longitude.
  3. User explores shops or markets

    • The frontend requests shop or market data from the backend API.
  4. Backend processes the request

    • Express routes and controllers handle the request.
  5. MongoDB provides application data

    • Shop, product, market, review, user, seller, and order information is stored in MongoDB.
  6. Location requests use geospatial queries

    • Nearby shop requests can use MongoDB $geoNear and the shop's 2dsphere index.
  7. Frontend displays the results

    • React renders the shops, products, markets, maps, and other information.
  8. Customer can shop

    • Products can be added to the cart and ordered through checkout.
  9. Seller manages the business

    • Sellers use the protected dashboard to manage their shop and customer activity.

πŸ”— Simplified Architecture Flow

                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚      User        β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
                                  β–Ό
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚ React Frontend   β”‚
                         β”‚     + Vite       β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
                                  β”‚ REST API
                                  β–Ό
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚ Express Backend  β”‚
                         β”‚    + Node.js     β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚                β”‚                β”‚
                β–Ό                β–Ό                β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚   MongoDB    β”‚  β”‚  Cloudinary  β”‚  β”‚  Geocoding   β”‚
        β”‚   Database   β”‚  β”‚    Images    β”‚  β”‚   Services   β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

πŸ’» Frontend

  • React.js

    • Builds the interactive customer and seller interfaces.
  • Vite

    • Provides the frontend development server and production build system.
  • Tailwind CSS

    • Provides utility-based styling for the responsive user interface.
  • React Router

    • Handles client-side routing between public, customer, authentication, and seller dashboard pages.
  • Axios

    • Handles communication between the frontend and backend API.
  • TanStack React Query

    • Supports API data fetching and server-state management.
  • React Helmet Async

    • Manages page metadata and document information.
  • Lucide React

    • Provides interface icons.
  • React Icons

    • Provides additional icons used throughout the application.
  • Recharts

    • Used for seller analytics and data visualization.
  • MapLibre GL

    • Provides interactive maps and location visualization.

πŸ–₯ Backend

  • Node.js

    • Provides the server-side JavaScript runtime.
  • Express.js

    • Handles backend routing, middleware, and REST API endpoints.
  • Multer

    • Handles multipart file uploads.
  • Cloudinary

    • Stores uploaded images in the cloud.
  • CORS

    • Controls cross-origin communication between the frontend and backend.
  • Morgan

    • Logs HTTP requests during development.
  • Dotenv

    • Loads environment variables from .env.

πŸ—„οΈ Database

  • MongoDB

    • Stores users, sellers, shops, products, orders, markets, reviews, addresses, and contribution records.
  • Mongoose

    • Provides schemas, models, validation, and MongoDB interaction.
  • MongoDB Geospatial Indexes

    • Support location-based shop discovery using GeoJSON and 2dsphere indexing.

πŸ” Authentication & Security

  • JSON Web Token

    • Provides authentication tokens for protected customer and seller routes.
  • bcryptjs

    • Hashes user and seller passwords.
  • Helmet

    • Adds security-related HTTP headers.

Project Architecture

The project follows a modular architecture that keeps ShopLocal scalable, maintainable, and easy to extend.

ShopLocal-Full-Stack-Local-Commerce-Platform/
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
β”‚
β”œβ”€β”€ client/
|   β”œβ”€β”€ .env
β”‚   β”œβ”€β”€ eslint.config.js
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package-lock.json
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vercel.json
β”‚   β”œβ”€β”€ vite.config.js
β”‚   β”‚
β”‚   └── src/
β”‚       β”œβ”€β”€ main.jsx
β”‚       β”‚
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ App.jsx
β”‚       β”‚   β”œβ”€β”€ providers.jsx
β”‚       β”‚   └── router.jsx
β”‚       β”‚
β”‚       β”œβ”€β”€ assets/
β”‚       β”‚   β”œβ”€β”€ herosection.png
β”‚       β”‚   └── logo.png
β”‚       β”‚
β”‚       β”œβ”€β”€ modules/
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ about/
β”‚       β”‚   β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ AboutCTA.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ AboutCustomers.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ AboutFeatures.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ AboutHero.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ AboutHowItWorks.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ AboutMission.jsx
β”‚       β”‚   β”‚   β”‚   └── AboutShopOwners.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   └── pages/
β”‚       β”‚   β”‚       └── AboutPage.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ auth/
β”‚       β”‚   β”‚   └── pages/
β”‚       β”‚   β”‚       β”œβ”€β”€ LoginPage.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ SellerLoginPage.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ SellerRegisterPage.jsx
β”‚       β”‚   β”‚       └── SignupPage.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ cart/
β”‚       β”‚   β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ CartItem.jsx
β”‚       β”‚   β”‚   β”‚   └── CartSummary.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   └── pages/
β”‚       β”‚   β”‚       β”œβ”€β”€ CartPage.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ CheckoutPage.jsx
β”‚       β”‚   β”‚       └── OrderSuccessPage.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ dashboard/
β”‚       β”‚   β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ header/
β”‚       β”‚   β”‚   β”‚   β”‚   └── DashboardHeader.jsx
β”‚       β”‚   β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ sidebar/
β”‚       β”‚   β”‚   β”‚   β”‚   └── DashboardSidebar.jsx
β”‚       β”‚   β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   β”‚   └── LogoutModal.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   └── pages/
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       β”œβ”€β”€ analytics/
β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ AnalyticsPage.jsx
β”‚       β”‚   β”‚       β”‚   └── components/
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ AnalyticsStatCard.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ CustomerInsights.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ OrderPerformance.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ SalesChart.jsx
β”‚       β”‚   β”‚       β”‚       └── TopProducts.jsx
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       β”œβ”€β”€ customers/
β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ CustomersPage.jsx
β”‚       β”‚   β”‚       β”‚   └── components/
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ CustomerDetailsModal.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ CustomerFilters.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ CustomerStatusBadge.jsx
β”‚       β”‚   β”‚       β”‚       └── CustomerTable.jsx
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       β”œβ”€β”€ dashboardhome/
β”‚       β”‚   β”‚       β”‚   └── DashboardHome.jsx
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       β”œβ”€β”€ orders/
β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ OrdersPage.jsx
β”‚       β”‚   β”‚       β”‚   └── components/
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ OrderDetailsModal.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ OrderFilters.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ OrderStatusBadge.jsx
β”‚       β”‚   β”‚       β”‚       └── OrderTable.jsx
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       β”œβ”€β”€ products/
β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ ProductsPage.jsx
β”‚       β”‚   β”‚       β”‚   └── components/
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ProductCard.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ProductDeleteModal.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ProductForm.jsx
β”‚       β”‚   β”‚       β”‚       └── ProductList.jsx
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       β”œβ”€β”€ reviews/
β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ ReviewsPage.jsx
β”‚       β”‚   β”‚       β”‚   └── components/
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ProductReviews.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ReviewDetailsModal.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ReviewFilters.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ReviewRatingBadge.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ ReviewSummary.jsx
β”‚       β”‚   β”‚       β”‚       └── ShopReviews.jsx
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       β”œβ”€β”€ settings/
β”‚       β”‚   β”‚       β”‚   β”œβ”€β”€ SettingsPage.jsx
β”‚       β”‚   β”‚       β”‚   └── components/
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ AccountSettings.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ NotificationSettings.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ OrderSettings.jsx
β”‚       β”‚   β”‚       β”‚       β”œβ”€β”€ SettingsSection.jsx
β”‚       β”‚   β”‚       β”‚       └── ShopSettings.jsx
β”‚       β”‚   β”‚       β”‚
β”‚       β”‚   β”‚       └── ShopInfo/
β”‚       β”‚   β”‚           β”œβ”€β”€ ShopInfoPage.jsx
β”‚       β”‚   β”‚           └── components/
β”‚       β”‚   β”‚               β”œβ”€β”€ RegisterShopModal.jsx
β”‚       β”‚   β”‚               β”œβ”€β”€ ShopForm.jsx
β”‚       β”‚   β”‚               └── ShopInformation.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ home/
β”‚       β”‚   β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ CategorySection.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ HeroSection.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ HowItWorksSection.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ NearbyShopsSection.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ShopOwnerCTASection.jsx
β”‚       β”‚   β”‚   β”‚   └── WeeklyMarketsSection.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   └── pages/
β”‚       β”‚   β”‚       └── HomePage.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ maps/
β”‚       β”‚   β”‚   └── components/
β”‚       β”‚   β”‚       └── MapLibreMap.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ markets/
β”‚       β”‚   β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ MarketFilters.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ MarketGrid.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ MarketHero.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ MarketInfo.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ MarketLocation.jsx
β”‚       β”‚   β”‚   β”‚   └── MarketSearch.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   └── pages/
β”‚       β”‚   β”‚       β”œβ”€β”€ MarketDetailsPage.jsx
β”‚       β”‚   β”‚       └── MarketsPage.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ reviews/
β”‚       β”‚   β”‚   └── components/
β”‚       β”‚   β”‚       β”œβ”€β”€ ReviewForm.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ReviewItem.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ReviewList.jsx
β”‚       β”‚   β”‚       └── ReviewSection.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ shops/
β”‚       β”‚   β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ProductCard.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ProductDescription.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ProductDetailsHero.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ProductPurchaseCard.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ProductSpecifications.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ RelatedProducts.jsx
β”‚       β”‚   β”‚   β”‚   └── ShopCard.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   β”œβ”€β”€ pages/
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ProductDetailsPage.jsx
β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ ShopDetailsPage.jsx
β”‚       β”‚   β”‚   β”‚   └── ShopsPage.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   └── sections/
β”‚       β”‚   β”‚       β”œβ”€β”€ LocationSection.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ProductSection.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ShopBanner.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ShopOverviewSection.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ShopsFilterSection.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ShopsGrid.jsx
β”‚       β”‚   β”‚       β”œβ”€β”€ ShopsHero.jsx
β”‚       β”‚   β”‚       └── SimilarShopsSection.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   └── user/
β”‚       β”‚       β”œβ”€β”€ MyProfile.jsx
β”‚       β”‚       └── Orders.jsx
β”‚       β”‚
β”‚       β”œβ”€β”€ services/
β”‚       β”‚   β”œβ”€β”€ api.js
β”‚       β”‚   β”œβ”€β”€ authService.js
β”‚       β”‚   β”œβ”€β”€ locationService.js
β”‚       β”‚   └── shopService.js
β”‚       β”‚
β”‚       β”œβ”€β”€ shared/
β”‚       β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”œβ”€β”€ ContributionPage.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ LocationModal.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ PageNotFoundPage.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ ProtectedSellerRoute.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ QuickActionCards.jsx
β”‚       β”‚   β”‚   β”‚
β”‚       β”‚   β”‚   └── navigation/
β”‚       β”‚   β”‚       β”œβ”€β”€ Footer.jsx
β”‚       β”‚   β”‚       └── Navbar.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ context/
β”‚       β”‚   β”‚   β”œβ”€β”€ AuthContext.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ CartContext.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ LocationContext.jsx
β”‚       β”‚   β”‚   └── ReviewContext.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ layouts/
β”‚       β”‚   β”‚   β”œβ”€β”€ DashboardLayout.jsx
β”‚       β”‚   β”‚   └── PublicLayout.jsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ meta/
β”‚       β”‚   β”‚   β”œβ”€β”€ MetaWrapper.jsx
β”‚       β”‚   β”‚   β”œβ”€β”€ PageMeta.jsx
β”‚       β”‚   β”‚   └── pageTitles.js
β”‚       β”‚   β”‚
β”‚       β”‚   └── utils/
β”‚       β”‚       └── distance.js
β”‚       β”‚
β”‚       └── styles/
β”‚           β”œβ”€β”€ animations.css
β”‚           β”œβ”€β”€ globals.css
β”‚           └── variables.css
β”‚
└── server/
    β”œβ”€β”€ .env
    β”œβ”€β”€ package-lock.json
    β”œβ”€β”€ package.json
    β”‚
    └── src/
        β”œβ”€β”€ app.js
        β”œβ”€β”€ server.js
        β”‚
        β”œβ”€β”€ config/
        β”‚   β”œβ”€β”€ cloudinary.js
        β”‚   └── db.js
        β”‚
        β”œβ”€β”€ controllers/
        β”‚   β”œβ”€β”€ analyticsController.js
        β”‚   β”œβ”€β”€ contributionController.js
        β”‚   β”œβ”€β”€ customerController.js
        β”‚   β”œβ”€β”€ marketController.js
        β”‚   β”œβ”€β”€ orderController.js
        β”‚   β”œβ”€β”€ productController.js
        β”‚   β”œβ”€β”€ reviewController.js
        β”‚   β”œβ”€β”€ sellerAuthController.js
        β”‚   β”œβ”€β”€ sellerSettingsController.js
        β”‚   β”œβ”€β”€ shopController.js
        β”‚   β”œβ”€β”€ userAddressController.js
        β”‚   └── userAuthController.js
        β”‚
        β”œβ”€β”€ init/
        β”‚   β”œβ”€β”€ data.js
        β”‚   └── index.js
        β”‚
        β”œβ”€β”€ middleware/
        β”‚   β”œβ”€β”€ sellerAuthMiddleware.js
        β”‚   β”œβ”€β”€ uploadMiddleware.js
        β”‚   └── userAuthMiddleware.js
        β”‚
        β”œβ”€β”€ models/
        β”‚   β”œβ”€β”€ Market.js
        β”‚   β”œβ”€β”€ Order.js
        β”‚   β”œβ”€β”€ Product.js
        β”‚   β”œβ”€β”€ Review.js
        β”‚   β”œβ”€β”€ Seller.js
        β”‚   β”œβ”€β”€ Shop.js
        β”‚   β”œβ”€β”€ User.js
        β”‚   └── UserContribution.js
        β”‚
        β”œβ”€β”€ routes/
        β”‚   β”œβ”€β”€ analyticsRoutes.js
        β”‚   β”œβ”€β”€ contributionRoutes.js
        β”‚   β”œβ”€β”€ customerRoutes.js
        β”‚   β”œβ”€β”€ marketRoutes.js
        β”‚   β”œβ”€β”€ orderRoutes.js
        β”‚   β”œβ”€β”€ productRoutes.js
        β”‚   β”œβ”€β”€ reviewRoutes.js
        β”‚   β”œβ”€β”€ sellerAuthRoutes.js
        β”‚   β”œβ”€β”€ sellerSettingsRoutes.js
        β”‚   β”œβ”€β”€ sellerShopRoutes.js
        β”‚   β”œβ”€β”€ shopRoutes.js
        β”‚   β”œβ”€β”€ userAddressRoutes.js
        β”‚   └── userAuthRoutes.js
        β”‚
        └── utils/
            β”œβ”€β”€ geocodeAddress.js
            β”œβ”€β”€ token.js
            └── uploadToCloudinary.js

API Endpoints

πŸ” User Authentication

Method Endpoint Description
POST /api/auth/user/signup Register a customer account
POST /api/auth/user/login Login as a customer
GET /api/auth/user/me Get the authenticated customer
PUT /api/auth/user/profile Update customer profile
PUT /api/auth/user/password Change customer password
POST /api/auth/user/logout Logout the customer

πŸͺ Seller Authentication

Method Endpoint Description
POST /api/auth/seller/signup Register a seller account
POST /api/auth/seller/login Login as a seller
GET /api/auth/seller/me Get the authenticated seller
PUT /api/auth/seller/profile Update seller profile
PUT /api/auth/seller/password Change seller password
POST /api/auth/seller/logout Logout the seller

πŸͺ Shops

Method Endpoint Description
GET /api/shops Get available shops
GET /api/shops/:id Get a specific shop
POST /api/seller/shop Create a seller shop
GET /api/seller/shop Get the seller's shop
PUT /api/seller/shop Update the seller's shop

πŸ›οΈ Products

Method Endpoint Description
GET /api/products Get products
GET /api/products/:id Get a specific product
GET /api/products/seller Get seller products
POST /api/products Create a product
PUT /api/products/:id Update a product
DELETE /api/products/:id Delete a product

πŸ“¦ Orders

Method Endpoint Description
POST /api/orders Create an order
GET /api/orders/my Get customer's orders
GET /api/orders/:id Get a customer's order
PUT /api/orders/:id/cancel Cancel a customer order
GET /api/orders/seller Get seller orders
GET /api/orders/seller/:id Get seller order details
PUT /api/orders/seller/:id/status Update seller order status

πŸ‘₯ Customers

Method Endpoint Description
GET /api/customers Get seller customers
GET /api/customers/:id Get customer details
GET /api/customers/:id/orders Get customer's orders

πŸͺ Weekly Markets

Method Endpoint Description
GET /api/markets Get weekly markets
GET /api/markets/:id Get a specific market

⭐ Reviews

Method Endpoint Description
GET /api/reviews/:targetType/:targetId Get reviews for a target
POST /api/reviews Create a review
GET /api/reviews/my Get the customer's reviews
PUT /api/reviews/:id Update a review
DELETE /api/reviews/:id Delete a review
GET /api/reviews/seller Get seller reviews
PUT /api/reviews/:id/reply Reply to a review

🀝 Community Contributions

Method Endpoint Description
POST /api/contributions Submit a shop or market contribution

πŸ“ˆ Seller Analytics

Method Endpoint Description
GET /api/seller/analytics Get seller analytics

βš™οΈ Seller Settings

Method Endpoint Description
GET /api/seller/settings Get seller settings
PUT /api/seller/settings Update seller settings

πŸ“ User Addresses

Method Endpoint Description
GET /api/users/me/addresses Get saved addresses
POST /api/users/me/addresses Add an address
PUT /api/users/me/addresses/:id Update an address
DELETE /api/users/me/addresses/:id Delete an address

❀️ Health Check

Method Endpoint Description
GET /api/health Check whether the ShopLocal API is running

All API routes were tested using Thunder Client.


Local Setup for Developers

To set up ShopLocal locally, follow these steps:

  1. Fork the repository on GitHub and clone it
  git clone <your-forked-repo-url>
  1. Install backend dependencies
cd server
npm install
  1. Install frontend dependencies

Open another terminal:

cd client
npm install
  1. Set up environment variables

Create a .env file inside the server folder.

PORT=5000
NODE_ENV=development

MONGO_URI=your-mongodb-connection-string

JWT_SECRET=your-jwt-secret
JWT_EXPIRES_IN=7d

CLIENT_URL=http://localhost:5173

CLOUD_NAME=your-cloudinary-cloud-name
CLOUD_API_KEY=your-cloudinary-api-key
CLOUD_API_SECRET=your-cloudinary-api-secret

JWT_SECRET can be any random string used to sign authentication tokens.

Create a .env file inside the client folder.

VITE_API_URL=http://localhost:5000/api
VITE_MAPTILER_API_KEY=your-maptiler-api-key
  1. Start the development servers

Backend:

Inside the server folder:

cd server
npm run dev

Frontend:

Inside the client folder:

cd client
npm run dev

Both servers run in development mode. The frontend port may vary depending on your system.

  1. Visit the application

Open the URL displayed in the terminal (usually http://localhost:5173) in your browser to use the frontend.

  1. Build for production

Inside the client folder:

cd client
npm run build

This creates an optimized production build of the frontend.

  1. Preview the production build

After building the frontend, run:

npm run preview

The terminal will display the URL where you can preview the production build.


Documentation

πŸ“– Complete project documentation link will be added soon.


Developer

Developed by LinkedIn GitHub
Harshal Waghmare LinkedIn GitHub

About

ShopLocal is a fully responsive, full-stack local commerce platform for discovering nearby shops and weekly markets. Users can explore shops, weekly markets, and products, manage carts, place orders, and review businesses using location-based discovery, interactive maps, secure authentication, and a seller dashboard.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages