Skip to content

Deploying CookCLI

Introduction

CookCLI is a powerful command-line toolkit designed for kitchen professionals, restaurant operators, and cooking enthusiasts who want to streamline their recipe management, meal planning, and kitchen operations. It combines the efficiency of command-line interfaces with the depth of professional kitchen management tools.

CookCLI transforms how kitchens handle the complexity of recipe management at scale. Instead of juggling spreadsheets and handwritten notes, CookCLI provides a unified system for organizing recipes, tracking ingredients, planning menus, managing inventory, and coordinating kitchen operations through an intuitive command-line interface.

Key Capabilities of CookCLI:

Recipe Management: Organize recipes with detailed instructions, ingredient lists, cooking times, and nutritional information. Search and filter recipes by cuisine, ingredient, preparation time, or dietary requirements.

Ingredient Tracking: Maintain ingredient databases with costs, suppliers, shelf life, and storage requirements. Track inventory levels and get alerts when items run low.

Meal Planning: Plan menus for days, weeks, or seasons. Automatically generate shopping lists based on planned meals. Identify ingredient overlaps to minimize waste.

Nutritional Analysis: Automatically calculate nutritional information for dishes. Track dietary requirements and allergens. Generate nutritional reports for menu items.

Cost Analysis: Calculate recipe costs down to the ingredient level. Track food cost percentages. Analyze profitability by dish or menu category.

Kitchen Operations: Manage prep schedules, station assignments, and cooking workflows. Track which dishes use which ingredients for better coordination.

Batch Operations: Scale recipes up or down easily. Generate bulk ingredient lists from multiple recipes. Export reports in multiple formats.

Integration Ready: Export data to other systems via CSV, JSON, or API. Integrate with inventory management, accounting, and POS systems.

Team Collaboration: Share recipes and meal plans across your organization. Version control for recipe changes. Audit trails for compliance and food safety.

Whether you’re running a fine dining restaurant, managing a commercial kitchen, operating a catering service, or just organizing your home cooking, CookCLI provides the tools to manage it all from the command line.

This guide walks you through deploying CookCLI on Klutch.sh. You’ll learn how to set up the application server, configure persistent storage for your recipe databases and ingredient data, implement security best practices, optimize performance for your kitchen operations, and troubleshoot common issues in production.

Prerequisites

Before deploying CookCLI to Klutch.sh, ensure you have:

  • A Klutch.sh account with dashboard access
  • A GitHub account for repository hosting
  • Docker installed locally for testing (optional but recommended)
  • Understanding of command-line interfaces and terminal operations
  • Basic knowledge of recipe management and kitchen operations
  • Familiarity with JSON and CSV data formats
  • A domain name for API access (recommended)
  • Understanding of REST APIs and command-line tooling

Understanding CookCLI Architecture

Technology Stack

CookCLI is built on modern, scalable technologies:

Core Platform:

  • Go or Python backend for high performance
  • REST API for programmatic access
  • gRPC for efficient service-to-service communication
  • PostgreSQL or SQLite for recipe and ingredient data
  • Redis for caching and real-time updates

Data Processing:

  • Recipe parsing and validation
  • Ingredient scaling algorithms
  • Nutritional calculation engine
  • Cost analysis and reporting

Storage:

  • Persistent database for recipes, ingredients, and plans
  • File storage for images, documents, and attachments
  • Backup and versioning for recipe changes
  • Audit logs for compliance tracking

APIs and Integrations:

  • REST API for external access
  • Webhook support for event notifications
  • CSV/JSON import and export
  • Integration adapters for popular systems

Command-Line Interface:

  • Interactive REPL for exploration
  • Batch commands for automation
  • Streaming output for large datasets
  • Script-friendly JSON output formats

Core Components

API Server: REST and gRPC APIs handling recipe and inventory operations

Recipe Engine: Processing recipes, scaling, and nutritional calculations

Inventory System: Managing ingredients, costs, and stock levels

Planning Module: Meal planning and shopping list generation

Reporting Engine: Generating analysis reports and exports

User Management: Authentication and permission control

Database: Persistent storage for all recipe and operational data

Cache Layer: Redis for performance optimization

Installation and Setup

Step 1: Create Your Project Directory

Start with a dedicated directory for your CookCLI deployment:

Terminal window
mkdir cookcli-deployment
cd cookcli-deployment
git init

Step 2: Create Directory Structure

Set up the necessary directories for a production-ready deployment:

Terminal window
mkdir -p data logs config recipes backups

Your project structure will look like:

cookcli-deployment/
├── Dockerfile
├── docker-entrypoint.sh
├── .env.example
├── .dockerignore
├── .gitignore
├── config/
│ └── cookcli.yaml
├── data/
│ └── (database files)
├── recipes/
│ └── (recipe templates)
└── logs/
└── (application logs)

Step 3: Create the Dockerfile

Create a Dockerfile for a production-ready CookCLI deployment:

# Build stage
FROM golang:1.21-alpine as builder
WORKDIR /build
# Install dependencies
RUN apk add --no-cache \
git \
ca-certificates
# Clone or copy CookCLI source
# Option 1: Clone from repository
RUN git clone https://github.com/cookcli/cookcli.git . || true
# Build CookCLI
RUN go build -o cookcli ./cmd/cookcli
# Runtime stage
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache \
ca-certificates \
postgresql-client \
curl \
dumb-init
# Create app user
RUN addgroup -g 1000 cookcli && \
adduser -D -u 1000 -G cookcli cookcli
WORKDIR /app
# Copy binary from builder
COPY --from=builder --chown=cookcli:cookcli /build/cookcli ./
# Copy configuration
COPY --chown=cookcli:cookcli config/ ./config/
COPY --chown=cookcli:cookcli recipes/ ./recipes/
# Create necessary directories
RUN mkdir -p /app/data /app/logs /app/backups && \
chown -R cookcli:cookcli /app
# Switch to non-root user
USER cookcli
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Use dumb-init for proper signal handling
ENTRYPOINT ["dumb-init", "--"]
# Start CookCLI
CMD ["./cookcli", "server", "--port", "8080", "--config", "/app/config/cookcli.yaml"]

Step 4: Create Environment Configuration

Create .env.example for CookCLI configuration:

Terminal window
# Server configuration
PORT=8080
LOG_LEVEL=info
ENVIRONMENT=production
# Application settings
APP_NAME=CookCLI
APP_VERSION=1.0.0
# Database configuration
DATABASE_URL=postgresql://cookcli:password@localhost:5432/cookcli
DATABASE_POOL_SIZE=20
DATABASE_TIMEOUT=30
# Redis configuration (optional, for caching)
REDIS_URL=redis://localhost:6379/0
REDIS_PASSWORD=
# Authentication
AUTH_ENABLED=true
JWT_SECRET=your-secret-key-change-this
TOKEN_EXPIRY=3600
# Recipe settings
RECIPE_MAX_SERVING_SIZE=1000
RECIPE_SCALING_PRECISION=2
AUTO_CALCULATE_NUTRITION=true
# Ingredient management
INGREDIENT_PRICE_HISTORY=true
COST_UPDATE_FREQUENCY=daily
LOW_STOCK_THRESHOLD=10
# File upload settings
MAX_UPLOAD_SIZE=52428800
UPLOAD_DIR=/app/data/uploads
ALLOWED_EXTENSIONS=json,csv,pdf,jpg,png
# Meal planning
PLAN_FORECAST_DAYS=90
AUTO_GENERATE_SHOPPING_LIST=true
SHOPPING_LIST_FORMAT=grouped
# Backup settings
BACKUP_ENABLED=true
BACKUP_SCHEDULE=daily
BACKUP_DIR=/app/backups
BACKUP_RETENTION_DAYS=30
# Reporting
GENERATE_REPORTS=true
REPORT_FORMAT=pdf
COST_REPORT_FREQUENCY=weekly
# API settings
API_RATE_LIMIT=1000
API_TIMEOUT=30
ENABLE_SWAGGER=true

Step 5: Create Application Configuration

Create config/cookcli.yaml for detailed settings:

