A full-stack, production-quality cake shop web application built with Next.js 14, TypeScript, and modern web technologies. This application is architected to be deployed with minimal changes while currently using free-tier tools and mock services.
- Browse Products: View catalog with filtering, sorting, and search
- Product Customization: Customize cakes with size, flavor, frosting, eggless option, and custom messages
- Shopping Cart: Add, update, and remove items with persistent storage
- Checkout Flow: Complete order placement with delivery scheduling
- Order Tracking: View order history and real-time status updates
- Reviews & Ratings: Leave reviews for delivered orders
- Guest Checkout: Place orders without registration
- User Authentication: Secure login and registration
- Dashboard: Overview of products, orders, and users
- Product Management: Create, update, and delete products
- Order Management: View all orders, filter by status, and update order status
- User Management: View user accounts and toggle account status
- Review Moderation: Delete inappropriate reviews
- Framework: Next.js 14 (App Router)
- Language: TypeScript (strict mode)
- Styling: Tailwind CSS
- UI Components: shadcn/ui (Radix UI)
- Server State: TanStack Query (React Query)
- Client State: Zustand (cart & UI state)
- Database: PostgreSQL
- ORM: Prisma
- Auth: Auth.js (NextAuth) v5 beta
- Strategy: Credentials (email/password)
- Security: bcryptjs for password hashing
- Zod: Shared validation schemas (frontend & backend)
- Email: Mock service (console logging)
- Payment: Mock service (simulated processing)
- Node.js 18+ and npm
- PostgreSQL database (local or hosted)
- Clone the repository
git clone <repository-url>
cd Cake-Shop- Install dependencies
npm install- Set up environment variables
Create a .env file in the root directory:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/cakeshop?schema=public"
# NextAuth
AUTH_SECRET="your-secret-key-here-generate-with-openssl-rand-base64-32"
AUTH_URL="http://localhost:3000"
# Application
NEXT_PUBLIC_APP_URL="http://localhost:3000"Generate AUTH_SECRET:
openssl rand -base64 32- Set up the database
Create a PostgreSQL database, then run:
npx prisma generate
npx prisma db push- Run the development server
npm run devOpen http://localhost:3000 in your browser.
Install PostgreSQL and create a database:
createdb cakeshopUpdate DATABASE_URL in .env with your credentials.
- Create a free account at supabase.com
- Create a new project
- Go to Settings > Database
- Copy the connection string and update DATABASE_URL in
.env
- Create a free account at neon.tech
- Create a new project
- Copy the connection string and update DATABASE_URL in
.env
- Register a new user via
/auth/register - Connect to your database and update the user's role:
UPDATE users SET role = 'ADMIN' WHERE email = 'your-email@example.com';Use Prisma Studio:
npx prisma studioOr directly in database:
INSERT INTO categories (id, name, slug, description, "createdAt", "updatedAt")
VALUES
(gen_random_uuid(), 'Birthday Cakes', 'birthday-cakes', 'Celebration cakes for birthdays', NOW(), NOW()),
(gen_random_uuid(), 'Wedding Cakes', 'wedding-cakes', 'Elegant cakes for weddings', NOW(), NOW()),
(gen_random_uuid(), 'Custom Cakes', 'custom-cakes', 'Fully customized cakes', NOW(), NOW());Use the admin dashboard at /admin to create products after logging in as an admin.
The application uses service layers that can be easily replaced:
Currently: Console logging
To replace: Implement the EmailService interface with providers like SendGrid, AWS SES, Resend, or Postmark.
Currently: Mock service with simulated processing
To replace: Implement the PaymentService interface with Stripe, PayPal, Square, or Razorpay.
No UI changes required - just swap the service implementation!
- Push code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
DATABASE_URL="your-production-database-url"
AUTH_SECRET="generate-a-new-secret-for-production"
AUTH_URL="https://your-domain.com"
NEXT_PUBLIC_APP_URL="https://your-domain.com"- Clean Architecture: Separation of concerns (UI, business logic, data)
- Service Abstraction: Easy to swap external services
- Type Safety: Full TypeScript coverage
- Validation: Shared Zod schemas for frontend/backend
- Responsive Design: Mobile-first approach
- Performance: Optimized images, code splitting, caching
- Password hashing with bcryptjs
- JWT-based sessions
- Role-based access control (RBAC)
- Protected API routes
- Input validation with Zod
- SQL injection prevention with Prisma
MIT
Built with ❤️ using Next.js, TypeScript, and modern web technologies