ShopAI is an AI-first e-commerce monorepo that combines a modern storefront, an admin dashboard, and a document-aware support chatbot in one codebase.
It includes:
- a customer-facing store built with Next.js
- an internal admin panel for products, documents, analytics, and AI tools
- a FastAPI backend for products, uploads, chat, and AI workflows
- a RAG chatbot powered by LangGraph, Gemini, and pgvector
- Home page with hero carousel, promo content, category sections, and product rows
- Product listing, category pages, and product detail pages
- Cart drawer with persistent state
- Quick view, related products, and recently viewed products
- Responsive navigation with polished UX touches
- Product CRUD with Cloudinary image upload
- AI-assisted product copy improvement
- Document upload and indexing for RAG
- Chatbot testing interface with streaming answers and citations
- Analytics and settings pages
- Document parsing, chunking, embedding, and vector indexing
- Multi-agent chat routing with LangGraph
- Support answers grounded in uploaded documents
- Product-specific query handling through a separate agent
- SSE-based real-time chatbot streaming
The chatbot currently has three roles:
supervisor- routes each user query to the right specialistsupport- handles policy, shipping, returns, order tracking, and other document-backed questions using RAGproduct- handles product-related shopping and catalog questions
| Category | Technology |
|---|---|
| Frontend | Next.js 16, React 19, TypeScript |
| Styling | Tailwind CSS v4 |
| UI Components | shadcn/ui on @base-ui/react |
| State | TanStack Query v5 |
| Forms | react-hook-form + Zod |
| Motion | Framer Motion |
| Smooth Scroll | Lenis |
| Icons | Phosphor Icons |
| Backend | FastAPI, Python 3.12 |
| ORM | SQLAlchemy 2.0 async |
| Database | PostgreSQL + pgvector |
| Validation | Pydantic v2 |
| AI Models | Gemini 2.5 Flash, embedding-001 |
| AI Framework | LangChain + LangGraph |
| Image Storage | Cloudinary |
| Monorepo Tooling | pnpm + Turborepo |
- Node.js
>= 20 - pnpm
>= 10.33 - Python
>= 3.12 - PostgreSQL with the pgvector extension enabled
pnpm installCreate apps/client/.env.local:
NEXT_PUBLIC_API_URL="http://localhost:8000/api/v1"Create apps/server/.env:
DATABASE_URL="postgresql://user:password@host:5432/dbname?sslmode=require"
APP_NAME=ShopAI
APP_DEBUG=false
GEMINI_API_KEY="your-gemini-api-key"
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_UPLOAD_PRESET="your-upload-preset"
CLOUDINARY_API_SECRET="your-api-secret"
FRONTEND_URL="http://localhost:3000"
KEEP_ALIVE_URLS="http://localhost:8000/health"
KEEP_ALIVE_INTERVAL_SECONDS="600"Run both apps from the repo root:
pnpm devThis starts:
- client on
http://localhost:3000 - server on
http://localhost:8000
Or run them individually:
cd apps/client && pnpm dev
cd apps/server && pnpm devshop-ai/
├── apps/
│ ├── client/
│ │ ├── app/
│ │ │ ├── (admin)/admin/ admin pages: dashboard, products, documents, chatbot, analytics, settings
│ │ │ ├── (store)/store/ storefront pages
│ │ │ ├── error.tsx route-level error UI
│ │ │ ├── global-error.tsx global error UI
│ │ │ ├── not-found.tsx 404 page
│ │ │ ├── robots.ts SEO robots
│ │ │ └── sitemap.ts SEO sitemap
│ │ ├── components/
│ │ │ ├── chatbot/ floating storefront chatbot
│ │ │ ├── layout/ admin shell UI
│ │ │ ├── shared/ reusable client utilities and UI
│ │ │ ├── store/ storefront components
│ │ │ └── store/home/ home page sections
│ │ ├── hooks/ admin and store hooks
│ │ ├── lib/ client utilities
│ │ ├── server/ API fetchers
│ │ └── types/ frontend types
│ └── server/
│ ├── agents/ LangGraph supervisor and specialists
│ ├── api/ FastAPI routes
│ ├── controllers/ business logic
│ ├── core/ config, database, dependencies
│ ├── db/ repositories
│ ├── models/ SQLAlchemy models
│ ├── schemas/ Pydantic schemas
│ ├── scripts/ import and utility scripts
│ ├── uploads/documents/ uploaded RAG files
│ └── utils/ parsing, chunking, embedding, AI helpers
├── packages/
│ ├── ui/
│ ├── eslint-config/
│ └── typescript-config/
├── package.json
├── pnpm-workspace.yaml
└── turbo.json
| Area | Description |
|---|---|
| Products | Full CRUD with Cloudinary image upload and AI-assisted copy improvement |
| Documents | Upload, parse, chunk, embed, and index documents for RAG |
| Chatbot | Streaming multi-agent chat with citations |
| Analytics | Dashboard metrics and charts |
| Settings | App-level configuration UI |
- Product browsing with category-based navigation
- Product detail experience with cart actions
- Related and recently viewed products
- Responsive layout with store-specific navigation
- Smooth scrolling, loading skeletons, and UX polish
- SEO via
robots.tsandsitemap.ts - Error boundaries and custom 404 flows
- Keep-alive support for hosted backend uptime
- Import and batch-processing scripts for product data
- A document is uploaded from the admin dashboard.
- The backend parses the file into text.
- The text is split into smaller chunks.
- Embeddings are generated with Gemini
embedding-001. - Chunks and vectors are stored in PostgreSQL using pgvector.
- During chat, the user query is embedded and matched against stored chunks.
- Retrieved context is passed into the support agent.
- The final answer is streamed to the UI over SSE with source citations.
All endpoints are prefixed with /api/v1. The server runs on http://localhost:8000.
| Method | Endpoint | Description |
|---|---|---|
POST |
/products |
Create a product |
GET |
/products |
List products |
GET |
/products/:id |
Get product by UUID |
PUT |
/products/:id |
Update a product |
DELETE |
/products/:id |
Delete a product |
POST |
/upload/image |
Upload an image to Cloudinary |
POST |
/ai/improve |
Improve product name or description with AI |
POST |
/documents/upload |
Upload a document for RAG ingestion |
GET |
/documents |
List uploaded documents |
DELETE |
/documents/:id |
Delete a document and its chunks |
POST |
/chat/message |
Stream chatbot response via SSE |
| Method | Endpoint | Description |
|---|---|---|
GET |
/store/products |
List published products |
GET |
/store/products/:slug |
Get product by slug |
GET |
/store/categories |
List distinct product categories |
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check |
Run from the repo root:
pnpm typecheck
pnpm lint
pnpm formatOr run per app:
cd apps/client && pnpm typecheck
cd apps/server && pnpm typecheckThe shared UI package contains 33 shadcn/ui components built on @base-ui/react.
Import components like this:
import { Button } from "@workspace/ui/components/button"Add a new component with:
pnpm dlx shadcn@latest add <component> -c packages/ui- Semantic OKLCH color tokens with the Mira/taupe theme
- Lora for headings, Raleway for body text, Geist Mono for code
- Framer Motion for transitions and interaction polish
- Lenis for smooth scrolling
- A clean, modern, card-driven visual style
MIT