{"slug": "surpluslink-ai-turning-surplus-bakery-inventory-into-a-b2b-side-hustle", "title": "SurplusLink AI Turning Surplus Bakery Inventory Into a B2B Side Hustle", "summary": "A developer built SurplusLink AI, a prototype B2B marketplace for surplus packaged bakery products in Pakistan that uses a hosted open-weight Llama model on GroqCloud to parse buyer and seller listings into structured records. The system validates extracted fields with Pydantic, requires user confirmation of missing data, and defers matching decisions to explicit rule-based logic on category, unit, quantity, city, expiry, shelf life and price, with transactional stock reservation at offer acceptance.", "body_md": "*This is a submission for the [Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle](https://dev.to/challenges/hacktoberfest-week2-2026-10-12)*\n\nEvery day, food manufacturers, bakeries and wholesalers face a familiar business challenge: having inventory they need to sell before it loses commercial value.\n\nAt the same time, small retailers are searching for affordable stock but may lack direct access to suitable wholesale suppliers.\n\nThat question inspired SurplusLink AI, an AI-assisted B2B marketplace prototype focused on surplus packaged bakery products in Pakistan.\n\nThe intended customers are wholesalers who want to recover value from excess inventory and retailers who want to source products at competitive prices.\n\n[https://www.youtube.com/watch?v=gDrjds6meFg](https://www.youtube.com/watch?v=gDrjds6meFg)\n\n[https://github.com/taba123-debug/SurplusLink-AI-frontend](https://github.com/taba123-debug/SurplusLink-AI-frontend)\n\n[https://github.com/taba123-debug/SurplusLink-AI-backend/](https://github.com/taba123-debug/SurplusLink-AI-backend/)\n\nI started by treating SurplusLink as a marketplace rather than an AI chat application.The backend data model covers organizations, business memberships, surplus inventory, buyer requirements, offers, deals, payments and transaction events.\n\nPostgreSQL manages these relationships, while SQLAlchemy and Alembic provide database models and versioned migrations.\n\nAvailable Quantity = Total Quantity - Reserved Quantity - Sold Quantity.This separation makes it possible to track stock committed to accepted deals without confusing it with inventory that has already been collected.\n\nOne of the main usability problems in a marketplace is that sellers and buyers describe products differently.\n\nFor example, a retailer might write:\n\nI need 150 biscuit packs in Lahore, under Rs. 20,000, with at least 30 days of shelf life.\n\nThe extracted values are validated using Pydantic before they can be used as structured marketplace information.Missing fields are not supposed to be guessed. Users review and confirm extracted details before saving them.I moved toward a hosted open-weight Llama model through GroqCloud to avoid downloading model weights onto my development laptop.\n\nSurplusLink is designed to work in both directions.A buyer can discover seller listings that match a saved purchasing requirement.A seller can discover buyer requirements that are compatible with an available inventory lot.Rather than delegating every decision to an LLM, the matching engine uses explicit rules such as product category, unit, quantity, city, expiry, shelf life and price.\n\nThe AI interprets the user's language. The backend decides whether the structured records are compatible.\n\nThis separation keeps financial and inventory decisions understandable and testable.\n\nAfter finding a potential match, a buyer can submit an offer for a chosen quantity and price.The seller then decides whether to accept it.An accepted offer becomes a deal. The backend is designed to validate inventory availability at acceptance time and reserve stock transactionally, avoiding duplicate allocation of the same units.\n\nFor a marketplace, this is especially important: a product may attract multiple buyers at the same time.\n\nSurplusLink is intended to generate revenue through transaction fees rather than monthly subscriptions.\n\nThe proposed fee model is:\n\nThis is an illustrative business scenario. It is not real income, and the prototype does not process real financial transactions.\n\nOpen-weight AI made this project practical to explore without training an entire language model from scratch.\n\nFor a small marketplace product, the valuable part is not necessarily building the largest model. It is applying an existing model to a specific problem and combining its output with reliable software engineering.\n\nThe AI integration can be isolated behind a provider interface, making it easier to experiment with alternative compatible models.\n\nHosted inference allows development without maintaining a dedicated local GPU or running large model weights.\n\nAI assists with interpretation, while validated schemas, SQL queries and transaction rules determine what the system actually does.\n\nIn the future, a model could be evaluated or fine-tuned for local wholesale inventory descriptions, including Urdu-English terminology and product abbreviations.\n\nUsing an open-weight model does not automatically make an application private, offline or free to operate. Hosted inference still has provider costs and data-handling considerations, which would need to be evaluated before onboarding real businesses.\n\nDuring the development of SurplusLink AI, I used OpenAI Codex as an AI-assisted development tool.\n\nCodex helped accelerate the implementation of FastAPI endpoints, PostgreSQL database models, Alembic migrations, AI inference integration, and frontend connectivity.\n\nMy approach was to define the marketplace architecture, business workflows, and technical requirements first, then use Codex to implement and refine individual components.\n\nThis allowed me to focus on understanding backend architecture, inventory management, transaction handling, and the integration of open-weight AI into a practical business application.", "url": "https://wpnews.pro/news/surpluslink-ai-turning-surplus-bakery-inventory-into-a-b2b-side-hustle", "canonical_source": "https://dev.to/tabban_ghani_/surpluslink-ai-turning-surplus-bakery-inventory-into-a-b2b-side-hustle-47ne", "published_at": "2026-10-19 02:07:42+00:00", "updated_at": "2026-10-19 02:19:04.339727+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-products", "ai-tools"], "entities": ["SurplusLink AI", "GroqCloud", "Llama", "PostgreSQL", "SQLAlchemy", "Alembic", "Pydantic", "Pakistan"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/surpluslink-ai-turning-surplus-bakery-inventory-into-a-b2b-side-hustle", "markdown": "https://wpnews.pro/news/surpluslink-ai-turning-surplus-bakery-inventory-into-a-b2b-side-hustle.md", "text": "https://wpnews.pro/news/surpluslink-ai-turning-surplus-bakery-inventory-into-a-b2b-side-hustle.txt", "jsonld": "https://wpnews.pro/news/surpluslink-ai-turning-surplus-bakery-inventory-into-a-b2b-side-hustle.jsonld"}}