CiscoChemicals-B2BManufacturingPlatform
A B2B enterprise procurement engine built to eliminate quote-to-order bottlenecks — integrating RAG-grounded AI inventory queries, dynamic PDF invoice generation, and automated multi-tier RFQ approval lifecycles.

Type Safety
Email Automation
Core Integrations
The Challenge
The core challenge was bridging the gap between static content and dynamic AI interactions. Implementing a RAG-based AI assistant that accurately retrieves real-time product specs from PayloadCMS was complex. Additionally, orchestrating the 'Quote-to-Invoice' workflow—where approved quotes automatically trigger PDF generation and email dispatch via Server Actions—required precise state management to prevent data inconsistencies.
Technologies used
Frontend
(5)Backend
(5)Database
(2)DevOps
(1)The Solution
→ Next.js 15 + PayloadCMS 3.0 + Neon DB for a robust, type-safe architecture. → Google Gemini 1.5 Flash (RAG) for AI-driven live inventory intelligence. → Stripe + Payload Hooks + Resend for automated quoting and invoicing workflows.
System Architecture & Security
src/├── app/ # Next.js App Router│ ├── (app)/ # Client routes (Cart, Checkout, Profile)│ │ ├── (home)/ # Public homepage & pricing│ │ ├── checkout/ # Client checkout UI│ │ └── quick-order/ # Bulk ordering route│ ├── (payload)/ # CMS admin dashboard router│ └── api/chat/ # RAG streaming endpoint├── collections/ # Payload CMS schemas│ ├── Products.ts # Inventory & filters│ ├── Quotes.ts # RFQ workflow + email hooks│ ├── Orders.ts # Order records│ └── Users.ts # Auth + RBAC schema├── modules/ # Domain logic (auth, checkout, dashboard)└── providers/ # Global state (Currency, Theme, Query)swipe →Security model
Role-Based Access Control
Full system access, including database records and the Executive Analytics Dashboard.
Add/update products and categories, approve and modify bulk quote pricing.
Browse products, manage profile, submit orders and RFQ (Request for Quote) submissions.
Secured via Payload CMS access control and collection-level field permissions.
Key Decisions
Why PayloadCMS over WordPress?
Needed a developer-first, headless CMS that seamlessly integrates with a modern Next.js stack while providing strong typing via TypeScript.
Why RAG for the AI?
LLMs hallucinate. By using Retrieval-Augmented Generation, we forced the AI to only answer using the exact stock data from our database.
Why React PDF?
We needed pixel-perfect, automated invoice generation. React PDF allowed us to build invoices using the same component logic we use for the web.
What I Learned
Hardest Part
Orchestrating the post-purchase webhook lifecycle where Stripe confirms payment, triggers Payload hooks, generates a PDF, and emails the client via Resend.
Biggest Insight
Serverless databases (Neon) are incredible for scaling, but managing connection pooling in serverless functions is critical to prevent cold start timeouts.
Do Differently
I would introduce a queueing system like Upstash/Redis for the email processing to ensure the checkout UI resolves instantly regardless of third-party API delays.
Key Highlights
B2B RFQ System
Complete 'Request for Quote' workflow allowing admins to approve custom prices & quantities.
AI Product Assistant
RAG-based Chatbot using Gemini 1.5 Flash that answers queries based on live inventory data.
Dynamic Invoicing
Automated generation of downloadable PDF invoices with unique transaction IDs post-payment.
Admin Analytics
Visual dashboard using Recharts to track monthly sales, quote conversion rates, and inventory.