Tandoor Recipes Documentation

repository·develop·Indexed 27 days ago

https://github.com/tandoorrecipes/recipes

A comprehensive digital recipe management system for power users to organize collections, plan meals, and manage shopping lists. Features include AI-assisted recipe processing, mobile optimization, and the ability to import recipes from thousands of websites via ld+json or microdata. The documentation provides guides for installation, usage, and developer instructions for creating new import/export integration classes using Python and Vue3.

Tokens
32.8K
Snippets
65
Records
183
Agent score
93%

What's inside Tandoor Recipes

  1. Overview of Tandoor Recipes

    develop
    Tandoor Recipes is a digital recipe manager designed for power users to organize, plan, and share recipe collections. It includes features for meal planning, shopping lists, AI-assisted recipe processing, and cookbook organization. The application is optimized for mobile use and supports localization in multiple languages.
  2. Configure Connectors in TandoorRecipes

    develop

    Connectors allow TandoorRecipes to translate actions into API calls for external services. Note that connectors are currently in a beta stage.

    Security Warning: Because connectors store authentication information to push data to external providers, it is highly recommended to use read-only accounts, separate accounts, or app passwords whenever possible.

  3. Deploy Apache + Traefik + Tandoor with Sub-Paths

    develop

    This community-contributed setup uses Docker Compose, Traefik, and Apache to host Tandoor under a specific sub-path.

    Key Configuration Requirements:

    • Environment Variables: You must set SCRIPT_NAME, STATIC_URL, and MEDIA_URL in the recipes service to match your sub-path routing.
    • Volumes: The apache service needs read-only access to the static and media directories, while the recipes service needs read-write access to them.
    • Traefik Labels: Configure Traefik routers to use PathPrefix for both the Apache service and the Recipes service.
    • Apache Configuration: Use Alias directives to map the static and media URLs to the correct local paths.
    # recipes service environment
        environment:
          - SCRIPT_NAME=/<sub path>
          - STATIC_URL=/<www path>/static/
          - MEDIA_URL=/<www path>/media/
    
    # apache configuration
      Alias /<www path>/static/ /var/www/recipes/static/
      Alias /<www path>/media/ /var/www/recipes/media/
      <Directory "/var/www/recipes/">
        Require all granted
      </Directory>
  4. Install Tandoor using Docker CLI

    develop

    You can run the Tandoor container directly using docker run. This image (vabene1111/recipes) exposes the application on port 80 via an integrated nginx webserver. You must replace SECRET_KEY and POSTGRES_PASSWORD with your own values.

    docker run -d \
        -v "$(pwd)"/staticfiles:/opt/recipes/staticfiles \
        -v "$(pwd)"/mediafiles:/opt/recipes/mediafiles \
        -p 80:80 \
        -e SECRET_KEY=YOUR_SECRET_KEY \
        -e DB_ENGINE=django.db.backends.postgresql \
        -e POSTGRES_HOST=db_recipes \
        -e POSTGRES_PORT=5432 \
        -e POSTGRES_USER=djangodb \
        -e POSTGRES_PASSWORD=YOUR_POSTGRES_SECRET_KEY \
        -e POSTGRES_DB=djangodb \
        --name recipes_1 \
        vabene1111/recipes
  5. Setup prettier Watcher for Vue and Docs

    develop

    Configure a File Watcher to format Vue files and documentation using prettier.

    1. Navigate to File -> Settings -> Tools -> File Watchers and click the '+'.
    2. Set 'File Type' to 'Any'.
    3. Create a custom 'Scope' by clicking the three dots next to 'Scope' and adding a new scope with these details:
      • Name: prettier
      • Pattern: file:vue/src//*||file:vue3/src//*||file:docs//*
    4. Configure the watcher arguments: --cwd $ProjectFileDir$\vue prettier -w --config $ProjectFileDir$\.prettierrc $FilePath$
    --cwd $ProjectFileDir$\vue prettier -w --config $ProjectFileDir$\.prettierrc $FilePath$
  6. Install Project and Frontend Requirements

    develop

    Install Python dependencies using the virtual environment and build the Vue3 frontend.

    Python dependencies:

    /var/www/recipes/bin/pip3 install -r requirements.txt

    Frontend build: Navigate to the ./vue3 directory to install and build the assets:

    cd ./vue3
    yarn install
    yarn build
  7. Install Tandoor Recipes via Docker

    develop

    Tandoor Recipes can be deployed easily using Docker. Official installation guides and examples for specific platforms like Kubernetes, Unraid, and Synology are available in the external documentation.

    For quick setup, refer to the Docker installation guide at https://docs.tandoor.dev/install/docker/.

    https://docs.tandoor.dev/install/docker/
  8. Populate Recipe steps, ingredients, and keywords

    develop

    To build a complete recipe during import, you need to interact with several related models: Step, Ingredient, Food, Unit, and Keyword.

    Keywords

    Use Keyword.objects.get_or_create() to add keywords to the recipe. Always pass space=self.request.space to ensure the keyword belongs to the correct user space.

    Steps and Ingredients

    1. Create a Step: Use Step.objects.create(). You should provide instruction, order, and space. You can also set show_ingredients_table based on user preferences via self.request.user.userpreference.show_step_ingredients.
    2. Create Ingredients: For each ingredient in a step, use Ingredient.objects.create(). This requires:
      • food: Use Food.objects.get_or_create(name=..., space=self.request.space)[0].
      • unit: Use Unit.objects.get_or_create(name=..., space=self.request.space)[0].
      • amount: The numeric quantity.
      • space: self.request.space.
    3. Link to Recipe: Use recipe_object.steps.add(step) and recipe_object.keywords.add(keyword) to associate these objects with the main Recipe instance.
    from cookbook.models import Recipe, Keyword, Step, Ingredient, Food, Unit
    
    def get_recipe_from_file(self, file) -> Recipe:
        recipe_object = Recipe.objects.create(
            name = your_recipe_name,
            created_by = self.request.user,
            internal = True,
            space = self.request.space,
        )
        
        # Logic for creating keywords
        for keyword in parsed_file.keywords:
            recipe_object.keywords.add(
                Keyword.objects.get_or_create(
                    space=self.request.space, 
                    name=keyword)[0])
        
        i = 0
        for line in parsed_file:
            # Logic for creating steps
            step = Step.objects.create(
                instruction=line.instruction_string, 
                order=i, 
                space=self.request.space, 
                show_ingredients_table=self.request.user.userpreference.show_step_ingredients)
            
            # Logic for creating ingredients within the step
            for ingredient in line.ingredients:
                step.ingredients.add(
                    Ingredient.objects.create(
                        food=Food.objects.get_or_create(name=ingredient.name, space=self.request.space)[0],
                        unit=Unit.objects.get_or_create(name=ingredient.quantity.unit, space=self.request.space)[0],
                        amount=ingredient.quantity.amount,
                        space=self.request.space, ))
            
            recipe_object.steps.add(step)
            i += 1
            
        recipe_object.save()
        return recipe_object
  9. Install Tandoor Recipes on Arch Linux via AUR

    develop

    This is a community-contributed installation guide for pacman-based distributions like Arch Linux. It uses systemd integration, socket activation, and runs as a non-root user.

    Warning: This guide has not been verified for Tandoor 2. Tandoor 2 integrates an Nginx service inside the default Docker container and exposes services on port 80 instead of 8080.

    To install, clone the AUR package and build it using makepkg:

    1. Clone the repository.
    2. Build and install using makepkg -si or your preferred AUR helper.
    git clone https://aur.archlinux.org/tandoor-recipes-git.git
    cd tandoor-recipes-git
    makepkg -si