Skip to content
makeweave.
Menu
Back to the journal

Applied AI

Serverless lead capture with Astro, n8n, and self-hosted Twenty CRM

A practical architecture for wiring a static marketing site to an EU-hosted open-source CRM—with email deduplication and transparent trade-offs.

BY JAVIER OTERO · CO-FOUNDER & SYSTEMS ARCHITECT PUBLISHED 1 DECEMBER 2026 UPDATED 2 DECEMBER 2026 3 MIN READ

MAKEWEAVE / Applied AI

Static speed. Open CRM.

01 / Strategy

02 / Design

03 / Technology

ASTRO · N8N · TWENTY CRM

A marketing website does not need a monolithic application server just to capture leads. When we built Makeweave’s own site on Astro, we wanted static HTML speed on the frontend, full ownership of our CRM database in the EU, and an automation layer we could later extend with AI triage—without paying $100+/month for bundled funnel SaaS.

To be technically precise: Astro itself has no backend, while our functional backend is split cleanly between an n8n webhook workflow and a self-hosted Twenty CRM instance.

Architecture overview

[Astro Static Form]
   │ POST JSON + hidden honeypot
   ▼
[n8n Webhook /makeweave-contact]
   │ Validate lengths · Escape HTML · Drop bots silently
   ├──► [Gmail OAuth2] ──► Team brief → hello@makeweave.com (Proton Mail)
   ├──► [Gmail OAuth2] ──► Branded confirmation → Visitor (Reply-To: hello@makeweave.com)
   └──► [Twenty CRM Branch (parallel, non-blocking)]
          1. GET  /rest/people?filter=emails.primaryEmail[eq]:<email>
          2. POST /rest/people        (only if not found)
          3. POST /rest/opportunities (stage: NEW, linked to Person)
          4. POST /rest/notes + /rest/noteTargets (linked to Person & Opportunity)

Exact payload and spam filtering

The browser posts a compact JSON payload directly from Astro:

{
  "name": "Alex Rivera",
  "email": "alex@company.com",
  "message": "Looking for a technical SEO & GEO audit before our Q2 relaunch.",
  "source": "https://makeweave.com/?utm_source=linkedin#contact",
  "website": ""
}

Inside n8n, a single JavaScript code node checks field lengths, validates email syntax, escapes < > & " ' before rendering HTML emails, and inspects the hidden website honeypot. If a bot fills website, the webhook returns a silent 200 OK without sending any email or touching Twenty—avoiding CAPTCHA friction for real humans.

Deduplicating contacts in Twenty CRM

Naive webhook-to-CRM setups break the second time the same prospect writes in. Instead of blindly calling POST /rest/people, our workflow queries emails.primaryEmail first:

  • Existing contact: reuses the returned person.id and opens a fresh Opportunity in stage NEW.
  • New contact: splits the full name into firstName / lastName, creates the Person, then creates the Opportunity.
  • Context preservation: writes a Markdown Note containing the full message, UTC timestamp, and source URL (preserving UTM parameters from LinkedIn, YouTube, or Instagram) and links it via noteTargets to both the Person and the Opportunity.

Honest trade-offs: residency, reliability, and cost

Self-hosting is not “free”—it trades per-seat SaaS fees for modest VPS hosting and disciplined operations:

  • Data residency vs. sub-processors: Twenty CRM and its PostgreSQL database run on Hetzner in Germany (with automated off-site backups), and our team inbox runs on Proton Mail in Switzerland. Transactional confirmation emails currently traverse Gmail OAuth2 until we migrate outbound SMTP to our custom domain—something we state transparently in our Privacy Policy.
  • Failure handling: Running the Twenty branch in parallel ensures CRM maintenance never blocks the visitor’s 200 OK or the team’s email brief. Because a parallel branch is not a durable message queue by itself, the email to hello@makeweave.com serves as our immediate fallback; for high-volume client pipelines, we add a persistent retry queue.

Explore how we combine web engineering and automation in our services overview.

Key questions

Why self-host Twenty CRM instead of using a spreadsheet or all-in-one SaaS?

Spreadsheets quickly break once you need Kanban stages, linked notes, and follow-up ownership. Self-hosting Twenty avoids per-seat SaaS licensing fees while keeping full REST/GraphQL API access and EU database control—at the trade-off of managing your own Docker updates and backups.

What happens if Twenty CRM is restarting when a visitor submits the form?

The CRM sync runs on a parallel branch with continue-on-fail enabled, so the browser still gets a 200 OK and the team still receives the full lead brief by email. For high-volume pipelines requiring guaranteed CRM replay, we add a persistent queue or retry workflow.