Skip to content

AlphaCentauri2026/SuperHumanNutrients

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Superhuman Nutrition - Production Ready

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.

✨ Features

🍎 Core Functionality

  • 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

πŸ”’ Enterprise Security

  • 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

πŸ“Š Advanced Monitoring

  • 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

πŸ—οΈ Architecture

  • 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

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm 9+
  • Firebase project with authentication enabled
  • Google AI API key
  • Redis instance (optional, for production)

Installation

# 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

Environment Configuration

# 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

πŸ§ͺ Testing

# 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

πŸ—οΈ Building

# Development build
npm run build

# Production build
npm run build:production

# Staging build
npm run build:staging

# Bundle analysis
npm run analyze

πŸš€ Deployment

Vercel (Recommended)

# Install Vercel CLI
npm i -g vercel

# Deploy to production
vercel --prod

# Deploy to preview
vercel

Self-Hosted

# 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

πŸ“š Documentation

πŸ—οΈ Architecture Overview

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

πŸ”’ Security Features

  • 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

πŸ“Š Monitoring & Observability

Health Checks

# Overall health
GET /api/health

# Detailed metrics
GET /api/metrics

Key Metrics

  • Response times and throughput
  • Error rates and types
  • Cache hit/miss ratios
  • Memory and CPU usage
  • Database performance
  • External service health

Alerting

  • Performance degradation
  • Error rate spikes
  • Health check failures
  • Resource usage thresholds

πŸš€ Performance Features

  • 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

πŸ”§ Development Tools

  • 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

πŸ“¦ Dependencies

Core

  • Next.js 15 - React framework with App Router
  • React 19 - UI library
  • TypeScript - Type safety
  • TailwindCSS - Utility-first CSS framework

Backend

  • Firebase - Authentication and database
  • Redis - Caching and session storage
  • Google AI - Meal planning intelligence

Development

  • Jest - Testing framework
  • ESLint - Linting
  • Prettier - Code formatting
  • Zod - Schema validation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Write comprehensive tests
  • Maintain code coverage above 80%
  • Follow the established code style
  • Update documentation for new features

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

πŸ† Production Status

βœ… 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

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors