A full-stack luxury e-commerce storefront built with Next.js 14, Prisma, Supabase, and NextAuth. Includes a complete customer-facing storefront and a full-featured admin panel.
| Layer | Technology |
|---|---|
| Framework | Next.js 14 (App Router) |
| Language | TypeScript |
| Styling | Tailwind CSS + CSS custom properties |
| Database | PostgreSQL via Supabase |
| ORM | Prisma |
| Auth | NextAuth v4 (credentials provider) |
| State | Zustand (cart, UI) |
| Storage | Supabase Storage |
| Animations | Framer Motion |
| Charts | Recharts |
| UI Primitives | Radix UI |
- Home page with featured products, categories, hero banner
- Product listing with filters (category, price, brand, rating) and sorting
- Product detail page with variants (color/size), image gallery, reviews
- Persistent cart drawer with coupon codes, free-shipping progress bar
- Multi-step checkout (shipping → payment → confirmation) with order persistence
- Customer account page — order history, profile editing, wishlist
- Auth — register, login, forgot password, reset password
- Dashboard with live KPIs (revenue, orders, customers, AOV) and recent activity
- Analytics with 7d / 30d / 90d revenue charts and top-product breakdown
- Products CRUD — create/edit/delete with image upload to Supabase Storage
- Orders management — status updates, order detail drawer
- Customers list — view history, block/unblock
- Marketing — Flash Sales CRUD, Email Campaigns (draft → send)
- Coupons — percentage, fixed, and free-shipping types with expiry and usage limits
- Settings — store name, brand color (live preview), contact info, policies
- Node.js 18+
- A Supabase project (free tier works)
- npm or pnpm
git clone <repo-url>
cd ebuy-main
npm installCreate a .env.local file in the project root:
# NextAuth
NEXTAUTH_SECRET=your-random-secret-string-here
NEXTAUTH_URL=http://localhost:3000
# Supabase PostgreSQL (find in Supabase → Settings → Database)
DATABASE_URL="postgresql://postgres.<ref>:<password>@aws-1-<region>.pooler.supabase.com:6543/postgres?pgbouncer=true"
DIRECT_URL="postgresql://postgres.<ref>:<password>@aws-1-<region>.pooler.supabase.com:5432/postgres"
# Supabase client (find in Supabase → Settings → API)
NEXT_PUBLIC_SUPABASE_URL=https://<ref>.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=<your-anon-key>Generate
NEXTAUTH_SECRETwith:openssl rand -base64 32
npx prisma db pushThis creates all tables in your Supabase database. No migration files are needed for a fresh setup.
npx prisma db seedThis populates products, categories, demo users, and sample coupons.
Demo accounts created by the seed:
| Role | Password | |
|---|---|---|
| Admin | admin@ebuy.com | admin123 |
| Customer | jane@example.com | password123 |
In the Supabase Dashboard → SQL Editor, run the following to create the product image bucket and access policies:
INSERT INTO storage.buckets (id, name, public)
VALUES ('products', 'products', true)
ON CONFLICT (id) DO NOTHING;
CREATE POLICY "Public read access"
ON storage.objects FOR SELECT
USING (bucket_id = 'products');
CREATE POLICY "Authenticated users can upload"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (bucket_id = 'products');
CREATE POLICY "Authenticated users can update"
ON storage.objects FOR UPDATE
TO authenticated
USING (bucket_id = 'products');
CREATE POLICY "Authenticated users can delete"
ON storage.objects FOR DELETE
TO authenticated
USING (bucket_id = 'products');npm run devOpen http://localhost:3000 for the storefront and http://localhost:3000/admin for the admin panel.
src/
├── app/
│ ├── (storefront)/ # Public storefront pages
│ │ ├── page.tsx # Home
│ │ ├── products/ # Listing + detail
│ │ ├── checkout/ # Multi-step checkout
│ │ ├── account/ # Customer account
│ │ ├── login/
│ │ ├── register/
│ │ ├── forgot-password/
│ │ └── reset-password/
│ ├── admin/ # Admin panel pages
│ │ ├── page.tsx # Dashboard
│ │ ├── analytics/
│ │ ├── products/
│ │ ├── orders/
│ │ ├── customers/
│ │ ├── marketing/ # Flash sales + campaigns
│ │ └── settings/
│ └── api/ # API routes
│ ├── auth/ # NextAuth + register + forgot/reset password
│ ├── orders/
│ ├── products/
│ ├── profile/
│ ├── coupons/
│ └── admin/ # Admin-only endpoints
├── components/
│ ├── storefront/ # Header, CartDrawer, ProductCard, etc.
│ ├── admin/ # Sidebar, AdminHeader
│ └── providers.tsx # Settings context (storeName, brandColor)
├── lib/
│ ├── prisma.ts # Prisma client singleton
│ ├── settings.ts # Cached settings loader
│ ├── colorUtils.ts # Brand color → CSS variables
│ └── utils.ts # cn, formatPrice, formatDate, etc.
├── store/
│ ├── cartStore.ts # Zustand cart (persisted)
│ └── uiStore.ts # Zustand UI state
└── types/ # Shared TypeScript types
prisma/
├── schema.prisma
└── seed.ts
Store name and brand color can be changed live from Admin → Settings → General. Changes apply immediately without a redeploy:
- The color picker updates CSS variables in real time across the entire UI.
- The store name appears in the browser tab, storefront header, and email templates.
No email service is wired up by default. When a user requests a password reset, the reset link is returned directly in the UI so it can be used without an SMTP provider.
To connect a real email service, edit src/app/api/auth/forgot-password/route.ts and replace the // In production: send resetUrl via email comment with a call to your provider (Resend, SendGrid, etc.).
- Set all
.env.localvariables as environment variables in your hosting provider (Vercel, Railway, etc.). - Set
NEXTAUTH_URLto your production domain. - Generate a strong
NEXTAUTH_SECRETfor production. - Run
npx prisma db pushagainst your production database if it hasn't been seeded yet. - Run
npm run buildto verify there are no build errors before deploying.
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Production build |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npx prisma db push |
Push schema to database |
npx prisma db seed |
Seed demo data |
npx prisma studio |
Open Prisma database browser |