Full‑featured, production‑ready e‑commerce built with Next.js App Router, MongoDB/Mongoose, Stripe & PayPal, internationalization, rich admin, and realtime user‑interaction tracking. It integrates a standalone ML Recommendation microservice for personalized product suggestions and is evolving toward agentic and generative AI experiences (chat/voice order filtering and store assistance).
- ML recommendation service: see
recom-ml-Serveron GitHub (link).
- Storefront: product browsing, categories, search with interaction tracking, responsive UI, light/dark themes
- Product details: image gallery/zoom, attributes & variants, reviews, similar/recommended products
- Cart & Checkout: cart sidebar, shipping steps, Stripe and PayPal payments, receipts via email
- Accounts: authentication (NextAuth), profile, orders history, saved preferences
- Admin Console: overview dashboards, products CRUD, orders, users, settings, static web pages
- Internationalization: locale‑aware routing and messages
- Media: image upload via UploadThing
- Emails: order receipts and review requests
- Realtime Interaction Tracking: browsing/search/purchase events used to improve recommendations
- Recommendations: server endpoint orchestrating calls to the external ML service
- Agentic/Gen‑AI (in progress): chat/voice commands to filter orders and assist operations
- Frontend/SSR: Next.js 15 (App Router), React 19, TypeScript, TailwindCSS, shadcn/ui (Radix UI)
- Auth: NextAuth with MongoDB adapter
- Data: MongoDB, Mongoose
- Payments: Stripe, PayPal
- Uploads: UploadThing
- Emails: React Email, Resend
- i18n: next‑intl
- State/UX: Zustand, React Hook Form, Embla Carousel, Recharts
Key directories:
app/– App Router routes (storefront, admin, checkout, API routes underapp/api)components/– shared and UI componentslib/– server actions, db client, models, utilities, payment integrationshooks/– client state and tracking hooksmessages/– localized message json filestypes/– shared TypeScript types
ML service (external): recom-ml-Server (link) provides recommendation APIs consumed by app/api/recommendations/[userId].
- Install dependencies
npm install-
Configure environment Create a
.env.localfile in project root (see Example below). -
Seed database (optional but recommended)
npm run seed- Run the development server
npm run devCopy and adjust as needed. Not all keys are strictly required to boot; missing providers disable related features.
# App
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-long-random-secret
# Database
MONGODB_URI=mongodb://localhost:27017/smart-shop
# Auth providers (examples; configure the ones you use)
# GITHUB_ID=...
# GITHUB_SECRET=...
# Stripe
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
# PayPal
PAYPAL_CLIENT_ID=your-paypal-client-id
PAYPAL_CLIENT_SECRET=your-paypal-client-secret
PAYPAL_MODE=sandbox
# Resend (email)
RESEND_API_KEY=re_...
EMAIL_FROM=no-reply@yourdomain.com
# UploadThing
UPLOADTHING_SECRET=ut_...
UPLOADTHING_APP_ID=your-app-id
# Recommendation ML Service
RECOM_API_BASE_URL=http://localhost:8000
RECOM_API_KEY=optional-or-token-if-configuredThe project ships with product and demo data.
npm run seedThis connects to MONGODB_URI and inserts initial documents (users, products, settings, etc.) defined in lib/db/seed.ts and JSON assets under lib/.
npm run dev # start Next.js in development
npm run build # build for production
npm run start # start production server
npm run seed # seed MongoDB with demo data
npm run lint # run eslint- App Router delivers SSR/SSG and route groups for
auth,home,checkout,admin. - API Routes under
app/apipower auth, recommendations, uploads, and webhooks. - Database Layer in
lib/dbwith Mongoose models per domain (Product, Order, User, Settings, etc.). - Server Actions in
lib/actionsencapsulate business logic for orders, products, settings, reviews, and recommendations. - Payments via Stripe (webhooks under
app/api/webhooks/stripe) and PayPal helpers inlib/paypal.ts. - Emails in
emails/(purchase receipts, review requests) via Resend. - Uploads via UploadThing (
app/api/uploadthing). - i18n via next‑intl (
i18n/andmessages/). - UI/UX via tailwind, shadcn/ui components inside
components/uiand feature components incomponents/shared.
- The app tracks user interactions (browsing, search, purchases) under
app/api/products/browsing-historyandapp/api/userInteractions. Hooks likeuse-user-interactionsand components such ascomponents/shared/search/search-interaction-tracker.tsxrecord events. - Recommendation endpoint
app/api/recommendations/[userId]/route.tsaggregates signals and calls the ML service atRECOM_API_BASE_URL. - External ML service repo:
recom-ml-Server(link). Run it locally (e.g., uvicorn/Docker) and setRECOM_API_BASE_URL.
- Chat/voice command interface to filter orders and assist with store operations.
- Planned capabilities: smart order search (status/date/range/customer), analytics Q&A, and guided administration.
- When enabled, these features will use tracked events and catalog data to ground responses.
- Type‑safe, explicit exports and clear naming across
lib/actionsandtypes/. - Avoid deep nesting; prefer early returns and minimal try/catch scopes.
- Run
npm run lintbefore commits; fix all errors.
- Any Node/Next compatible host (Vercel, Render, Docker). Ensure environment variables are set and Stripe/PayPal webhooks are configured.
- Run the ML service separately and point
RECOM_API_BASE_URLto its public/internal URL.
- Do not commit
.env*files or secrets. - Rotate Stripe/PayPal keys in production and protect webhook secrets.
- Validate uploads and sanitize user input (already leveraged by schema validation and server actions).
Issues and PRs are welcome. Please:
- Fork and create a feature branch
- Keep changes focused and well‑tested
- Run linting and build before opening a PR
This project is provided as‑is without warranty. See repository license if added.