Admin Dashboard & Life Moments Concierge
A full-stack admin system with intelligent customer lifecycle automation. Built with Next.js, MongoDB, and WhatsApp API to revolutionize how luxury brands engage customers.









Project Overview
A comprehensive admin management system and intelligent customer lifecycle platform built for NACHI, a luxury gifting brand. This project involved architecting a scalable full-stack solution that combines e-commerce administration with an innovative AI-powered reminder system for special occasions.
The Challenge
NACHI needed more than a traditional admin panel. They wanted to revolutionize how they engaged with customers by proactively remembering life's important moments — birthdays, anniversaries, and special celebrations. The system had to:
Manage a complex product catalog with multi-variant items
Handle sophisticated discount logic (category-specific, product-specific, site-wide)
Automate customer reminders without being intrusive
Maintain data privacy across thousands of users
Scale gracefully under variable load
Technical Architecture
Stack
Frontend: Next.js 14 (App Router), TypeScript, TailwindCSS
Backend: Next.js API Routes, Node.js
Database: MongoDB with Mongoose ODM
Authentication: NextAuth.js with JWT
Automation: Cron Jobs (Vercel Cron)
Communication: WhatsApp Business API integration
Core Systems
1. Life Moments Engine
The crown jewel of this project — an intelligent lifecycle management system:
// Automated reminder generation based on date calculations- LifeMoment Model: Stores special dates with relationship metadata
- MomentReminder Model: Manages 3-tier notification system
→ 9 days before: Early gentle nudge
→ 3 days before: Urgent reminder
→ Day of: Last-chance notification
- Cron Job: Daily scan for upcoming events (O(n) optimized with indexing)
Key Innovation: Used recurring date calculations to handle annual events without duplicate entries:
if (moment.recurringAnnually) {const thisYearDate = new Date(currentYear, momentMonth, momentDay);
if (thisYearDate < today) {
thisYearDate.setFullYear(currentYear + 1);
}
}
2. Granular Discount System
Built a flexible discount engine supporting:
Site-wide campaigns (Black Friday, seasonal sales)
Category-specific (e.g., 20% off all jewelry)
Product-specific (SKU-level targeting)
Gift-only (applied to curated gift boxes)
Technical Challenge: Frontend-provided category data was unreliable.
Solution: Implemented server-side category validation:
// Fetched authoritative product data from DBconst productCategoryMap = new Map(
products.map(p => [p._id.toString(), p.category.toString()])
);
// Validated against actual DB state, not client claims
const matchingItems = cartItems.filter(item =>
applicableCategories.includes(productCategoryMap.get(item.productId))
);
3. Security Implementation
Identified and fixed critical data isolation vulnerabilities:
Problem: Users could view each other's life moments due to fallback logic.
Solution: Implemented
requireUserAuth() middleware with session-based scoping:
export async function GET(req: NextRequest) {const session = await requireUserAuth();
const moments = await LifeMoment.find({
userId: session.user.id,
active: true
});
return NextResponse.json({ moments });
}
Key Features Delivered
Admin Dashboard
Real-time analytics: Pending reminders, conversion tracking, status filtering
Multi-tier filtering: Next 7 days, 3 days, today, all upcoming
WhatsApp integration: One-click reminder dispatch with pre-filled messages
Gift suggestion builder: Personalized product curation with discount codes
Concierge Portal (Customer-facing)
Multi-step registration flow with life moment capture
Auto-login after signup (seamless UX)
Personal dashboard with upcoming/past celebrations
Privacy-first design with explicit consent management
E-commerce Core
Product management with image optimization
Inventory tracking with low-stock alerts
Order management with status workflows
Review system (5-star ratings + text feedback)
Performance Optimizations
Database Indexing Strategy
LifeMomentSchema.index({ userId: 1, active: 1 });LifeMomentSchema.index({ date: 1, active: 1 });
MomentReminderSchema.index({ eventDate: 1, status: 1 });
Model Cache Management Solved Next.js hot-reload schema conflicts:
if (process.env.NODE_ENV === 'development' && mongoose.models.LifeMoment) {delete mongoose.models.LifeMoment; // Force re-registration
}
Query Optimization Used MongoDB aggregation pipelines for dashboard stats:
const stats = await MomentReminder.aggregate([{ $match: { status: 'pending', eventDate: { $gte: today } } },
{ $group: { _id: '$status', count: { $sum: 1 } } }
]);
Challenges & Solutions
Challenge 1: Recurring Date Logic
Problem: How to show "next occurrence" of annual events without creating duplicate records?
Solution: Dynamic date calculation in cron job + admin dashboard, using current year as baseline and adjusting forward if date passed.
Challenge 2: Schema Evolution
Problem: Added relationshipType: 'self' enum value, but Mongoose cached old schema.
Solution: Conditional model re-registration in development mode to force schema updates without server restart.
Challenge 3: Category Discount Validation
Problem: Cart items had undefined category field, breaking validation.
Solution: Refactored API to fetch authoritative product data from database and create productCategoryMap for reliable validation.
Impact & Results
Automation: Eliminated manual reminder tracking (100% automated via cron)
Accuracy: 0% data leakage post-security fix (multi-user isolation enforced)
UX: Reduced reminder dispatch time from ~5 minutes to 10 seconds (WhatsApp auto-open)
Scalability: System handles 1000+ concurrent moments with <200ms query time
Technical Highlights
TypeScript Excellence: Strict typing across 50+ API routes, 30+ components
Error Handling: Graceful degradation with detailed logging and user-friendly messages
Code Quality: Modular architecture with reusable components and utilities
Documentation: Inline comments, API documentation, system architecture diagrams
Future Roadmap
Analytics Dashboard: Revenue trends, conversion rates, top products
Email Integration: Parallel notification system for email-preferring users
AI Recommendations: ML-based product suggestions using interest tagging
Payment Gateway: Stripe integration for online checkout
Lessons Learned
Never trust client-side data for critical business logic — Always validate server-side
Session management is non-negotiable — Implement from day one, not as an afterthought
Hot reload !== prod behavior — Model caching in Next.js requires careful handling
User privacy is paramount — Data isolation must be tested rigorously
Tech Stack Summary
Frontend: Next.js 14 | TypeScript | TailwindCSS | Framer Motion
Backend: Node.js | NextAuth.js | Mongoose ODM
Database: MongoDB (indexed queries)
DevOps: Vercel (hosting + cron) | Git (version control)
APIs: WhatsApp Business API
Lines of Code: ~15,000+
Components: 40+ React components
API Endpoints: 50+ REST routes
Models: 10+ Mongoose schemas