# CookCLI Configuration
application:
name: CookCLI
version: 1.0.0
description: Kitchen Recipe and Operations Management
server:
port: 8080
host: 0.0.0.0
log_level: info
timeout: 30
max_connections: 1000
database:
type: postgresql
host: localhost
port: 5432
name: cookcli
user: cookcli
pool_size: 20
timeout: 30
ssl_mode: require
redis:
enabled: false
host: localhost
port: 6379
db: 0
password: ""
ttl: 3600
recipes:
storage_path: /app/data/recipes
max_ingredients_per_recipe: 100
scaling_precision: 2
auto_calculate_nutrition: true
image_storage: /app/data/images
ingredients:
database_path: /app/data/ingredients
track_price_history: true
cost_update_frequency: daily
low_stock_threshold: 10
unit_conversions_enabled: true
meal_planning:
forecast_days: 90
auto_generate_shopping_list: true
shopping_list_format: grouped
duplicate_handling: smart
authentication:
enabled: true
jwt_secret: change-this-secret
token_expiry: 3600
session_timeout: 86400
file_operations:
upload_dir: /app/data/uploads
max_upload_size: 52428800
allowed_extensions:
- json
- csv
- pdf
- jpg
- png
backup:
enabled: true
schedule: daily
directory: /app/backups
retention_days: 30
compression: gzip
reporting:
enabled: true
formats:
- pdf
- csv
- json
cost_report_frequency: weekly
nutrition_report_enabled: true
api:
rate_limit: 1000
timeout: 30
enable_swagger: true
allowed_origins:
- "*"

Step 6: Create Docker Entry Script

Create docker-entrypoint.sh for container initialization:

#!/bin/sh
set -e
# Wait for database if configured
if [ ! -z "$DATABASE_URL" ]; then
echo "Waiting for database..."
until pg_isready -h localhost -U cookcli -d cookcli 2>/dev/null; do
printf '.'
sleep 1
done
echo "Database ready!"
fi
# Wait for Redis if configured
if [ ! -z "$REDIS_URL" ]; then
echo "Waiting for Redis..."
until redis-cli -h localhost ping > /dev/null 2>&1; do
printf '.'
sleep 1
done
echo "Redis ready!"
fi
# Create necessary directories
mkdir -p /app/data /app/logs /app/backups /app/data/uploads
# Set proper permissions
chmod 755 /app/data
# Run database migrations if needed
if [ "$RUN_MIGRATIONS" = "true" ]; then
echo "Running database migrations..."
./cookcli migrate --database "$DATABASE_URL"
fi
# Start CookCLI
echo "Starting CookCLI..."
exec "$@"

Make it executable:

Terminal window
chmod +x docker-entrypoint.sh

Step 7: Create Sample Recipe File

Create recipes/example-recipe.json to show recipe format:

{
"id": "recipe-001",
"name": "Classic Risotto Milanese",
"description": "Traditional Italian risotto with saffron and Parmesan",
"cuisine": "Italian",
"difficulty": "intermediate",
"prep_time_minutes": 15,
"cook_time_minutes": 25,
"servings": 4,
"calories_per_serving": 420,
"ingredients": [
{
"name": "Arborio Rice",
"quantity": 300,
"unit": "grams",
"cost_per_unit": 0.05,
"supplier": "Italian Foods Inc"
},
{
"name": "Saffron Threads",
"quantity": 1,
"unit": "gram",
"cost_per_unit": 10.00,
"supplier": "Specialty Spices"
},
{
"name": "Parmesan Cheese",
"quantity": 100,
"unit": "grams",
"cost_per_unit": 0.15,
"supplier": "Dairy Supplier"
}
],
"instructions": [
{
"step": 1,
"instruction": "Toast rice in butter for 2 minutes",
"duration_seconds": 120
},
{
"step": 2,
"instruction": "Add warm stock gradually, stirring constantly",
"duration_seconds": 1200
},
{
"step": 3,
"instruction": "Finish with saffron, butter, and Parmesan",
"duration_seconds": 120
}
],
"nutritional_info": {
"calories": 1680,
"protein_grams": 24,
"carbs_grams": 156,
"fat_grams": 36,
"fiber_grams": 2
},
"allergens": ["dairy"],
"dietary_tags": ["vegetarian"],
"cost_per_serving": 2.85
}

Step 8: Create package.json

Create package.json for deployment:

