InputGears—TechGadgetStore

The Challenge
Building a complex shopping cart system that persists state across reloads without hydration errors, while ensuring secure user authentication and inventory synchronization with a PostgreSQL database.
TECHNOLOGIES USED
🎨 Frontend
⚙️ Backend
🗄️ Database
🚀 DevOps
The Solution
→ Zustand state management for instant cart interactions. → Better-Auth for secure, type-safe credential & social logins. → Next.js 16 App Router + Prisma ORM for ACID-compliant order transactions. → Stripe integration for secure webhook-based payments.
System Architecture & Security
src/├── app/ # Next.js App Router│ ├── (admin)/ # Secure Dashboard Routes│ ├── (home)/ # Public Storefront│ └── api/ # Backend API & Webhooks├── components/ # Global Reusable UI├── lib/ # Core Configurations│ ├── prisma.ts # Database ORM Client│ └── redis.ts # Upstash Caching Layer└── modules/ # Domain-Driven Core (DDD) ├── admin/ # RBAC & Inventory Logic ├── auth/ # Better-Auth Integration ├── cart/ # Zustand State & Actions ├── checkout/ # Stripe Payment Flows └── products/ # Catalog & Search LogicSecurity Model
Role-Based Access Control
Full system and database access.
Inventory, order fulfillment, and coupon management.
Product descriptions and review moderation.
Cart, wishlist, and personal order history.
Secured via Better-Auth sessions and middleware edge-routing.
Type Safety
State Updates
Powered by Upstash Redis Caching
Performance Score
Key Decisions
Why Better Auth over Clerk?
Full control over auth logic, no vendor lock-in, type-safe session management.
Why Upstash Redis?
Serverless-compatible rate limiting and caching without managing infrastructure.
Why Domain-Driven Modules?
Features scale independently. Each module owns its own logic — easier to maintain and extend.
What I Learned
Hardest Part
Multi-role access control with 4 permission levels across storefront and admin — getting the middleware logic right took significant planning.
Biggest Insight
Redis caching strategy matters more than raw database optimization for read-heavy e-commerce pages.
Do Differently
I would implement optimistic UI updates for the cart actions to make the user experience feel even more instantaneous.
Key Highlights
Multi-Role Admin
Comprehensive role-based access control and inventory management dashboard.
Redis Caching
Lightning-fast data retrieval and session management using Upstash Redis.
Stripe + COD
Flexible checkout options supporting both secure Stripe payments and Cash on Delivery.
Domain-Driven Design
Scalable architecture separating core business logic from UI components.
Next Project