A comprehensive platform combining premium accessories e-commerce with Lodge Internet services, built with Next.js 14, Firebase, and Paystack.
- Modern Product Catalog - Beautiful, responsive product browsing with advanced filtering
- Category Navigation - Apple Store-style horizontal category navigation
- Product Detail Pages - High-quality image galleries, descriptions, and specifications
- Smart Shopping Cart - Persistent cart that saves across browser sessions
- Discount System - Show original prices with discount percentages and badges
- Inventory Management - Smart stock tracking with "Out of Stock", "Back in Stock" badges
- Coming Soon Products - Countdown timers for unreleased products
- Secure Checkout - Integrated Paystack payment gateway for Nigerian Naira (β¦)
- Mobile Responsive - Perfect experience on all devices
- Product Management - Add, edit, and delete products with advanced options
- Category Management - Create and organize product categories
- Section Management - Organize homepage sections and layout
- Inventory Tracking - Monitor stock levels, featured products, and availability dates
- Order Management - View, track, and manage customer orders
- Image Upload - Direct uploads to Cloudinary CDN for optimized images
- No Coding Required - User-friendly interface for non-technical users
- Multi-Device Plans - 3-device and 5-device WiFi access plans
- Instant Code Generation - Encrypted access codes for secure WiFi access
- Automated Email Delivery - Customers receive access codes via email instantly
- Purchase Logging - Complete audit trail of all code purchases
- Admin Code Management - Bulk code upload, monitoring, and management
- Paystack Integration - Secure payment processing for data plans
- Subscription Management - Duration-based TV access plans
- User Account System - Individual dashboards for TV subscribers
- MAC Address Encryption - Secure storage of device identifiers
- Admin Activation Control - Manual subscription activation workflow
- Automated Expiry Management - Smart checking and notification system
- Renewal System - Easy subscription renewal process
- Device Code Emails - Instant delivery of access codes with plan details
- TV Subscription Lifecycle - Creation, activation, expiry warnings, and expired notifications
- Admin Notifications - Real-time alerts for new subscriptions requiring activation
- Custom Email Templates - Professional HTML emails with branding
- Email Preferences - User control over notification types
- Data Code Dashboard - Monitor code inventory, add bulk codes, view purchase logs
- TV User Management - Activate subscriptions, manage users, handle renewals
- Purchase Analytics - Track revenue, popular plans, and user activity
- Automated Expiry Monitoring - Daily cron jobs check subscriptions and send notifications (see CRON_JOB_GUIDE.md)
- Customer Feedback - Review system and complaint management
- MAC Address Migration - Tools for updating user device information
- Data Encryption - AES-256 encryption for sensitive data (access codes, MAC addresses)
- Secure Authentication - Protected admin routes with role-based access
- Firebase Security Rules - Comprehensive database access controls
- Firestore Database - Fast, scalable NoSQL database with real-time updates
- Optimized Images - Automatic image optimization via Cloudinary CDN
- Email Security - Secure SMTP with app passwords and rate limiting
- Environment Variables - Secure credential management for all services
- SEO Friendly - Built with Next.js 14 App Router for optimal performance
β‘ 5-Minute Setup - Read QUICK_START.md for the fastest way to get running!
π Detailed Guide - Read SETUP_GUIDE.md for complete instructions.
- Node.js 18+ installed
- A Firebase account (free)
- A Paystack account (free to start)
- Clone and Install
git clone <your-repo>
cd davnex
npm install- Configure Environment Variables
Copy .env.local and add your credentials:
# Firebase Configuration
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_domain.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_bucket.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
# Paystack Configuration (Payment Processing)
NEXT_PUBLIC_PAYSTACK_PUBLIC_KEY=pk_test_your_public_key
NEXT_PUBLIC_PAYSTACK_SECRET_KEY=sk_test_your_secret_key
# Cloudinary Configuration (Image CDN)
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloud_name
NEXT_PUBLIC_CLOUDINARY_API_KEY=your_api_key
NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET=your_upload_preset
# Admin Authentication
ADMIN_USERNAME=davo
ADMIN_PASSWORD=davo
# Lodge Internet Security (Server-side only)
DATA_CODE_SECRET_KEY=your_32_byte_hex_encryption_key
# Cron Job Authentication
CRON_SECRET=xkV0OTYlC2pnn4cVRQ8D3yZsXJhtmFvRw7LECcGVE1U=
# Email Configuration (SMTP)
EMAIL_APP_PASSWORD=your_gmail_app_password
EMAIL_FROM=your_email@gmail.com
ADMIN_EMAIL=admin_notifications@gmail.com
NEXT_PUBLIC_BASE_URL=http://localhost:3000| Variable | Purpose | Required |
|---|---|---|
NEXT_PUBLIC_FIREBASE_* |
Firebase SDK configuration | β Yes |
NEXT_PUBLIC_PAYSTACK_* |
Payment processing | β Yes |
NEXT_PUBLIC_CLOUDINARY_* |
Image hosting & optimization | β Yes |
ADMIN_USERNAME/PASSWORD |
Admin dashboard access | β Yes |
DATA_CODE_SECRET_KEY |
Encrypts Lodge Internet access codes | β Yes |
CRON_SECRET |
Authenticates automated cron jobs | β Yes |
EMAIL_APP_PASSWORD |
Gmail SMTP authentication | β Yes |
EMAIL_FROM |
Sender email address | β Yes |
ADMIN_EMAIL |
Receives subscription notifications | β Yes |
NEXT_PUBLIC_BASE_URL |
Used in email templates | β Yes |
- Run Development Server
npm run devOpen http://localhost:3000 π
davnex/
βββ app/ # Next.js 14 App Router
β βββ (main)/ # Main e-commerce application
β β βββ admin/
β β β βββ dashboard/ # Product & content management
β β β βββ data-codes/ # Lodge Internet code management
β β β βββ tv-users/ # TV subscription management
β β β βββ purchase-logs/ # Sales analytics & logs
β β βββ api/
β β β βββ data-codes/ # Device access code APIs
β β β β βββ claim/ # Code purchase & delivery
β β β β βββ add/ # Bulk code upload
β β β β βββ feedback/ # Customer feedback system
β β β βββ tv/ # TV subscription APIs
β β β β βββ purchase/ # Subscription creation
β β β β βββ activate/ # Admin activation
β β β β βββ check-expiry/ # Automated expiry management
β β β βββ email/ # Email notification APIs
β β βββ cart/ # E-commerce shopping cart
β β βββ checkout/ # Payment processing
β β βββ product/[id]/ # Dynamic product pages
β β βββ category/[slug]/ # Category browsing
β β βββ page.tsx # E-commerce homepage
β βββ (standalone)/ # Standalone applications
β β βββ internet/ # Lodge Internet portal
β β βββ page.tsx # Device & TV plan selection
β β βββ dashboard/ # TV user dashboard
β β βββ login/ # TV user authentication
β βββ layout.tsx # Root layout
βββ components/
β βββ admin/ # Admin-only components
β β βββ ProtectedRoute.tsx # Authentication middleware
β βββ sections/ # Homepage sections
β β βββ ComingSoonSection.tsx # Product countdown timers
β β βββ DynamicSection.tsx # Configurable product sections
β β βββ LatestProducts.tsx # Featured product displays
β βββ AuthModal.tsx # User authentication modal
β βββ CategoryNavigation.tsx # Horizontal category bar
β βββ CountdownTimer.tsx # Coming soon product countdown
β βββ Header.tsx # Site navigation with cart
β βββ Footer.tsx # Site footer
β βββ ProductBadge.tsx # Dynamic product status badges
βββ lib/
β βββ firebase.ts # Firebase configuration
β βββ cloudinary.ts # Image upload service
β βββ dataCodeCrypto.ts # Access code encryption
β βββ macAddressCrypto.ts # Device ID encryption
β βββ productUtils.ts # Product badge & availability logic
β βββ sections.ts # Homepage section management
β βββ email/
β βββ emailService.ts # SMTP email delivery
β βββ emailTemplates.ts # HTML email templates
βββ store/
β βββ cartStore.ts # E-commerce cart state
β βββ authStore.ts # Admin authentication
β βββ userStore.ts # User session management
βββ types/
β βββ index.ts # TypeScript definitions for all entities
βββ hooks/
β βββ useProducts.ts # Product fetching & management
β βββ useRecentlyViewed.ts # User browsing history
βββ .env.local # Environment variables (secrets)
βββ vercel.json # Vercel deployment & cron configuration
βββ CRON_JOB_GUIDE.md # Automated expiry monitoring guide
βββ EMAIL_NOTIFICATIONS_GUIDE.md # Email system documentation
βββ QUICK_START.md # 5-minute setup guide
βββ TIMESTAMP_FIX.md # Firebase timestamp handling guide
- Admin dashboards with full CRUD for products, categories, orders, and Lodge Internet services
- API routes for all business logic including payments, notifications, and data management
- Customer-facing pages for browsing, shopping, and checkout
- Standalone application for Lodge Internet services separate from e-commerce
- Device code purchasing with instant delivery and Paystack integration
- TV subscription management with user dashboards and account creation
- Professional HTML templates for all customer communications
- Automated lifecycle emails for subscriptions, renewals, and expiry warnings
- Admin notifications for new subscriptions requiring activation
- AES-256 encryption for sensitive access codes and device identifiers
- Hash functions for secure data storage while maintaining admin visibility
- Environment variable protection for all encryption keys
-
Login
- Navigate to
/admin/login - Default credentials:
davo/davo
- Navigate to
-
Product Management
- Click "Add New Product"
- Upload images via Cloudinary
- Set pricing with optional discount display
- Configure stock quantities and availability dates
- Set category and featured status
- Coming Soon Products: Set future availability date for countdown timer
-
Category Management
- Create product categories with images
- Set display order for navigation bar
- Enable/disable categories dynamically
-
Order Management
- View all customer orders with status tracking
- Update order status (packing β on-the-way β delivered)
- Monitor payment status and delivery methods
-
Code Management (
/admin/data-codes)- Bulk Upload: Upload hundreds of encrypted access codes
- Monitor Inventory: Track code availability by plan (3-device, 5-device)
- Purchase Logs: View all code sales with customer details
- Customer Feedback: Review customer reviews and handle complaints
-
Customer Purchase Flow
- Customer selects device plan (3 or 5 devices) at
/internet - Pays via Paystack integration
- Receives encrypted access code via email instantly
- Code is permanently deleted from inventory
- Customer selects device plan (3 or 5 devices) at
-
Subscription Management (
/admin/tv-users)- Pending Tab: New subscriptions requiring activation
- Active Tab: Currently active subscribers with expiry dates
- Expired Tab: Expired subscriptions needing renewal
- Manual Activation: Approve subscriptions after payment
-
TV User Dashboard (
/internet/dashboard)- Users can view subscription status, expiry dates
- Access renewal options
- Update account information
-
Automated Features (π CRON_JOB_GUIDE.md)
- Daily Cron Jobs: Automated subscription monitoring via Vercel Cron or GitHub Actions
- Expiry Checking: Automatic daily checks for expiring/expired subscriptions at 9 AM UTC
- 24-Hour Warnings: Email notifications sent to customers 24 hours before expiry
- Expiry Notifications: Automatic status updates and customer notifications when subscriptions expire
- Admin Summaries: Daily email reports with statistics and actionable insights
- MAC Address Security: Device identifiers encrypted for privacy
The platform automatically sends professional HTML emails for:
- Purchase Confirmation: Includes access code, plan details, and usage instructions
- Sent to: Customer immediately after payment
- Creation: Welcome email with subscription details (pending activation)
- Activation: Confirmation when admin activates subscription
- Expiry Warning: 24-hour reminder with renewal link
- Expired: Service inactive notification with renewal options
- Admin Alerts: New subscription notifications requiring activation
- Browse - View products with category filtering
- Filter - Use category navigation or search
- Select - Click product for detailed view with image gallery
- Add to Cart - Smart cart with quantity management
- Checkout - Secure Paystack payment processing
- Track - Order status updates and email notifications
- Select Plan - Choose device (WiFi) or TV plan at
/internet - Payment - Secure Paystack processing
- Device Codes: Instant email delivery with access instructions
- TV Subscriptions: Account creation + admin activation workflow
- Management - Dashboard access for TV users
- Select - Click product to view details
- Add to Cart - Click "Add to Cart" button
- Checkout - Click cart icon, proceed to checkout
- Pay - Complete payment via Paystack
- Confirm - Receive order confirmation
| Technology | Purpose |
|---|---|
| Next.js 14 | React framework with App Router |
| TypeScript | Type-safe development |
| Tailwind CSS | Utility-first styling |
| Firebase Firestore | NoSQL database |
| Firebase Storage | File storage (legacy products) |
| Zustand | State management |
| Service | Purpose |
|---|---|
| Paystack | Payment processing |
| Cloudinary | CDN & image optimization |
| Nodemailer | Email delivery service |
| Technology | Purpose |
|---|---|
| Crypto (Node.js) | AES-256 encryption for codes |
| MAC Address Hashing | Secure device identification |
| SMTP Email | Transactional notifications |
| Firebase Auth | User authentication & sessions |
| Automated Cron Jobs | Expiry checking & notifications |
| Tool | Purpose |
|---|---|
| Lucide React | Icon library |
| React Hot Toast | Notification system |
| Firebase Admin SDK | Server-side Firebase operations |
Use these test cards in test mode:
| Card Number | CVV | Expiry | Result |
|---|---|---|---|
| 4084 0840 8408 4081 | 408 | Any future | Success |
| 5060 6666 6666 6666 | 123 | Any future | Success |
- Never commit
.env.local- It contains your secret keys - Change default admin password - Edit
store/authStore.tsbefore production - Use Firebase security rules - Already configured in setup guide
- Enable Paystack live mode - Only after completing business verification
-
Prepare for Deployment
npm run build # Test build locally -
Deploy to Vercel
- Push code to GitHub/GitLab
- Import project in Vercel
- Add all environment variables from
.env.local - Deploy!
-
Post-Deployment Setup
- Update
NEXT_PUBLIC_BASE_URLwith your domain - Configure Gmail app passwords for production email
- Switch Paystack to live mode (after business verification)
- Set up Cloudinary production environment
- Update
# All NEXT_PUBLIC_* variables (Firebase, Paystack, Cloudinary)
# EMAIL_* variables for notifications
# DATA_CODE_SECRET_KEY for Lodge Internet security
# ADMIN_* credentials (change defaults!)Critical Security:
- Generate new encryption keys for
DATA_CODE_SECRET_KEY - Change default admin credentials
- Enable Firebase security rules
- Use Paystack live keys only after verification
-
Environment Variables
- Never commit
.env.localto version control - Use different encryption keys for production
- Rotate keys periodically for enhanced security
- Never commit
-
Admin Security
- Change default admin password immediately
- Use strong passwords (12+ characters)
- Consider implementing 2FA for production
-
Payment Security
- Test thoroughly with Paystack test cards
- Enable live mode only after business verification
- Monitor transactions for unusual activity
-
Email Security
- Use app passwords, never regular passwords
- Monitor email sending limits and quotas
- Set up email authentication (SPF, DKIM)
-
Database Security
- Firebase security rules are configured
- Regular backups recommended for production
- Monitor usage and set billing alerts
- Product Management: Full CRUD with advanced options (discounts, stock, coming soon dates)
- Category System: Apple Store-style navigation with dynamic categories
- Advanced Inventory: Stock badges, coming soon countdown timers, back-in-stock alerts
- Shopping Cart: Persistent cart with quantity management and session storage
- Secure Checkout: Paystack integration with Nigerian Naira support
- Order Tracking: Complete order lifecycle management with status updates
- Admin Dashboard: Comprehensive management interface with analytics
- Image Management: Cloudinary CDN integration with automatic optimization
- Mobile Responsive: Perfect experience across all device sizes
- Instant Code Delivery: Encrypted access codes via email within seconds
- Multi-Device Plans: 3-device and 5-device WiFi access options
- Bulk Code Management: Admin tools for uploading and managing thousands of codes
- Purchase Analytics: Complete sales tracking and customer insights
- Customer Feedback: Review system and complaint management
- Security: AES-256 encryption for all access codes
- Subscription Lifecycle: Complete flow from purchase to activation to expiry
- User Dashboards: Individual subscriber portals with account management
- Admin Controls: Manual activation, user management, and analytics
- MAC Address Security: Encrypted device identifier storage
- Automated Expiry: Daily checking with email notifications
- Renewal System: Seamless subscription renewal workflow
- Professional Templates: HTML emails with consistent branding
- Device Code Emails: Instant delivery with plan details and instructions
- TV Subscription Emails: Creation, activation, expiry warnings, and expired notifications
- Admin Notifications: Real-time alerts for actions requiring attention
- SMTP Integration: Reliable email delivery via Gmail/SMTP
- Data Encryption: AES-256 for sensitive codes and device identifiers
- Firebase Security Rules: Comprehensive database access controls
- Admin Authentication: Secure login with protected routes
- Environment Security: All secrets properly configured in environment variables
- Payment Security: Paystack integration with test/live mode support
- Email Security: App passwords and secure SMTP configuration
- Customer Accounts: User registration and order history
- Product Search: Full-text search with filters and sorting
- Product Reviews: Customer rating and review system
- Wishlist System: Save products for later purchase
- Multi-currency: Support for USD, GBP alongside NGN
- Shipping Calculator: Dynamic shipping costs based on location
- Self-Service Activation: Automated TV subscription activation
- Usage Analytics: Data usage tracking for device codes
- Bulk Renewals: Admin tools for bulk subscription management
- Mobile App: React Native app for Lodge Internet users
- API Integration: Third-party integrations for enhanced services
- Advanced Reporting: Business intelligence and analytics dashboard
- Progressive Web App: PWA features for better mobile experience
- Real-time Notifications: WebSocket-based live updates
- Backup Systems: Automated data backup and recovery
- Multi-language: Internationalization support
- Performance Monitoring: Error tracking and performance analytics
- QUICK_START.md - Fast setup and new features guide
- CRON_JOB_GUIDE.md - Automated TV subscription expiry monitoring
- EMAIL_NOTIFICATIONS_GUIDE.md - Complete email system documentation
- TIMESTAMP_FIX.md - Firebase timestamp handling guide
- Next.js Documentation
- Firebase Documentation
- Paystack API Docs
- Tailwind CSS Docs
- Cloudinary Docs
- Nodemailer Guide
This project is for educational and commercial use. Built for Davnex Store and Lodge Internet services.
Built with β€οΈ using:
- Next.js 14 - React framework with App Router
- Firebase - Database, authentication, and hosting
- Paystack - Nigerian payment processing
- Cloudinary - Image optimization and CDN
- Tailwind CSS - Utility-first styling
- TypeScript - Type-safe development
- Nodemailer - Email delivery service
- Lucide React - Beautiful icons
- Store Homepage: http://localhost:3000
- Admin Panel: http://localhost:3000/admin/login
- Product Catalog: http://localhost:3000 (main page)
- Shopping Cart: http://localhost:3000/cart
- Checkout: http://localhost:3000/checkout
- Internet Portal: http://localhost:3000/internet
- TV User Dashboard: http://localhost:3000/internet/dashboard
- TV User Login: http://localhost:3000/internet/login
- Main Dashboard: http://localhost:3000/admin/dashboard
- Data Codes Management: http://localhost:3000/admin/data-codes
- TV Users Management: http://localhost:3000/admin/tv-users
- Purchase Logs: http://localhost:3000/admin/purchase-logs
- Admin Login:
davo/davo - Change these in production!
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm run start
# Lint code
npm run lintDavnex - Premium Accessories & Lodge Internet Services π
Combining the best of e-commerce with innovative internet service delivery.