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.
- 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
- Buyer: Browse products, place orders, track deliveries
- Seller: Manage inventory, accept orders, update delivery status
- Both: Full access to buyer and seller 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
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
- Node.js (v16 or higher)
- MySQL (v8.0 or higher)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd nodemart-app
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
Edit
.envwith 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 -
Start the backend server
npm run dev
-
Navigate to client directory
cd client -
Install dependencies
npm install
-
Set up environment variables
echo "REACT_APP_API_URL=http://localhost:5000/api" > .env
-
Start the frontend development server
npm start
-
Register an Account
- Visit the registration page
- Choose your role (Buyer, Seller, or Both)
- Allow location access for local delivery features
-
For Sellers
- Add products to your inventory
- Set quantities and prices
- Accept incoming orders
- Update delivery status
-
For Buyers
- Browse products from nearby sellers
- Add items to cart
- Place orders
- Track delivery status
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current userPUT /api/auth/profile- Update user profile
GET /api/products- Get all productsGET /api/products/search?q=query- Search productsGET /api/products/categories- Get product categoriesPOST /api/products- Create product (Seller only)
GET /api/inventory- Get user's inventoryGET /api/inventory/nearby- Get nearby productsPOST /api/inventory- Add item to inventoryPUT /api/inventory/:id/quantity- Update quantityPUT /api/inventory/:id/price- Update price
GET /api/orders- Get user's ordersPOST /api/orders- Create new orderPUT /api/orders/:id/status- Update order status
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
npm start- Start production servernpm run dev- Start development server with nodemonnpm run client- Start frontend development server
npm start- Start development servernpm run build- Build for productionnpm test- Run tests
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support, please open an issue in the repository or contact the development team.