LIS

⚡ Quick Reference Guide

🚀 Getting Started (5 Minutes)

# 1. Install dependencies
npm install

# 2. Setup environment
cp .env.example .env.local
# Edit .env.local with your values

# 3. Run development server
npm run dev

# 4. Open browser
# http://localhost:3000

📦 NPM Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm start            # Start production server
npm run lint         # Run ESLint
npm run type-check   # TypeScript type checking
npm test             # Run unit tests (watch mode)
npm run test:ci      # Run tests with coverage
npm run test:e2e     # Run E2E tests
npm run test:e2e:ui  # Run E2E tests with UI
npm run db:setup     # Setup database
npm run db:create-admin  # Create admin user

🔑 Key Features & Usage

Two-Factor Authentication

import TwoFactorSetup from '@/components/TwoFactorSetup'
<TwoFactorSetup />

Analytics

import { analytics } from '@/lib/advancedAnalytics'
analytics.track('event_name', { key: 'value' })

Push Notifications

import { subscribeToPush, showNotification } from '@/lib/pushNotifications'
await subscribeToPush()
await showNotification({ title: 'Hello', body: 'World' })

Caching

import { cache, CacheKeys, CacheTTL } from '@/lib/cache'
await cache.set('key', data, CacheTTL.LONG)
const data = await cache.get('key')

Internationalization

import { i18n } from '@/lib/i18n'
await i18n.init('en')
const text = i18n.t('key', { param: 'value' })

Monitoring

import monitoring from '@/lib/monitoring'
monitoring.info('message', { context })
monitoring.error('error', { context })

🎨 Components

Booking System

import BookingSystem from '@/components/BookingSystem'
<BookingSystem />

Quote Builder

import QuoteBuilder from '@/components/QuoteBuilder'
<QuoteBuilder />

Analytics Dashboard

import AnalyticsDashboard from '@/components/AnalyticsDashboard'
<AnalyticsDashboard />

Theme Customizer

import ThemeCustomizer from '@/components/ThemeCustomizer'
<ThemeCustomizer />

Knowledge Base

import KnowledgeBase from '@/components/KnowledgeBase'
<KnowledgeBase />

API Documentation

import APIDocumentation from '@/components/APIDocumentation'
<APIDocumentation />

🔌 API Endpoints

Bookings

POST /api/bookings
GET  /api/bookings?date=2025-12-15

Analytics

POST /api/analytics
GET  /api/analytics/dashboard?range=7d

2FA

POST /api/auth/2fa/setup
POST /api/auth/2fa/verify

Push Notifications

POST /api/push/send

Webhooks

POST /api/webhooks
GET  /api/webhooks

Health Check

GET /api/health

🔧 Configuration Files

Environment Variables (.env.local)

DATABASE_URL=postgresql://...
JWT_SECRET=...
EMAIL_HOST=smtp.gmail.com
EMAIL_USER=...
EMAIL_PASSWORD=...
REDIS_URL=redis://localhost:6379
SENTRY_DSN=...
NEXT_PUBLIC_VAPID_PUBLIC_KEY=...

Jest (jest.config.js)

// Already configured
// Run: npm test

Playwright (playwright.config.ts)

// Already configured
// Run: npm run test:e2e

CI/CD (.github/workflows/ci-cd.yml)

# Already configured
# Runs automatically on push/PR

📁 Important Directories

/app          - Next.js pages and API routes
/components   - React components
/lib          - Utility libraries
/public       - Static assets
/e2e          - E2E tests
/__tests__    - Unit tests
/.github      - CI/CD workflows

🐛 Common Issues & Solutions

Port Already in Use

npx kill-port 3000
# or
PORT=3001 npm run dev

Database Connection Error

# Check PostgreSQL is running
psql -l

# Verify DATABASE_URL in .env.local

Redis Connection Error

# Check Redis is running
redis-cli ping

# App will fallback to memory cache if Redis unavailable

Build Errors

# Clear cache and rebuild
rm -rf .next node_modules package-lock.json
npm install
npm run build

Test Failures

# Update snapshots
npm test -- -u

# Run specific test
npm test -- path/to/test.ts

🔐 Security Best Practices

  1. ✅ Never commit .env.local
  2. ✅ Use strong JWT_SECRET (32+ chars)
  3. ✅ Enable 2FA for admin accounts
  4. ✅ Keep dependencies updated
  5. ✅ Use HTTPS in production
  6. ✅ Configure CORS properly
  7. ✅ Validate all inputs
  8. ✅ Sanitize user data
  9. ✅ Use rate limiting
  10. ✅ Monitor error logs

📊 Monitoring

Health Check

curl http://localhost:3000/api/health

Logs

import monitoring from '@/lib/monitoring'
monitoring.getLogs(100)
monitoring.getMetrics(100)
monitoring.getHealthStatus()

Sentry (Production)

// Automatically captures errors
// View in Sentry dashboard

🚀 Deployment

npm i -g vercel
vercel

Docker

docker build -t app .
docker run -p 3000:3000 app

Manual

npm run build
npm start


🆘 Support


✅ Pre-Launch Checklist


🎯 Quick Commands

# Development
npm run dev

# Testing
npm test && npm run test:e2e

# Production Build
npm run build && npm start

# Type Check
npm run type-check

# Lint
npm run lint

# Database
npm run db:setup && npm run db:create-admin

# Deploy
vercel --prod

📈 Performance Tips

  1. Use caching for expensive operations
  2. Implement lazy loading for images
  3. Use code splitting for large components
  4. Enable Redis for production
  5. Use CDN for static assets
  6. Optimize images (WebP format)
  7. Minimize bundle size
  8. Use server-side rendering
  9. Implement pagination
  10. Monitor Core Web Vitals

🎉 You’re Ready!

Everything is set up and ready to go. Start building amazing features!

Happy Coding! 🚀


Built with ❤️ by Limitless Infotech Solution Pvt Ltd