{
"name": "cookcli-deployment",
"version": "1.0.0",
"description": "CookCLI kitchen operations toolkit deployment",
"main": "index.js",
"scripts": {
"start": "cookcli server --port 8080",
"dev": "cookcli server --port 8080 --debug",
"build": "echo 'Build complete'"
},
"keywords": ["cooking", "recipes", "kitchen", "meal-planning"],
"author": "Your Team",
"license": "MIT"
}

Step 9: Create .dockerignore

Create .dockerignore:

.git
.gitignore
.env
.env.local
.env.*.local
.DS_Store
node_modules
npm-debug.log
data/*
logs/*
backups/*
.vscode
.idea
README.md
docs/
tests/
coverage/
.eslintrc
.github

Step 10: Create .gitignore

Create .gitignore:

# Environment
.env
.env.local
.env.*.local
# Application
node_modules/
package-lock.json
yarn.lock
# Data and logs
data/
logs/
backups/
*.log
npm-debug.log*
# Runtime
tmp/
.cache/
*.pid
# IDE
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# Testing
coverage/
.nyc_output

Step 11: Commit to GitHub

Push your CookCLI configuration to GitHub:

Terminal window
git add Dockerfile docker-entrypoint.sh .env.example config/ recipes/ package.json .dockerignore .gitignore
git commit -m "Add CookCLI kitchen operations toolkit Docker configuration for Klutch.sh deployment"
git branch -M main
git remote add origin https://github.com/yourusername/cookcli-deployment.git
git push -u origin main

Deploying to Klutch.sh

Now let’s deploy CookCLI to Klutch.sh with proper configuration and persistent storage for recipes and ingredient databases.

Deployment Steps

  1. Access Klutch.sh Dashboard

    Navigate to klutch.sh/app and sign in with your GitHub account. This is where you’ll manage your CookCLI deployment.

  2. Create a New Project

    In the Projects section, click “Create Project” and name it something like “Kitchen Operations” or “Recipe Management Platform”.

  3. Create a New App

    Within your project, click “Create App” to begin configuring your CookCLI deployment.

  4. Connect Your Repository
    • Select GitHub as your Git source
    • Choose the repository where you pushed your CookCLI Dockerfile
    • Select the branch to deploy (typically main)

    Klutch.sh will automatically detect the Dockerfile in your repository root.

  5. Configure Traffic Settings
    • Traffic Type: Select HTTP (CookCLI API is a web service)
    • Internal Port: Set to 8080 (CookCLI default API port)

    This allows applications and users to access the CookCLI API over HTTPS.

  6. Configure Environment Variables

    Add the following environment variables to configure your CookCLI instance:

    Server Configuration:

    PORT=8080
    LOG_LEVEL=info
    ENVIRONMENT=production
    APP_NAME=CookCLI Kitchen Operations

    Database Configuration:

    For PostgreSQL (recommended for production):

    DATABASE_URL=postgresql://cookcli:password@hostname:5432/cookcli
    DATABASE_POOL_SIZE=20
    DATABASE_TIMEOUT=30
    RUN_MIGRATIONS=true

    For SQLite (simpler, single-server deployments):

    DATABASE_TYPE=sqlite
    DATABASE_PATH=/app/data/cookcli.db

    Authentication and Security:

    AUTH_ENABLED=true
    JWT_SECRET=generate-a-strong-random-secret-here
    TOKEN_EXPIRY=3600

    Recipe and Ingredient Management:

    RECIPE_MAX_SERVING_SIZE=1000
    RECIPE_SCALING_PRECISION=2
    AUTO_CALCULATE_NUTRITION=true
    INGREDIENT_PRICE_HISTORY=true
    LOW_STOCK_THRESHOLD=10

    Meal Planning Configuration:

    PLAN_FORECAST_DAYS=90
    AUTO_GENERATE_SHOPPING_LIST=true
    SHOPPING_LIST_FORMAT=grouped

    File Upload Settings:

    MAX_UPLOAD_SIZE=52428800
    UPLOAD_DIR=/app/data/uploads
    ALLOWED_EXTENSIONS=json,csv,pdf,jpg,png

    Backup and Reporting:

    BACKUP_ENABLED=true
    BACKUP_SCHEDULE=daily
    BACKUP_RETENTION_DAYS=30
    GENERATE_REPORTS=true
    REPORT_FORMAT=pdf

    Optional: Redis for Caching (improves performance):

    REDIS_URL=redis://your-redis-server:6379/0

    Security Notes:

    • Generate a strong JWT_SECRET using a random string generator
    • Use HTTPS for all API calls (automatic with Klutch.sh)
    • Rotate authentication tokens regularly
    • Keep DATABASE_URL and JWT_SECRET secure
    • Restrict file upload sizes appropriately
    • Monitor backup storage usage
  7. Configure Persistent Storage

    CookCLI needs persistent storage to maintain recipes, ingredient data, and operational history:

    Volume 1 - Application Data:

    • Mount Path: /app/data
    • Size: 10-50 GB (depends on recipe count and image storage)

    Volume 2 - Backups:

    • Mount Path: /app/backups
    • Size: 20-100 GB (depends on backup retention and frequency)

    Guidelines for volume sizes:

    • Small kitchen (< 500 recipes, < 500 ingredients): 10 GB data, 20 GB backups
    • Medium kitchen (500-5000 recipes, 500-2000 ingredients): 25 GB data, 50 GB backups
    • Large kitchen (5000+ recipes, 2000+ ingredients): 50+ GB data, 100+ GB backups

    Data stored:

    • Recipe database with instructions and images
    • Ingredient master database with costs
    • Meal plans and shopping lists
    • User preferences and settings
    • Backup archives for disaster recovery
    • Upload history and versions

    Critical: Without persistent storage, all recipe data and ingredient information is lost on container restart. This is essential for production deployments.

  8. Configure Compute Resources

    Choose appropriate resources based on expected usage:

    Small Deployment (single kitchen, < 1000 recipes):

    • CPU: 1 core
    • RAM: 1 GB
    • Suitable for: Home kitchens, small restaurants

    Medium Deployment (multiple kitchens, 1000-10000 recipes):

    • CPU: 2 cores
    • RAM: 2 GB
    • Suitable for: Growing restaurants, catering companies

    Large Deployment (enterprise, 10000+ recipes):

    • CPU: 4 cores
    • RAM: 4 GB
    • Suitable for: Large chains, food service companies

    Very Large Deployment (multi-tenant, 100000+ recipes):

    • CPU: 8+ cores
    • RAM: 8+ GB
    • Suitable for: Enterprise platforms, SaaS deployments

    Note: Recipe scaling and nutritional calculations are CPU-bound. More cores handle more concurrent operations. Monitor actual usage and scale accordingly.

  9. Deploy the Application

    Click “Create” to start the deployment. Klutch.sh will:

    1. Clone your repository from GitHub
    2. Build the Docker image with CookCLI
    3. Configure all environment variables
    4. Set up persistent storage volumes
    5. Start the CookCLI server
    6. Assign a public URL (e.g., kitchen-api.klutch.sh)
    7. Configure automatic HTTPS with SSL certificates

    Initial deployment typically takes 5-10 minutes.

  10. Monitor Deployment Progress

    Track your deployment:

    • Go to the Deployments tab
    • View real-time build logs
    • Wait for status to show “Running”
    • Verify environment variables are correctly set
    • Confirm persistent storage is mounted

    Ensure the CookCLI API starts without errors.

  11. Test Your Deployment

    After deployment, verify CookCLI is working:

    1. Health Check:

      Terminal window
      curl https://example-app.klutch.sh/health

      Should return healthy status.

    2. List Recipes:

      Terminal window
      curl -H "Authorization: Bearer YOUR_TOKEN" \
      https://example-app.klutch.sh/api/v1/recipes
    3. Create a Recipe:

      Terminal window
      curl -X POST \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "Content-Type: application/json" \
      -d @recipes/example-recipe.json \
      https://example-app.klutch.sh/api/v1/recipes
    4. Get Recipe Details:

      Terminal window
      curl -H "Authorization: Bearer YOUR_TOKEN" \
      https://example-app.klutch.sh/api/v1/recipes/recipe-001
    5. Test Scaling:

      Terminal window
      curl -X POST \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"recipe_id": "recipe-001", "servings": 10}' \
      https://example-app.klutch.sh/api/v1/recipes/scale
    6. View Logs: Check application logs in Klutch.sh dashboard for any errors or warnings.

  12. Configure Your Domain

    Add a custom domain for professional API access:

    1. In Klutch.sh dashboard, go to Domains
    2. Click “Add Custom Domain”
    3. Enter your domain (e.g., api.kitchen.example.com)
    4. Update DNS with CNAME record pointing to example-app.klutch.sh
    5. Wait for DNS propagation and SSL certificate provisioning

    Update API Configuration:

    1. Update webhook URLs in integrations
    2. Update client applications with new domain
    3. Configure CORS if needed
    4. Test API access from new domain
  13. Initialize with Recipe Data

    After deployment, populate with recipes:

    1. Import Sample Recipes:

      • Create JSON files for your recipes
      • Use the API to import them
      • Or use the CLI import functionality
    2. Set Up Ingredient Database:

      • Define your ingredient master list
      • Set costs and suppliers
      • Configure units and conversions
    3. Configure User Permissions:

      • Create team members
      • Set access levels (view, edit, admin)
      • Configure audit logging
    4. Set Up Meal Plans:

      • Create planning templates
      • Define seasonal menus
      • Configure shopping list generation

Getting Started with CookCLI API

Authentication

Get an access token for API calls:

Terminal window
curl -X POST https://example-app.klutch.sh/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "admin",
"password": "your-password"
}'

Response includes JWT token - use in Authorization header:

Terminal window
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Recipe Operations

List all recipes:

Terminal window
curl -H "Authorization: Bearer TOKEN" \
https://example-app.klutch.sh/api/v1/recipes

Get recipe details:

Terminal window
curl -H "Authorization: Bearer TOKEN" \
https://example-app.klutch.sh/api/v1/recipes/recipe-001

Create a new recipe:

Terminal window
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Pasta Carbonara", "servings": 4}' \
https://example-app.klutch.sh/api/v1/recipes

Update a recipe:

Terminal window
curl -X PUT \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Recipe Name"}' \
https://example-app.klutch.sh/api/v1/recipes/recipe-001

Delete a recipe:

Terminal window
curl -X DELETE \
-H "Authorization: Bearer TOKEN" \
https://example-app.klutch.sh/api/v1/recipes/recipe-001

Ingredient Management

List ingredients:

Terminal window
curl -H "Authorization: Bearer TOKEN" \
https://example-app.klutch.sh/api/v1/ingredients

Track ingredient costs:

Terminal window
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"ingredient_id": "ing-001", "cost": 2.50, "supplier": "Local Farm"}' \
https://example-app.klutch.sh/api/v1/ingredients/costs

Update inventory levels:

Terminal window
curl -X PUT \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"ingredient_id": "ing-001", "quantity": 50, "unit": "kg"}' \
https://example-app.klutch.sh/api/v1/ingredients/inventory

Meal Planning

Create meal plan:

Terminal window
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Weekly Menu", "start_date": "2024-01-01", "end_date": "2024-01-07"}' \
https://example-app.klutch.sh/api/v1/meal-plans

Add recipes to plan:

Terminal window
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"plan_id": "plan-001", "recipe_id": "recipe-001", "date": "2024-01-01", "meal_type": "dinner"}' \
https://example-app.klutch.sh/api/v1/meal-plans/items

Generate shopping list:

Terminal window
curl -H "Authorization: Bearer TOKEN" \
https://example-app.klutch.sh/api/v1/meal-plans/plan-001/shopping-list

Performance Optimization

API Response Caching

Enable Redis caching for frequently accessed data:

REDIS_URL=redis://your-redis-server:6379/0

Caches:

  • Recipe listings and details
  • Ingredient master data
  • Nutritional calculations
  • Cost analysis results

Database Optimization

PostgreSQL Performance:

DATABASE_POOL_SIZE=20
DATABASE_TIMEOUT=30

Create indexes for faster queries:

  • Recipe searches
  • Ingredient lookups
  • Cost history queries

Query Optimization:

  • Pagination for large result sets
  • Filtering and sorting at database level
  • Connection pooling for efficiency

Computational Caching

Pre-calculate expensive operations:

CACHE_NUTRITION_CALCULATIONS=true
CACHE_COST_ANALYSIS=true
CACHE_TTL=3600

Reduces computation for repeated requests.

Batch Operations

Use batch APIs for multiple operations:

Terminal window
curl -X POST \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"recipes": ["recipe-001", "recipe-002", "recipe-003"]}' \
https://example-app.klutch.sh/api/v1/recipes/batch

Faster than individual API calls.

Security Best Practices

Authentication and Authorization

User Access Control:

  • Enforce strong passwords (minimum 12 characters)
  • Implement two-factor authentication
  • Regular access reviews and audits

Role-Based Access:

  • Admin: Full system access
  • Chef: Recipe management and planning
  • Inventory: Ingredient and cost management
  • View-Only: Recipe viewing only

API Security:

  • Use JWT tokens with short expiration
  • Rotate secrets regularly
  • Implement rate limiting per API key

Data Protection

Encryption:

  • All data in transit uses HTTPS
  • Consider encryption at rest for sensitive data
  • Secure backup storage

User Privacy:

  • Clear data retention policies
  • Regular security audits
  • Compliance with food safety regulations

File Security

Upload Validation:

  • Restrict file types (JSON, CSV, images only)
  • Scan uploads for malware
  • Enforce maximum file sizes

Storage Security:

  • Keep uploads in secure persistent volume
  • Regular backup of recipe images
  • Version control for recipe changes

Regular Maintenance

Security Updates:

  • Monitor CookCLI releases for patches
  • Update dependencies regularly
  • Test updates in staging environment

Audit Logging:

  • Log all admin actions
  • Track recipe modifications
  • Monitor cost changes and adjustments

Troubleshooting

Issue 1: API Not Responding

Symptoms: Connection timeouts, 503 errors, no response

Solutions:

  1. Check Application Status:

    • Verify app is running in Klutch.sh dashboard
    • Review deployment logs for startup errors
    • Check health endpoint
  2. Verify Database Connection:

    • Confirm DATABASE_URL is correct
    • Check database is running and accessible
    • Verify network connectivity to database
  3. Review Resource Usage:

    • Check if CPU or memory is exhausted
    • Monitor disk space availability
    • Check network I/O
  4. Test Connectivity:

    Terminal window
    curl -I https://example-app.klutch.sh/health

Issue 2: Recipe Data Lost After Restart

Symptoms: Recipes disappeared, data not persistent

Solutions:

  1. Verify Persistent Volume:

    • Confirm volume mounted at /app/data
    • Check volume has sufficient space
    • Verify mount path in deployment settings
  2. Check Database:

    • Confirm database is running
    • Verify database file/connection is valid
    • Test database connectivity
  3. Restore from Backup:

    • Use backup files in /app/backups
    • Run restore command with backup file
    • Verify data after restore

Issue 3: Slow Recipe Calculations

Symptoms: Nutritional calculations take seconds, scaling is slow

Solutions:

  1. Enable Caching:

    • Configure Redis for result caching
    • Enable calculation caching
    • Reduce cache TTL for fresh data
  2. Optimize Calculations:

    • Use pre-calculated values when possible
    • Batch similar calculations
    • Reduce precision if appropriate
  3. Upgrade Resources:

    • Increase CPU cores for parallel processing
    • Add more RAM for larger calculations
    • Use faster storage
  4. Monitor Performance:

    • Check calculation times
    • Profile expensive operations
    • Review slow query logs

Issue 4: Authentication Failures

Symptoms: “Unauthorized”, “Invalid token”, login fails

Solutions:

  1. Verify Credentials:

    • Confirm username and password
    • Check account is not locked
    • Verify user has API access
  2. Check JWT Settings:

    • Confirm JWT_SECRET is set correctly
    • Check token hasn’t expired
    • Verify Authorization header format
  3. Reset Access:

    • Generate new authentication token
    • Reset user password if needed
    • Check user permissions

Issue 5: High Memory Usage

Symptoms: Memory warnings, sluggish performance, crashes

Solutions:

  1. Monitor Memory Usage:

    • Track memory consumption during operations
    • Identify memory-intensive calculations
    • Check for memory leaks
  2. Optimize Operations:

    • Reduce batch operation sizes
    • Implement streaming for large datasets
    • Clear caches periodically
  3. Upgrade Resources:

    • Increase Klutch.sh memory allocation
    • Add more RAM for larger datasets
    • Consider distributed setup

Issue 6: Backup Failures

Symptoms: Backup directory full, backup process fails

Solutions:

  1. Check Storage Space:

    • Monitor backup volume usage
    • Check retention settings
    • Verify backup directory has space
  2. Adjust Backup Settings:

    • Reduce backup frequency if needed
    • Increase retention volume size
    • Archive old backups to external storage
  3. Test Restore Process:

    • Periodically test backup restoration
    • Verify backup files are valid
    • Document recovery procedures

Custom Domain Setup

Using a custom domain makes the CookCLI API feel like part of your kitchen infrastructure.

Step 1: Add Domain in Klutch.sh

  1. Go to your CookCLI app in Klutch.sh dashboard
  2. Navigate to Domains
  3. Click “Add Custom Domain”
  4. Enter your domain (e.g., api.kitchen.example.com)
  5. Save

Step 2: Update DNS

Update your domain provider’s DNS records:

Type: CNAME
Name: api.kitchen
Value: example-app.klutch.sh
TTL: 3600

Step 3: Verify SSL Certificate

Klutch.sh automatically provisions SSL certificates:

  1. Wait for DNS propagation (up to 1 hour)

  2. Test HTTPS access:

    Terminal window
    curl -I https://api.kitchen.example.com/health
  3. Certificate is automatically renewed (no action needed)

Step 4: Update Configuration

Update any hardcoded domain references:

  1. Update webhook URLs in integrations
  2. Update client applications with new domain
  3. Update documentation
  4. Test API access from new domain

Production Best Practices

Backup Strategy

What to Back Up:

  1. Recipe database with all instructions and images
  2. Ingredient master database with costs
  3. Meal plans and shopping lists
  4. User accounts and preferences
  5. Application configuration

Backup Schedule:

  • Daily: Automated full backup
  • Weekly: Verify restore process
  • Monthly: Archive backups for compliance

Backup Commands:

For PostgreSQL:

Terminal window
pg_dump postgresql://cookcli:password@host/cookcli | gzip > /backup/cookcli-$(date +%Y%m%d).sql.gz

For SQLite:

Terminal window
tar -czf /backup/cookcli-$(date +%Y%m%d).tar.gz /app/data

Backup Storage:

  • Keep local backups for quick recovery
  • Store offsite backups (cloud storage, NAS)
  • Encrypt backups for security

Monitoring and Alerting

Key Metrics:

  • API response times
  • Database query performance
  • Recipe calculation duration
  • Storage space usage
  • Authentication attempt rate
  • Error rates

Alerts:

  • CPU > 80% sustained
  • Memory > 90% capacity
  • API response time > 2 seconds
  • Database errors
  • Backup failures
  • Storage nearly full

Scaling Strategy

Vertical Scaling (larger server):

  • Increase CPU cores for calculations
  • Add RAM for larger datasets
  • Use faster storage for I/O

Horizontal Scaling (multiple servers):

  • Multiple API instances behind load balancer
  • PostgreSQL for shared database
  • Redis for distributed caching
  • Object storage for recipe images

When to Scale:

  • API response times degrading
  • CPU consistently > 70%
  • Memory consistently > 80%
  • Database becoming bottleneck

User Administration

Regular Tasks:

  • Review active users monthly
  • Archive inactive accounts
  • Update permission levels as needed
  • Audit sensitive operations

Access Control:

  • Quarterly review of admin users
  • Remove access for terminated employees
  • Implement role-based access control
  • Monitor privilege escalation attempts

Conclusion

You now have a production-ready CookCLI deployment running on Klutch.sh. Your kitchen has access to a comprehensive recipe management and operations toolkit that brings order to culinary complexity.

CookCLI brings professional kitchen operations to any scale—from small restaurants to large catering companies. Organize recipes, track costs, plan menus, and manage ingredients from a single, powerful platform.

The deployment you’ve built handles recipe scaling, nutritional calculations, cost analysis, and meal planning reliably. Scale it as your kitchen grows, backup your recipes regularly, and monitor performance to keep everything running smoothly.

Whether you’re managing a fine dining kitchen, running a catering company, or just organizing your home cooking, CookCLI provides the tools to work more efficiently and reduce waste.

For additional help, check out the CookCLI documentation, explore advanced features, and connect with other users for support and recipe sharing ideas.

Happy cooking!