An ecommerce demo application instrumented with Sentry for performance monitoring.
This demo is designed to showcase a full-stack ecommerce experience built with Next.js, from product browsing to checkout.
- Frontend: Next.js 14+ (App Router), React, TypeScript, Tailwind CSS
- UI Components: shadcn/ui
- State Management: Zustand (cart management)
- Database: PostgreSQL (Neon DB)
- ORM: Drizzle ORM
- Images: Unsplash API
- Monitoring: Sentry
- Node.js 18+ installed
- npm or yarn package manager
- Neon DB account (or any PostgreSQL database)
- Unsplash API access key
- Sentry account and DSN
Create a .env.local file in the root directory with the following variables:
# Database (Neon DB connection string)
DATABASE_URL=your_neon_database_url_here
# Sentry
NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn_here
SENTRY_ORG=your_sentry_org
SENTRY_PROJECT=your_sentry_project
# Unsplash API
UNSPLASH_ACCESS_KEY=your_unsplash_access_key_hereNeon DB:
- Go to Neon.tech
- Create a new project
- Copy the connection string from the dashboard
Unsplash API:
- Go to Unsplash Developers
- Create a new application
- Copy the Access Key
Sentry:
- Go to Sentry.io
- Create a new Next.js project
- Copy the DSN and project details
npm installPush the database schema to your Neon DB:
npm run db:pushPopulate the database with 100-150 random products from Unsplash:
npm run db:seedThis will:
- Generate 100-150 products with realistic data
- Fetch high-quality images from Unsplash (1 poster + 3-5 gallery images per product)
- Create 2-4 variants per product (colors, sizes, materials, etc.)
Note: Seeding may take 5-10 minutes due to Unsplash API rate limits.
npm run devOpen http://localhost:3000 in your browser.
- Homepage: Product grid with 24 products
- Product Details: Image gallery, variant selector, add to cart
- Shopping Cart: Quantity management, item removal, subtotal
- Checkout: Full checkout form with order summary
- Responsive Design: Mobile-first, works on all screen sizes
- Real Images: High-quality Unsplash images for realistic performance testing
├── src/
│ ├── app/
│ │ ├── api/products/ # API routes
│ │ ├── cart/ # Cart page
│ │ ├── checkout/ # Checkout flow
│ │ ├── products/[id]/ # Product details
│ │ └── page.tsx # Homepage
│ ├── components/
│ │ ├── ui/ # shadcn/ui components
│ │ ├── Header.tsx # Navigation header
│ │ ├── ProductCard.tsx # Product card component
│ │ └── ... # Other components
│ ├── db/
│ │ ├── schema.ts # Drizzle schema
│ │ ├── index.ts # Database connection
│ │ └── seed.ts # Seeding script
│ └── store/
│ └── cart.ts # Zustand cart store
├── drizzle.config.ts # Drizzle configuration
├── next.config.ts # Next.js + Sentry config
└── instrumentation.ts # Sentry instrumentation
If you see "Unable to load products":
- Verify your
DATABASE_URLin.env.local - Ensure your Neon DB is active
- Run
npm run db:pushagain
If seeding fails:
- Check your
UNSPLASH_ACCESS_KEY - Ensure you haven't hit Unsplash rate limits (50 requests/hour on free tier)
- Try running the seed script again later
If images don't load:
- Check if Unsplash images are accessible
- Verify Next.js image configuration in
next.config.ts - Check browser console for CORS errors
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run db:generate- Generate Drizzle migrationsnpm run db:push- Push schema to databasenpm run db:studio- Open Drizzle Studionpm run db:seed- Seed database with products
MIT