TechMorph IoT is a production-ready, full-stack IoT e-commerce platform built for the Bangladeshi maker and engineering community. It provides a seamless shopping experience for Arduino, ESP32, Raspberry Pi, sensors, and IoT kits through a cyberpunk-inspired dark interface.
The platform covers the complete e-commerce lifecycle — product browsing with advanced filters, cart and wishlist management, multi-payment checkout (bKash, Nagad, COD), Google OAuth, an AI-powered shopping assistant (TechBot), coupon system, admin dashboard, and a blog section integrated with Medium.
Home Page |
Product Detail |
Cart & Checkout |
Admin Dashboard |
TechBot — AI Shopping Assistant (Groq / Llama 3) |
|
- Product Catalogue — 15+ IoT components with category, price, brand and stock filters
- Smart Search — Real-time product search with instant results
- Cart Management — localStorage-based cart, persistent across sessions, no backend required
- Wishlist — Save favourite products
- Checkout Flow — COD, bKash and Nagad payment simulation with full UX
- Order Tracking — Order history with status timeline
- Google OAuth — One-click Google sign-in via NextAuth.js
- Demo Mode — Full site functionality without a running backend
- Floating chat widget powered by Groq API (Llama 3 — Free)
- Answers questions about products, prices, shipping, coupons and IoT topics
- Responds in English, Bengali, or Banglish — auto-detects user language
- Quick-question chips for common queries
- Unread message notification badge
- Full conversation context maintained per session
- Revenue, order, user and product statistics
- Product and category CRUD management
- Order management with status updates
- Coupon creation and management
- Dark / Light mode with CSS variable theming
- Bangla / English language toggle (EN/BN)
- Animated promotional ticker bar
- Blog section linked directly to Medium posts
- Professional cyberpunk SVG product illustrations (no broken images)
- Fully responsive — mobile-first design
| Technology | Purpose |
|---|---|
| Next.js 14 (App Router) | Framework, SSR, file-based routing |
| TypeScript | Type safety across the entire frontend |
| Tailwind CSS | Utility-first cyberpunk styling |
| Framer Motion | Page transitions and micro-animations |
| NextAuth.js v4 | Google OAuth integration |
| Context API | Auth, cart, wishlist, theme, language |
| React Hot Toast | Notification system |
| Groq API (Llama 3) | AI chatbot — free tier |
| Technology | Purpose |
|---|---|
| Node.js + Express.js | REST API server |
| PostgreSQL | Primary relational database |
| Prisma ORM | Schema management, migrations, seeding |
| JSON Web Tokens | Stateless authentication |
| bcryptjs | Secure password hashing |
| express-rate-limit | API rate protection |
| Service | Purpose |
|---|---|
| Vercel | Frontend hosting and deployment |
| Render | Backend API hosting |
| Neon | Serverless PostgreSQL (free tier) |
techmorph-iot/
├── frontend/
│ ├── app/
│ │ ├── (auth)/login/ # Login — demo + Google OAuth
│ │ ├── (auth)/register/ # Registration with validation
│ │ ├── api/auth/[...nextauth]/ # NextAuth Google provider
│ │ ├── api/chat/ # TechBot AI endpoint (Groq)
│ │ ├── admin/ # Admin dashboard
│ │ ├── blog/ # Blog listing → Medium links
│ │ ├── cart/ # Cart + coupon system
│ │ ├── checkout/ # Multi-step checkout
│ │ ├── contact/ # Contact + real social links
│ │ ├── orders/ # Order tracking
│ │ ├── product/[slug]/ # Product detail
│ │ ├── profile/ # User profile (demo-mode safe)
│ │ ├── shop/ # Product catalogue + filters
│ │ ├── wishlist/
│ │ ├── globals.css # Cyberpunk design tokens
│ │ ├── layout.tsx # Root layout with all providers
│ │ └── page.tsx
│ ├── components/
│ │ ├── layout/Navbar.tsx # Promo ticker + nav + search modal
│ │ ├── layout/Footer.tsx
│ │ ├── providers/SessionProviderWrapper.tsx
│ │ ├── sections/HeroSection.tsx # Canvas particle network hero
│ │ ├── sections/FeaturedProducts.tsx
│ │ ├── sections/Sections.tsx
│ │ └── ui/
│ │ ├── ChatBot.tsx # TechBot floating chat widget
│ │ └── ProductCard.tsx
│ ├── context/
│ │ ├── AuthContext.tsx # JWT auth + demo mode fallback
│ │ ├── CartContext.tsx # localStorage-based cart
│ │ ├── WishlistContext.tsx
│ │ ├── ThemeContext.tsx # CSS variable injection
│ │ └── LanguageContext.tsx
│ ├── lib/
│ │ ├── api.ts # Axios instance + all API functions
│ │ ├── mockData.ts # Products, blog posts, testimonials
│ │ ├── translations.ts # EN + BN string tables
│ │ └── utils.ts # Formatters, BD districts list
│ ├── public/products/ # Cyberpunk SVG product images
│ ├── scripts/download-images.js # Optional: download Wikipedia images
│ └── types/index.ts
│
├── backend/
│ ├── src/
│ │ ├── controllers/ # auth, product, order, admin, cart
│ │ ├── middleware/auth.js # JWT protect middleware
│ │ ├── routes/ # All API route handlers
│ │ └── server.js
│ └── prisma/
│ ├── schema.prisma
│ └── seed.js
│
├── screenshots/ # Project screenshots for README
├── .gitignore
├── LICENSE
└── README.md
- Node.js 18+
- PostgreSQL (local or Neon free tier)
- Git
git clone https://github.com/rafiul254/techmorph-iot.git
cd techmorph-iotcd backend
npm install
cp .env.example .env
# Edit .env with your DATABASE_URL and JWT_SECRET
npx prisma migrate dev --name init
node prisma/seed.js
npm run devcd ../frontend
npm installCreate frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:5000/api
NEXTAUTH_SECRET=any_random_string_here
NEXTAUTH_URL=http://localhost:3000
GROQ_API_KEY=gsk_your_key_from_console.groq.com
# Optional — Google OAuth
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secretnpm run dev
# Visit: http://localhost:3000Admin: admin@techmorph.io / Admin@123
User: demo@techmorph.io / User@123
Coupons: WELCOME20 · FLAT100 · IOT2025
- Sign up at console.groq.com
- Create API Key
- Add
GROQ_API_KEY=gsk_...tofrontend/.env.local
- console.cloud.google.com → New Project
- APIs & Services → OAuth consent → External → Create
- Credentials → OAuth 2.0 Client ID → Web app
- Redirect URI:
http://localhost:3000/api/auth/callback/google - Add Client ID and Secret to
.env.local
Frontend → Vercel
- Import from GitHub on vercel.com
- Root Directory:
frontend - Add all
.env.localvariables in Vercel settings
Backend → Render
- Root:
backend| Build:npm install && npx prisma generate| Start:node src/server.js
Database → Neon
- Free PostgreSQL at neon.tech → copy
DATABASE_URLto Render + local.env
Product Image Loading (Permanent Fix)
All major electronics CDNs return HTTP 403 for server-side requests. The permanent solution was creating professional cyberpunk-styled SVG illustrations for all 15 products — stored locally in public/products/. No external dependencies, instant loading, accurate product representation.
Authentication Persistence After Logout
refreshUser was clearing JWT tokens on any error including network timeouts, causing unexpected logouts. Fixed by only clearing on HTTP 401, and restoring user from localStorage immediately before the API response arrives.
Demo Mode Without Backend
Built complete offline fallback — demo credentials checked client-side before any API call, cart uses localStorage exclusively, checkout generates local order numbers, and profile updates save to localStorage. The entire site is usable with the backend offline.
Cart P2003 Foreign Key Constraint
The backend crashed when demo product IDs ("1", "2") were sent to a database using UUID primary keys. Resolved by moving cart entirely to localStorage and only sending to backend for real authenticated sessions with valid UUIDs.
Dark/Light Theme Toggle
Hardcoded Tailwind color classes didn't respond to theme changes. Fixed by injecting CSS custom properties directly via JavaScript on every toggle and replacing hardcoded values with var(--bg-primary), var(--text-primary) throughout all components.
Next.js 14 App Router + NextAuth
SessionProvider requires a client component wrapper in App Router. Created SessionProviderWrapper.tsx to bridge the server/client boundary without breaking SSR of the root layout.
AI Chatbot Multilingual Support The Groq Llama 3 model automatically detects the user's language and responds in English, Bengali, or Banglish. The system prompt includes the instruction: "Reply in the same language as the user."
Licensed under MIT · Built with dedication by Rafiul Islam
If this project helped you, consider giving it a ⭐




