Kaufra is a high-performance full-stack, modern, and production-ready E-Commerce Web Application built using the latest Next.js 16 framework with React 19,It leverages a robust stack including Prisma, PostgreSQL, and Auth.js, secure authentication, integrated payments, admin dashboard, and a highly customizable UI toolkit.
Designed with scalability, developer experience, and real-world e-commerce flows in mind.
Your project uses the Next.js App Router, structured for clarity between public, protected, and admin spaces.
Kaufra/
βββ app/ # NEXT.JS 16 APP ROUTER
β βββ (auth)/ # Authentication Group
β β βββ sign-in/ # Login Page
β β βββ sign-up/ # Registration Page
β βββ (root)/ # Main Application Group
β β βββ cart/ # Shopping Cart UI
β β βββ order/ # Order Details & Summary
β β βββ payment-method/ # Payment Selection logic
β β βββ product/ # Dynamic [slug] Product Pages
β β βββ shipping-address/ # Checkout Shipping Step
β β βββ page.tsx # Home Page (Featured/New Arrivals)
β βββ admin/ # PROTECTED ADMIN PANEL
β β βββ main-nav.tsx # Dashboard Navigation
β β βββ orders/ # Order Management (CRUD)
β β βββ products/ # Inventory Management
β β βββ users/ # User Permissions/Management
β β βββ overview/ # Recharts Analytics Dashboard
β βββ api/ # BACKEND API ENDPOINTS
β β βββ auth/[...nextauth]/ # Auth.js Config
β β βββ uploadthing/ # Image Upload Handlers
β β βββ webhooks/ # Stripe/PayPal Webhook Listeners
β βββ user/ # PROTECTED USER DASHBOARD
β β βββ profile/ # Account Settings
β β βββ orders/ # Personal Order History
β βββ layout.tsx # Global Layout (Navbar/Footer)
βββ components/ # REUSABLE UI SYSTEM
β βββ admin/ # Admin-specific UI (Product Forms)
β βββ shared/ # Business Logic Components
β β βββ header/ # Navbar, Search, User Button
β β βββ product/ # Product Cards, Lists, Images
β β βββ checkout/ # Checkout Progress Stepper
β β βββ cart/ # Cart Table and Sidebars
β βββ ui/ # ShadCN UI Primitives (Button, Input, etc)
β βββ footer.tsx # Global Footer
βββ db/ # DATABASE LAYER
β βββ prisma.ts # Prisma Client Initialization
β βββ schema.prisma # PostgreSQL Models (Neon)
β βββ seed.ts # Sample Data for Testing
βββ email/ # REACT-EMAIL TEMPLATES
β βββ index.tsx # Purchase Receipts & Welcome Emails
βββ hooks/ # CUSTOM REACT HOOKS (use-cart, etc)
βββ lib/ # CORE UTILITIES & ACTIONS
β βββ actions/ # SERVER ACTIONS (No API fetch needed)
β β βββ product.actions.ts # CRUD for Products
β β βββ cart.actions.ts # Cart Management Logic
β β βββ order.actions.ts # Order Processing
β β βββ user.actions.ts # Profile & Role Updates
β βββ validators/ # ZOD SCHEMAS (Type-safe validation)
β βββ constants/ # Global Config (App Name, etc)
β βββ utils.ts # Tailwind Merge & Formatting
βββ public/ # STATIC ASSETS (Logo, Images)
βββ types/ # GLOBAL TYPES & INTERFACES
βββ middleware.ts # NEXT AUTH ROUTE PROTECTION
βββ tailwind.config.ts # THEME & DARK MODE CONFIG
- Public store pages are inside
(root)π - Auth pages live in
(auth)π - Admin section has its dedicated layout, routes & navigation π
- API routes handle auth, uploads, & webhooks server-side π
- Featured products & categories
- Product detail pages with image gallery & inventory
- Search & filters
- Product slug routing (via Slugify)
- Cart with quantities and dynamic totals
- Shipping address & payment workflow
- Fully responsive UX
You are using NextAuth with:
-
Credentials Provider (Email + Password)
-
Encrypted passwords via bcrypt
-
Sessions handled using Cookies + JWT
-
Role-based Authorization (Admin/User)
Additional future-ready providers supported in codebase:
- β‘ Google OAuth
- β¨ Magic Link
- Profile management
- Order history
- Saved shipping addresses
- Saved payment methods (optional)
Protected via roles & middleware with capabilities:
-
Manage Orders & Status
-
Manage Products (CRUD)
-
Manage Users & Roles
-
Admin Analytics + Revenue Charts (Recharts)
-
Upload product images via UploadThing
Supports multiple payment gateways:
πΉ PayPal
- React SDK
- Token generation
- Order capture
πΉ Stripe
- Server-side Payment Intents
- Webhooks for verification
Using React Email + Resend for transactional emails:
- Order confirmations
- User authentication flows
- Future: password reset & email verification
Built with modern UI tooling:
-
ShadCN UI (Composable components)
-
Tailwind CSS
-
Lucide Icons
-
Embla Carousel (Featured products slider)
The platform uses Next Themes to support:
- System theme sync
- Smooth toggling
- SSR-friendly hydration
The UI stays consistent across:
- Storefront pages
- Admin dashboard
- Auth pages
Authorization uses NextAuth + Middleware enforcing:
| Route Type | Requirements |
|---|---|
| Public | None |
| User Protected | Valid session |
| Admin Protected | Session AND role = "ADMIN" |
Examples:
| Path | Access |
|---|---|
/cart |
Public |
/order |
User |
/admin |
Admin only |
If unauthorized, users are:
- Redirected to sign-in
- Or given 403 pages (for admin access)
- Next.js 16 (App Router)
- React 19
- TypeScript
- Tailwind CSS
- ShadCN UI
- Embla Carousel
- Lucide Icons
- Next Themes (dark/light mode)
- Next.js Server Actions
- Route Handlers (
app/api) - NextAuth (Credentials Provider)
- Cookies + JWT Sessions
- Zod Validation
- Prisma ORM
- PostgreSQL via Vercel (Neon)
- Prisma migrations & seeders
- PayPal React SDK
- Stripe Checkout & Webhooks
- cash on delivery COD
- UploadThing (Product images)
- Resend
- React Email Templates
Managed via Prisma, featuring models such as:
User(with role field)ProductCategoryOrderOrderItemPaymentAddress
Supports migrations & seeding for development.
-
TypeScript-first codebase
-
Prisma type-safety to DB layer
-
Zod validation on inputs
-
ESLint formatting & linting
-
RHF for form management
-
Strict mode compliant
Standard .env example:
DATABASE_URL=
NEXTAUTH_SECRET=
NEXTAUTH_URL=
PAYPAL_CLIENT_ID=
PAYPAL_SECRET=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
RESEND_API_KEY=
UPLOADTHING_SECRET=
This project successfully demonstrates:
-
Full-stack ecommerce architecture
-
Real authentication & authorization
-
Modern SSR/ISR patterns via Next.js 16
-
Admin dashboard with real CRUD flows
-
Stripe + PayPal payment integration
-
Dark/Light theme capabilities
-
Transactional email system
-
Cloud Postgres setup via Vercel/Neon
-
Type-safe development environment
While building this platform, notable challenges included:
π Credential Flow with NextAuth
- Balancing cookie sessions + JWT-based flows required thoughtful config.
ποΈ Database Modeling
- Handling order β items β payments relationships required multi-step transactions.
π° Payment Webhooks
- Stripe webhook handling had to respect edge/server limitations.
π¦ File Uploads
- UploadThing + server actions coordination took careful setup.
π Admin UX
- Creating reusable admin UI patterns while remaining flexible.
Each challenge contributed to a more polished and production-ready result.