{
  "name": "Generate illustrated stories with GPT-4, DALL-E 3 and Firebase",
  "nodes": [
    {
      "id": "fce5d967-5e3e-431a-a6e3-41c42fb07c0d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -400
      ],
      "parameters": {
        "width": 420,
        "height": 712,
        "content": "## AI Illustrated Story Generator with DALL-E 3 & Firebase\n\nGenerate complete illustrated stories using AI. This workflow creates engaging narratives with custom DALL-E 3 images for each scene and sav"
      }
    },
    {
      "id": "32048eef-00c4-4bb4-a5e2-e20c95731849",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -192
      ],
      "parameters": {
        "width": 260,
        "height": 308,
        "content": "**Step 1: Form Input**\nCollects story topic, language, art style, number of scenes (1-12), audience, and mood."
      }
    },
    {
      "id": "0927bacb-1dfb-4768-ad4e-11804cc211bd",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -192
      ],
      "parameters": {
        "width": 200,
        "height": 308,
        "content": "**Step 2: Validate**\nEnsures scene count is between 1-12. Generates unique story ID."
      }
    },
    {
      "id": "11b0d4a3-5815-410e-a5a7-d93fbdc72666",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -192
      ],
      "parameters": {
        "width": null,
        "height": 308,
        "content": "**Step 3: Generate Story**\nGPT-4 creates complete narrative with scenes, characters, and image prompts."
      }
    },
    {
      "id": "d5acf7f1-6fa6-4329-9f03-add1fab4cf19",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -192
      ],
      "parameters": {
        "width": 200,
        "height": 308,
        "content": "**Step 4: Prepare Data**\nSanitizes text and optimizes prompts for DALL-E 3."
      }
    },
    {
      "id": "6bcdaedb-1fac-4cab-bdba-f73e981658be",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -192
      ],
      "parameters": {
        "width": 200,
        "height": 308,
        "content": "**Step 5: DALL-E 3**\nGenerates one image per scene. ~15 sec each.\n"
      }
    },
    {
      "id": "cd8a00fc-cf7a-497b-938a-77c8731a73b0",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -192
      ],
      "parameters": {
        "width": 200,
        "height": 308,
        "content": "**Step 6: Upload**\nDownloads from DALL-E, uploads to Firebase Storage.\n"
      }
    },
    {
      "id": "de464d9f-6e28-4196-aec6-08746e86a713",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        -192
      ],
      "parameters": {
        "width": 200,
        "height": 308,
        "content": "**Step 7: Finalize**\nCleans up data and prepares final story object."
      }
    },
    {
      "id": "1ad4f85e-e2cb-4d2a-8c94-e59ac8d064cc",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -192
      ],
      "parameters": {
        "width": 216,
        "height": 308,
        "content": "**Step 8: Firestore**\nSaves story to Firestore database.\n"
      }
    },
    {
      "id": "2405a411-297f-46b0-b51b-16a101c3004c",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        -192
      ],
      "parameters": {
        "width": 200,
        "height": 308,
        "content": "**Step 9: Response**\nReturns complete story JSON to the user."
      }
    },
    {
      "id": "ddda96c6-4469-4c2d-acfb-bee04ec28cd2",
      "name": "Story Input Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -592,
        -48
      ]
    },
    {
      "id": "63a1bedb-00f8-42c4-b01f-c8036628985f",
      "name": "Validate Input",
      "type": "n8n-nodes-base.code",
      "position": [
        -320,
        -48
      ]
    },
    {
      "id": "6a9a8aab-3dad-429b-a39c-563445e3671c",
      "name": "Generate Story (GPT-4)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -96,
        -48
      ]
    },
    {
      "id": "a1b2c17c-9433-43c8-a031-eba04f3d231d",
      "name": "Prepare Story Data",
      "type": "n8n-nodes-base.code",
      "position": [
        160,
        -48
      ]
    },
    {
      "id": "8eaff9ca-1e46-444d-bceb-661799278aa9",
      "name": "Generate Images (DALL-E 3)",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        -48
      ]
    },
    {
      "id": "46e5ffed-e608-45c0-9379-d09eb4d308f8",
      "name": "Upload to Firebase Storage",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        -48
      ]
    },
    {
      "id": "fac63dab-0dc1-4291-98a2-f887c192ca61",
      "name": "Finalize Story",
      "type": "n8n-nodes-base.code",
      "position": [
        816,
        -48
      ]
    },
    {
      "id": "aa4481c0-ef84-4931-bbe5-0a2b046adace",
      "name": "Prepare Firestore Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        -48
      ]
    },
    {
      "id": "e48ee420-0e8e-4ab0-adf2-4794ece9cdb6",
      "name": "Save to Firestore",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1264,
        -48
      ]
    },
    {
      "id": "fe5e2273-9610-442d-815c-d7d06d41cbc3",
      "name": "Return Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1488,
        -48
      ]
    }
  ],
  "connections": {
    "Finalize Story": {
      "main": [
        [
          {
            "node": "Prepare Firestore Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Input": {
      "main": [
        [
          {
            "node": "Generate Story (GPT-4)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Story Input Form": {
      "main": [
        [
          {
            "node": "Validate Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Firestore": {
      "main": [
        [
          {
            "node": "Return Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Story Data": {
      "main": [
        [
          {
            "node": "Generate Images (DALL-E 3)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Story (GPT-4)": {
      "main": [
        [
          {
            "node": "Prepare Story Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Firestore Data": {
      "main": [
        [
          {
            "node": "Save to Firestore",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Images (DALL-E 3)": {
      "main": [
        [
          {
            "node": "Upload to Firebase Storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Firebase Storage": {
      "main": [
        [
          {
            "node": "Finalize Story",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}