An AI-powered marketplace platform that connects sellers with excess inventory to nearby buyers through intelligent dynamic pricing and real-time negotiation.
Every day, businesses accumulate excess inventory close to expiry. Retailers struggle to move stock quickly. Buyers have no visibility into available discounts. This results in:
- Significant losses for sellers
- Wasted resources
- Missed savings opportunities for buyers
ClearStock is a B2B/B2C marketplace that:
- Automatically prices inventory based on expiry timelines using AI
- Connects nearby buyers and sellers through geospatial matching
- Enables real-time negotiation with integrated chat and deal requests
- Streamlines the entire transaction in one unified platform
- Analyzes product category, expiry date, and current price
- Suggests optimal discount percentages automatically
- Discount tiers:
- ≤24 hours to expiry: 80% discount
- ≤72 hours: 65% discount
- ≤168 hours (1 week): 55% discount
- ≤720 hours (1 month): 45% discount
- ≤2160 hours (3 months): 35% discount
-
3 months: 25% discount
- Sellers create listings with product details, quantity, category, and expiry date
- Location-based GeoJSON data for geospatial queries
- Active listings displayed to nearby buyers
- Seller management dashboard to track and update inventory
- Automatically notifies buyers within 50km radius of relevant deals
- Location-based filtering reduces irrelevant notifications
- Supports personalized notification radius preferences (default 15km)
- Buyers make offers directly through deal requests
- Integrated chat system for buyer-seller communication
- Message history tied to specific deals
- Quick back-and-forth negotiation without external tools
- Status tracking: Pending → Accepted/Rejected/Sold/Cancelled
- New listing alerts for nearby buyers
- Deal request notifications for sellers
- Email and in-app notification options
- Customizable notification preferences
- Sellers: Create listings, manage inventory, respond to offers, negotiate via chat
- Buyers: Browse listings, make offers, negotiate, close deals
- Admin: Platform management (in progress)
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB
- Authentication: JWT (30-day expiration)
- AI Integration: Google Gemini API
- Geospatial: MongoDB GeoJSON queries
- Framework: Next.js
- Styling: Tailwind CSS
- State Management: Zustand
- Maps: Mapbox
- Authentication: Clerk (integrated)
- Node.js (v14+)
- MongoDB instance
- Google Gemini API key
- Mapbox API key
- Install dependencies
cd backend
npm install- Configure environment variables (.env)
MONGODB_URI=your_mongodb_url
JWT_SECRET=your_jwt_secret
GEMINI_API_KEY=your_gemini_api_key
MAPBOX_TOKEN=your_mapbox_token
PORT=5000
- Start the server
npm run devServer runs on http://localhost:5000
- Install dependencies
cd frontend
npm install- Configure environment variables (.env.local)
NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_MAPBOX_TOKEN=your_mapbox_token
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key
- Start the development server
npm run devFrontend runs on http://localhost:3000
POST /api/auth/register- Create seller/buyer accountPOST /api/auth/login- Login and get JWT tokenGET /api/auth/me- Get current user profile
POST /api/ai/check-food-safety- Get price suggestions for inventory
POST /api/food- Create listing (seller only)GET /api/food- Get all active listingsGET /api/food/:id- Get listing detailsGET /api/food/my/listings- Get seller's listingsDELETE /api/food/:id- Delete listing (owner only)
POST /api/requests- Create offerGET /api/requests/my-requests- Get buyer's offers (customer only)GET /api/requests/incoming- Get seller's incoming offers (seller only)PATCH /api/requests/:id/status- Update offer statusDELETE /api/requests/:id- Cancel pending offer
POST /api/chat/send- Send messageGET /api/chat/:requestId- Get message history
GET /api/notifications- Get user notificationsPATCH /api/notifications/:id/read- Mark notification as read
- Seller registers and logs in
- Gets AI price suggestion for excess inventory
- Creates listing with suggested price
- Buyer nearby receives notification
- Buyer makes offer through deal request
- Chat negotiation happens in real-time
- Deal closes when both parties agree
- Status updates tracked for fulfillment
Completed
- User authentication with JWT
- AI pricing engine with Gemini API
- Inventory listing management
- Deal request workflow
- Real-time chat system
- Geospatial notifications
- Role-based access control
- Error handling and validation
- MongoDB persistence
In Progress / Future
- Image upload to cloud storage
- Payment integration
- Order fulfillment tracking
- WebSocket for live chat (currently polling)
- Advanced search and filters
- Analytics dashboard
- Email notification service
This is an educational project. Contributions and feedback are welcome.
Not specified yet.
For questions or feedback about ClearStock, please reach out through the project channels.