Skip to content

karthikeyjoshi/nodemart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeMart - Local Marketplace & Fast Delivery App

NodeMart is a full-stack application that allows users to be both buyers and sellers in a local marketplace with fast delivery capabilities. Users can hold inventory in their homes and sell products to nearby buyers with quick delivery.

Features

Core Functionality

  • Dual Role System: Users can be Buyers, Sellers, or Both
  • Local Inventory Management: Sellers can manage inventory from their homes
  • Geolocation-based Search: Find products and sellers near you
  • Real-time Order Tracking: Track orders and delivery status
  • Fast Local Delivery: Quick delivery from nearby sellers

User Roles

  • Buyer: Browse products, place orders, track deliveries
  • Seller: Manage inventory, accept orders, update delivery status
  • Both: Full access to buyer and seller features

Technical Features

  • Modern UI: Built with React, TypeScript, and Material-UI
  • Real-time Updates: Socket.IO for live notifications
  • Secure Authentication: JWT-based authentication
  • Location Services: GPS integration for local delivery
  • Responsive Design: Works on desktop and mobile

Database Schema

The application uses a MySQL database with the following key tables:

  • User: User accounts with roles and location data
  • Product: Product catalog
  • Inventory: User-specific inventory with quantities and prices
  • Order: Order management between buyers and sellers
  • OrderItem: Individual items within orders
  • Delivery: Delivery tracking system
  • DeliveryPerson: Delivery personnel management

Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • MySQL (v8.0 or higher)
  • npm or yarn

Backend Setup

  1. Clone the repository

    git clone <repository-url>
    cd nodemart-app
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env

    Edit .env with your database credentials:

    DB_HOST=localhost
    DB_USER=root
    DB_PASSWORD=your_mysql_password
    DB_NAME=nodemart
    JWT_SECRET=your_super_secret_jwt_key_here
    
  4. Start the backend server

    npm run dev

Frontend Setup

  1. Navigate to client directory

    cd client
  2. Install dependencies

    npm install
  3. Set up environment variables

    echo "REACT_APP_API_URL=http://localhost:5000/api" > .env
  4. Start the frontend development server

    npm start

Usage

Getting Started

  1. Register an Account

    • Visit the registration page
    • Choose your role (Buyer, Seller, or Both)
    • Allow location access for local delivery features
  2. For Sellers

    • Add products to your inventory
    • Set quantities and prices
    • Accept incoming orders
    • Update delivery status
  3. For Buyers

    • Browse products from nearby sellers
    • Add items to cart
    • Place orders
    • Track delivery status

API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • GET /api/auth/me - Get current user
  • PUT /api/auth/profile - Update user profile

Products

  • GET /api/products - Get all products
  • GET /api/products/search?q=query - Search products
  • GET /api/products/categories - Get product categories
  • POST /api/products - Create product (Seller only)

Inventory

  • GET /api/inventory - Get user's inventory
  • GET /api/inventory/nearby - Get nearby products
  • POST /api/inventory - Add item to inventory
  • PUT /api/inventory/:id/quantity - Update quantity
  • PUT /api/inventory/:id/price - Update price

Orders

  • GET /api/orders - Get user's orders
  • POST /api/orders - Create new order
  • PUT /api/orders/:id/status - Update order status

Development

Project Structure

nodemart-app/
├── config/          # Database configuration
├── middleware/      # Express middleware
├── models/          # Database models
├── routes/          # API routes
├── client/          # React frontend
│   ├── src/
│   │   ├── components/  # React components
│   │   ├── context/     # React contexts
│   │   ├── pages/       # Page components
│   │   ├── services/    # API services
│   │   └── types/       # TypeScript types
└── server.js        # Main server file

Available Scripts

Backend

  • npm start - Start production server
  • npm run dev - Start development server with nodemon
  • npm run client - Start frontend development server

Frontend

  • npm start - Start development server
  • npm run build - Build for production
  • npm test - Run tests

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License.

Support

For support, please open an issue in the repository or contact the development team.

About

Hyperlocal full-stack application that allows users to be both buyers and sellers with micro inventory management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors