A comprehensive, enterprise-grade nutrition application built with Next.js 15, TypeScript, and Firebase. Features AI-powered meal planning, comprehensive food database management, and advanced monitoring capabilities.
- AI-Powered Meal Planning - Generate personalized meal plans using Google's Gemini AI
- Comprehensive Food Database - Extensive food groups with nutritional information
- User Preferences Management - Dietary restrictions, allergies, and health goals
- Saved Combinations - Store and manage favorite food combinations
- Responsive Design - Modern, mobile-first user interface
- Multi-Layer Security - Rate limiting, input validation, XSS protection
- Firebase Authentication - Secure Google Sign-In with role-based access
- Input Sanitization - Comprehensive protection against injection attacks
- Security Headers - CSP, HSTS, X-Frame-Options, and more
- Audit Logging - Complete request/response tracking
- Real-Time Metrics - Performance, cache, and system monitoring
- Health Checks - Comprehensive application health monitoring
- Error Tracking - Detailed error logging and alerting
- Performance Analytics - Response time, throughput, and resource usage
- Cache Performance - Redis and in-memory cache monitoring
- Service Layer - Clean separation of business logic
- State Management - Zustand with Immer for immutable updates
- API Client - Centralized API management with retry logic
- Multi-Level Caching - Redis primary with in-memory fallback
- Type Safety - Full TypeScript coverage with Zod validation
- Node.js 18+ and npm 9+
- Firebase project with authentication enabled
- Google AI API key
- Redis instance (optional, for production)
# Clone the repository
git clone https://github.com/your-org/superhuman-nutrition.git
cd superhuman-nutrition
# Install dependencies
npm install
# Set up environment variables
cp env.example .env.local
# Edit .env.local with your configuration
# Run development server
npm run dev# Required environment variables
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id
NEXT_PUBLIC_AI_API_KEY=your_google_ai_api_key
# Optional Redis configuration
REDIS_URL=redis://localhost:6379# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
# Run tests in CI mode
npm run test:ci
# Type checking
npm run type-check# Development build
npm run build
# Production build
npm run build:production
# Staging build
npm run build:staging
# Bundle analysis
npm run analyze# Install Vercel CLI
npm i -g vercel
# Deploy to production
vercel --prod
# Deploy to preview
vercel# Build for production
npm run build:production
# Start production server
npm run start:production
# Use PM2 for process management
pm2 start npm --name "superhuman-nutrition" -- run start:production- API Documentation - Complete API reference
- Deployment Guide - Production deployment instructions
- Security Guide - Security best practices
- Monitoring Guide - Observability setup
src/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β βββ components/ # React components
β βββ pages/ # Application pages
βββ components/ # Shared components
βββ contexts/ # React contexts
βββ hooks/ # Custom React hooks
βββ lib/ # Core libraries
β βββ api/ # API client and services
β βββ cache/ # Caching system
β βββ monitoring/ # Performance monitoring
β βββ validation/ # Input validation
βββ middleware/ # API middleware
βββ store/ # State management
βββ types/ # TypeScript types
- Rate Limiting - Configurable request throttling
- Input Validation - Zod schema validation for all inputs
- XSS Protection - DOMPurify sanitization
- CSRF Protection - Built-in Next.js protection
- Security Headers - Comprehensive HTTP security headers
- Authentication - Firebase Auth with role-based access
- Audit Logging - Complete request/response tracking
# Overall health
GET /api/health
# Detailed metrics
GET /api/metrics- Response times and throughput
- Error rates and types
- Cache hit/miss ratios
- Memory and CPU usage
- Database performance
- External service health
- Performance degradation
- Error rate spikes
- Health check failures
- Resource usage thresholds
- Multi-Level Caching - Redis + in-memory fallback
- Bundle Optimization - Tree shaking and code splitting
- Image Optimization - Next.js automatic optimization
- CDN Ready - Static asset optimization
- Lazy Loading - Component and route lazy loading
- ESLint - Code quality and consistency
- Prettier - Code formatting
- TypeScript - Type safety and IntelliSense
- Jest - Unit and integration testing
- React Testing Library - Component testing
- Bundle Analyzer - Performance optimization
- Next.js 15 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- TailwindCSS - Utility-first CSS framework
- Firebase - Authentication and database
- Redis - Caching and session storage
- Google AI - Meal planning intelligence
- Jest - Testing framework
- ESLint - Linting
- Prettier - Code formatting
- Zod - Schema validation
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Write comprehensive tests
- Maintain code coverage above 80%
- Follow the established code style
- Update documentation for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: docs.your-domain.com
- Issues: GitHub Issues
- Email: [email protected]
- Status: status.your-domain.com
β
Production Ready - Enterprise-grade security and monitoring
β
Fully Tested - Comprehensive test coverage
β
Documented - Complete API and deployment documentation
β
Monitored - Real-time performance and health monitoring
β
Scalable - Multi-level caching and performance optimization
Built with β€οΈ using Next.js 15, TypeScript, and Firebase
Last updated: January 2024
Version: 1.0.0