← n8n Builder & Seller Stack Layer 08 — front end + backend
Layer 08 · Build

Build: No-Code AI SaaS App

Everything so far has run inside n8n's own canvas or chat. This build gives an automation a real, branded front end — a form a client's customers actually fill out — by pairing an AI-generated UI (Lovable) with an n8n backend that does the real work behind a webhook.

Apps used Lovable, Webhook, HTTP Request, OpenAI Difficulty Advanced Build time 60–90 min
00

What we're building, and why

A visitor enters their industry, company name, and website, picks a social platform, and clicks Generate. n8n scrapes their site, drafts a caption with AI, generates an image, and sends both back to render on the page — a free lead magnet or a paid micro-tool, built without touching a line of server code. The mechanic — a form that calls a webhook and displays whatever comes back — is identical no matter what the tool actually does.

01

Design the contract first

Before generating any UI, decide exactly what JSON goes in and what JSON comes back — this single decision is 90% of what makes this integration work or silently fail.

// Request the front end sends (POST body)
{
  "industry": "AI Automation",
  "company_name": "Acme Co",
  "website": "https://acme.co",
  "platform": "LinkedIn",
  "post_type": "news"
}

// Response n8n must send back
{
  "post": "generated caption text...",
  "image": "https://...generated-image-url..."
}
02

Build the front end in Lovable

At lovable.dev, describe the UI in plain language, explicitly including the contract from step 01 so the generated code sends and expects the right shape:

Build a form with fields: industry, company name, website URL, and a
platform dropdown (LinkedIn, X, Instagram, Facebook). On submit, POST
this JSON to [YOUR N8N WEBHOOK URL] and display the returned "post"
text and "image" URL on the page once the response arrives.

Paste your webhook URL from step 03 into the generated code before testing.

03

Receive the request in n8n

Add trigger → Webhook, method POST. Set Respond to Using Respond to Webhook Node rather than "Immediately" — generating a caption and an image takes several seconds, and the front end needs to wait for that real result, not an empty acknowledgment sent the instant the request lands.

04

Do the actual work

  1. HTTP Request (GET) the submitted website to pull its raw HTML.
  2. HTML → Extract HTML Content, CSS selector body, to strip scripts and head tags before they burn tokens in the next step — a raw page can be 15× larger than just its visible content.
  3. OpenAI → Message a Model: system prompt "You are an expert social media copywriter, write an engaging {{ platform }} caption," user message containing the scraped content and the submitted fields.
  4. A second OpenAI → Generate an Image call, using the generated caption as part of the image prompt so text and visual stay on-message.
05

Respond correctly to the webhook

On the final Respond to Webhook node, the response body must match the contract exactly — same keys, same shape — or the front end has nothing to display:

{
  "post": "{{ $json.message.content }}",
  "image": "{{ $json.url }}"
}
06

Debugging the JSON contract

"Invalid JSON in response field" is almost always a literal line break inside a generated caption — JSON can't contain raw newlines. Wrap the field in JSON.stringify(...) to escape them automatically, then strip the extra wrapping quotes JSON.stringify adds around the whole string.

If Lovable's generated front end can't parse what comes back, paste the exact JSON shape you're sending it back into Lovable's chat: "my backend returns exactly this JSON structure — update the front end to match." Keeping the contract synchronized in both directions, rather than guessing, is the entire skill here.

07

Variations worth selling

  • An SEO or website audit tool that scrapes a URL and returns a scored report.
  • A quote calculator that takes a client's inputs and returns an instant price, gated behind an email capture.
  • Charge for this as a done-for-you lead magnet: the client gets a tool that pulls in prospects, you get paid to build and host it.
08

Sources

SourceUsed for
Jono Catliff (Automatable), "n8n 8 Hour Masterclass — Build & Sell AI Agents (Automate Anything)"Primary source for this build's workflow steps
Lovable docs, IntroductionGenerating the front end from a text prompt
n8n docs, Webhook nodeReceiving requests & responding to the front end
n8n docs, HTTP Request nodeScraping the submitted website