Open source  /  Implementation guide

Open-source implementation · Bespoke e-commerce marketing

Assemble the whole stack yourself: a bespoke commerce build

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

The bespoke option is not a mystery product. It is the previous twelve guides assembled in a specific order, with the interfaces between them decided deliberately. This page is the assembly plan: what order to build in, what to build first, and what to deliberately not build yet.

What you end up with

  • A build order that produces a useful system in weeks rather than a perfect one in quarters
  • A clear owner per layer and a documented interface between layers
  • A cost model you can defend, including the maintenance you are signing up for
  • An explicit list of the parts you will buy, and why buying them is correct

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
Commerce coreWooCommerce or MedusaGPL-2.0 / MITCatalogue, cart, orders. The system of record for transactions.
ContentWordPress or AstroGPL-2.0 / MITThe editorial surface that earns the traffic the store converts.
AnalyticsMatomo + PostHogGPL-3.0 / MITTraffic, campaigns and product behaviour, first-party.
WarehousePostgreSQL + dbt-corePostgreSQL / Apache-2.0One place where spend, sessions and orders meet.
Marketing automationMauticGPL-3.0Segments, campaigns, lifecycle email.
ExperimentationGrowthBookMIT (core)Flags and tests, server-side where it matters.
LLM layerLiteLLM + LangfuseMITOptional: any generative feature, with cost and traces under control.

Build it

1. Build the measurement spine before the marketing

Analytics, click ids, order events and a warehouse. Every later decision depends on it, and retrofitting measurement onto a live campaign means losing the baseline you needed to judge it. Two weeks here saves months of arguing about whether something worked.

2. Then the conversion surface

Product page, cart, checkout, and the performance budget. This is where revenue is won or lost; the content programme can wait a month, the checkout cannot.

3. Then the content engine

CMS, templates, style linting and the publish pipeline. Now the content investment compounds instead of accumulating as unrouted drafts.

4. Then the lifecycle layer

Segments from real behaviour, a small number of campaigns, and a first-response clock. Do not build the 20-email sequence before the first 200 orders exist.

5. Then experimentation

Once traffic and events are trustworthy, tests mean something. Before that, they produce confident noise and burn credibility with the team.

# build order (weeks, one engineer)
1  measurement spine          analytics, click id, warehouse  2-3
2  conversion surface         PDP, cart, checkout, perf       2-3
3  content engine              CMS, templates, publish         1-2
4  lifecycle                   segments, 3 campaigns, SLA clock 1-2
5  experimentation             flags, one test per sprint      1
6  LLM layer (optional)        gateway, traces, one feature    1-2

6. Then the optional intelligence layer

A gateway, traces and one genuinely useful generative feature. One feature, measured. Adding the model layer first is the most common way these projects fail: it is the most interesting part and the least load-bearing.

7. Write the maintenance contract with yourself

Who patches, who is paged, what the backup and restore procedure is, and what the monthly cost is. Every self-hosted layer is a service you now run. If nobody owns it, it degrades — quietly, and at the worst time.

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
Measurement reconciles before any campaign is judgedOrder events vs orders in the platform; the delta is published.
Checkout completes within the performance budgetLighthouse CI on the checkout template plus a real scripted purchase.
Every layer has a named owner and a backupAn ownership table in the repo, reviewed quarterly.
Restore has been tested for the commerce databaseA dated restore into staging, with order counts compared.
Monthly infrastructure cost is known and reportedA single line per layer in the finance report.
No layer is a single point of failure without an alertUptime probe per public layer, routed to the on-call channel.

Effort and cost

Estimate
Skill neededAdvanced: this is a small platform engineering programme, not a website project
Build time6–10 weeks for one competent engineer to reach all five core layers, excluding content production
Running costRealistically 2–5 hours a week of maintenance, plus 1–3 days per quarter of upgrades
What you must hostOne 8–16 GB host for the whole stack at small volume; separate the commerce database first

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.

  • This is a platform programme. It requires an owner with platform skills; without one, every layer becomes an unpatched liability within a year.
  • Total cost of ownership is usually lower than a mid-market SaaS stack and higher than a cheap one. The saving is real at scale and illusory at ten orders a day.
  • You will buy some parts regardless: payments, tax data, perhaps search relevance and fraud. The guide names them instead of pretending they are free.
  • Marketing outcomes still depend on the offer and the market. A well-built stack with a bad offer performs exactly as badly as a rented one.
  • Every self-hosted layer adds an upgrade treadmill. That is the honest trade for ownership, and it does not go away.

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

  • The build order and the interface decisions between layers, which are the expensive mistakes
  • The offer and positioning work that the stack exists to serve
  • An owner for the layers, so maintenance does not quietly stop

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

Assemble the whole stack yourself: a bespoke commerce build

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