Open source  /  Implementation guide

Open-source implementation · Lead Generation & ABM

Build a lead pipeline and ABM stack on open source

What this is. A build-it-yourself path to the same outcome, made from open-source parts you host. It does not publish 5 Kings’ internal method, client data, or any third party’s confidential information — and it says plainly where the open-source path is weaker than a specialist service.

In one paragraph

A lead pipeline is four systems: capture, dedupe and enrich, route, and follow up until somebody answers. Marketing automation vendors charge per contact for all four. Mautic, a CRM and an automation runner replace them, and the per-contact cost goes to zero — which changes what you are willing to do.

What you end up with

  • A form-to-CRM pipeline with no per-contact fee, so you can capture more and segment finer
  • Dedupe and enrichment that runs on your own rules, not a vendor’s matching algorithm
  • Routing with a written rule set, plus an audit of every lead that was dropped
  • Follow-up sequences that are versioned files, not clicks in a UI nobody can review

The reference stack

Every project below is open source and self-hostable. Licences are the ones the project publishes today; check them against your own distribution model before you ship, because a licence can change and an AGPL project has obligations a MIT project does not.

LayerOpen-source projectLicenceWhat it does for you
Marketing automationMauticGPL-3.0Forms, segments, campaigns, email builder, tracking pixel, and a REST API for everything else.
CRMSuiteCRM or EspoCRMAGPL-3.0 / GPL-3.0Accounts, contacts, opportunities and pipeline reporting you own.
Automation runnern8n (fair-code) or Apache AirflowSustainable Use / Apache-2.0Glue between form, CRM, enrichment and notifications. Note that n8n is source-available, not OSI-approved, if that matters to your distribution.
Email deliveryListmonk or PostalAGPL-3.0 / MITNewsletter and transactional sending from your own infrastructure, with bounce and complaint handling.
EnrichmentCommon Crawl + your own rules, or a free-tier APIOpen dataFirmographics from the company's own site and public crawl data; no per-record enrichment fee.
AttributionMatomo (see the analytics guide)GPL-3.0Which source produced the lead, joined back to the CRM record by a shared id.
Lead QAYour own log table + GrafanaAGPL-3.0Every submission logged — including the ones dropped as spam — so a missing lead is diagnosable.

Build it

1. Log every submission before you judge it

Write the raw submission to a log table, then run the spam and validation rules, then write the outcome. A pipeline that silently drops a lead is worse than no pipeline, because you will never know it happened. This is the first thing to build.

2. Define the funnel in one table

One row per lead with: source, campaign, click id, capture time, dedupe key, owner, status, first response time, outcome. Everything else — dashboards, routing, SLAs — reads from it. Without one canonical lead table every report disagrees.

3. Dedupe on an explicit rule

Email normalised, plus company domain, plus phone in E.164. Decide what wins on conflict and log the merge. Vendors hide this logic; writing it down is why your numbers will be defensible.

-- canonical dedupe key
lower(trim(email))            -- person
regexp_replace(phone, 'D', '') -- phone  
lower(split_part(email,'@',2)) -- company domain
-- merge rule: keep the earliest created_at, newest non-null field wins

4. Route with a rule set you can test

Territory, size, vertical and language as an ordered rule list in a file, with a unit test per rule. A routing bug that sends Texas to the wrong rep is a revenue bug, and it should be caught by a test rather than by the rep noticing.

5. Enforce a first-response clock

Measure time from submission to first human contact, per rep, and publish it. This one metric moves conversion more than any email copy change, and self-hosted tooling makes it free to measure.

6. Keep sequences in version control

Campaign definitions as exported JSON in git, applied by a script. Now a subject-line change is a diff with a date, and you can answer ‘what did we send in March’ without archaeology in a UI.

7. Send from infrastructure that authenticates

SPF, DKIM and DMARC on your own domain, with bounce and complaint processing wired to a suppression list. Self-hosted sending without authentication lands in spam and teaches you the wrong lesson about email.

Acceptance checks

If you cannot verify a claim, it is not a finding. These are the checks that close the work; each one can be run by somebody who did not build it.

Acceptance checkHow to verify it
Every submission appears in the log with an outcomeForm count vs log rows vs CRM records for the same day; all three reconcile.
Dedupe produces one lead per personQuery for duplicate dedupe keys; must be zero.
Routing rules have tests and a documented orderTest suite per rule; a new rule without a test fails review.
First-response time is tracked and publishedMedian and 90th percentile per rep per week, visible to the team.
Email authentication passesSend to a seed address and check SPF/DKIM/DMARC alignment in the headers.
Suppression list is applied before sendAssert send count excludes every suppressed address.

Effort and cost

Estimate
Skill neededIntermediate: Docker, a CRM's data model, SQL, and some scripting for the rules
Build time2–3 days for Mautic + CRM, 2 days for the logging and dedupe layer, 2 days for routing + tests
Running costA few hours a month plus VPS; email deliverability needs attention if you send volume
What you must host4–8 GB VPS for Mautic + CRM + Postgres. Add a separate host for bulk sending.

What open source does not give you

The honest half of the comparison. Each of these is a reason somebody buys the service instead of building it, and pretending otherwise would make the rest of this page worthless.

  • Mautic is powerful and heavy. Expect real administration time, and expect its UI to be slower than a SaaS product’s. That is the trade for no per-contact fee.
  • Deliverability is harder than with a commercial ESP. You own IP reputation, blocklists and complaint handling. For cold outbound at volume, this is where self-hosting usually fails.
  • Enrichment from open data is weaker than a paid provider: fewer fields, more gaps, and more false matches on generic company names.
  • ABM needs account-level data (intent, org charts, tech stack) that is mostly a paid dataset. Open source gives you the orchestration, not the intelligence.
  • n8n is source-available under a fair-code licence, not OSI open source. If licence purity matters, use Airflow or plain cron and scripts.

Scope only, stated so you can compare it with the build above.

  • The funnel definition and the routing rules, derived from how the sales team actually works
  • Deliverability setup and monitoring with a real sending domain and warm-up
  • Attribution joined to closed revenue, which needs the CRM’s opportunity data and the sales team’s discipline

Sources and further reading

What this page does not include. This guide documents an open-source implementation of the same outcome. It deliberately leaves out 5 Kings’ internal playbooks, client data, vendor terms and unpublished method: we publish what any competent team can reproduce, and we do not publish what belongs to a client or to a contract. Where a step depends on a decision only your business can make, the guide says so instead of guessing.

Take it with you

Build a lead pipeline and ABM stack on open source

The full guide as an A4 PDF: the reference stack with licences, the build steps, the acceptance checks and the honest limits — in one file you can hand to an engineer or print for a planning session.

PDF · A4 · no email required · free to redistribute with attribution

Open-source Guides & PDFs