<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joshua</title>
    <description>The latest articles on DEV Community by Joshua (@joshmsn).</description>
    <link>https://dev.to/joshmsn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3776962%2F15087b3c-4168-4804-a603-dc4d973be7df.jpg</url>
      <title>DEV Community: Joshua</title>
      <link>https://dev.to/joshmsn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joshmsn"/>
    <language>en</language>
    <item>
      <title>AI literacy: what Article 4 of the EU AI Act requires since July 2026</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Tue, 10 Nov 2026 12:57:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/ai-literacy-what-article-4-of-the-eu-ai-act-requires-since-july-2026-d7n</link>
      <guid>https://dev.to/joshmsn/ai-literacy-what-article-4-of-the-eu-ai-act-requires-since-july-2026-d7n</guid>
      <description>&lt;p&gt;"Do we have to train our people on AI now?" I hear this question a lot at the moment, usually with an undertone somewhere between duty and uncertainty. The short answer: &lt;strong&gt;if your company uses AI, yes – to an appropriate extent.&lt;/strong&gt; The longer answer is more relaxed than many providers of mandatory courses make it sound.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The essentials&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Anyone using AI at work&lt;/strong&gt; must take measures for their team's AI literacy – even if it is "just" ChatGPT&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Since 27 July 2026&lt;/strong&gt; a new version applies: &lt;em&gt;support&lt;/em&gt; instead of &lt;em&gt;ensure&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No certificate&lt;/strong&gt; and no minimum level for individual people&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What matters&lt;/strong&gt; is that you visibly do something and can show it&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;A word up front: I am a developer, not a lawyer. I build AI into software, train teams and use it every day in my own business. What follows is an assessment from that practice, not legal advice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What applies since July 2026?
&lt;/h2&gt;

&lt;p&gt;Article 4 of the European AI Act requires companies that provide or deploy AI systems to look after the AI literacy of their staff. The obligation has applied since 2 February 2025. The so-called Digital Omnibus rewrote it, and the new version has applied since 27 July 2026:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Providers and deployers of AI systems shall take measures to support the development of AI literacy of their staff and other persons dealing with the operation and use of AI systems on their behalf […]. This obligation does not require providers or deployers to guarantee any specific level of AI literacy of any individual."&lt;/p&gt;

&lt;p&gt;— Art. 4(1) AI Act as amended by &lt;a href="https://eur-lex.europa.eu/eli/reg/2026/1744/oj/eng" rel="noopener noreferrer"&gt;Regulation (EU) 2026/1744&lt;/a&gt;, Official Journal of 24 July 2026&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What changed compared with the first version:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Feb 2025 to July 2026&lt;/th&gt;
&lt;th&gt;Since 27 July 2026&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Core obligation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;ensure, to their best extent, a sufficient level of AI literacy of staff&lt;/td&gt;
&lt;td&gt;take measures that support the development of AI literacy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Level per person&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;"sufficient level" as the goal&lt;/td&gt;
&lt;td&gt;explicitly no specific level&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What counts&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;prior knowledge, experience, training, context of use, people affected&lt;/td&gt;
&lt;td&gt;unchanged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;Commission and member states help, the Commission publishes practical examples&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In practice this means: &lt;strong&gt;the obligation has not gone away, but it has become more realistic.&lt;/strong&gt; It is not about exams, but about visibly doing something – and being able to show it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does this apply to my company?
&lt;/h2&gt;

&lt;p&gt;Very likely, yes. A "deployer" of an AI system is anyone who uses AI under their own authority in a professional context. It is enough if your team uses ChatGPT, Microsoft Copilot, Claude or another tool for work. You do not need to develop AI yourself.&lt;/p&gt;

&lt;p&gt;One point that is often overlooked: in many businesses, staff have long been using AI with private accounts to write emails or summarise documents – without it ever being officially decided. How that is to be assessed legally is best clarified with your legal advisor. In practice, this uncontrolled use is exactly where skills and rules are most lacking.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does "appropriate" mean?
&lt;/h2&gt;

&lt;p&gt;The regulation does not prescribe a format. It does say what the measures should be based on: prior knowledge, experience, training, the context of use and the people affected by the results. Translated into three questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Which tools&lt;/strong&gt; are used, and for what?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much risk&lt;/strong&gt; is involved? Using AI for social media drafts needs less than using it to summarise contracts or process personnel data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What prior knowledge&lt;/strong&gt; is there? A development team needs something different from accounting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A uniform online course for everyone can be one building block. But it does not replace the question of how your team uses AI in its own day-to-day work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I recommend to companies
&lt;/h2&gt;

&lt;p&gt;Five steps that are manageable without much effort in most businesses:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Inventory:&lt;/strong&gt; which AI tools are used – officially and unofficially? A short, honest survey in the team often brings surprises.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set rules:&lt;/strong&gt; which tools are allowed? Which data may go into a chat window, and which never? Who checks results before they go outside? One page is enough to start.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Train to fit the use:&lt;/strong&gt; better to practise on real everyday tasks than on someone else's examples. It sticks, and the rules from step 2 are practised along the way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document:&lt;/strong&gt; who was trained when, on which content? An attendance list with date, duration and topics is good evidence. &lt;em&gt;This is the step most often forgotten.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeat when something changes:&lt;/strong&gt; new tool, new department, new task – then a short refresher and updated rules.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is what evidence can look like. No form is prescribed, but these four details make a measure traceable:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Evidence: AI literacy training&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;When&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;date, time and duration of the training&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Who&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;participants with department or role&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Content&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;e.g. basics, data protection with chat tools, checking results&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Rules&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;which internal AI rules were discussed and handed out&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Best filed together with the training material and the current version of your AI rules. What such rules can look like in real life is described in my article &lt;a href="https://hafenpixel.de/en/behind-the-scenes/ai-in-my-own-business" rel="noopener noreferrer"&gt;AI in my own business: how I work with AI agents&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you do not need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No certificate.&lt;/strong&gt; The regulation does not require an exam or a specific certificate. A certificate does no harm, but it is not a free pass either.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No AI officer.&lt;/strong&gt; A dedicated role is not required. What matters is that someone keeps an eye on the rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No expensive platform.&lt;/strong&gt; A document with rules, a suitable training and a clean attendance list are a solid start for most businesses.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When is e-learning enough – and when not?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Often enough:&lt;/strong&gt; your team hardly uses AI and you mainly need a first piece of evidence. Then an inexpensive online course can be sufficient, and there are plenty of them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usually not enough:&lt;/strong&gt; AI is really used day to day – for client communication, analysis, texts or with sensitive data. Then a training that starts from your tasks and clarifies what is allowed in your company is worth it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Not legal advice:&lt;/strong&gt; this article is an assessment from practice, as of November 2026. What exactly applies in your case should be clarified with your legal advisor or data protection officer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Do I have to train my employees on AI?&lt;/strong&gt;&lt;br&gt;
If your company uses AI tools professionally, you must take measures that support your team's AI literacy. Training is the obvious way, but no specific format is prescribed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Since when does the AI literacy obligation apply?&lt;/strong&gt;&lt;br&gt;
Since 2 February 2025. An amended version entered into force on 27 July 2026: since then, companies must take measures that support the development of AI literacy, without having to guarantee a specific level for individual people.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the obligation apply if my team only uses ChatGPT?&lt;/strong&gt;&lt;br&gt;
Yes. Professional use of general AI tools such as ChatGPT or Copilot also makes your company a deployer within the meaning of the regulation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do my employees need a certificate?&lt;/strong&gt;&lt;br&gt;
No. The AI Act does not require a certificate. What matters is that you document which measures you have taken in a traceable way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is an online course enough?&lt;/strong&gt;&lt;br&gt;
For a first piece of evidence with little use, often yes. If AI is really used day to day, the training should fit your tools and tasks.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>eu</category>
      <category>management</category>
    </item>
    <item>
      <title>AI in my own business: how I work with AI agents</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Mon, 02 Nov 2026 11:56:12 +0000</pubDate>
      <link>https://dev.to/joshmsn/ai-in-my-own-business-how-i-work-with-ai-agents-4n81</link>
      <guid>https://dev.to/joshmsn/ai-in-my-own-business-how-i-work-with-ai-agents-4n81</guid>
      <description>&lt;p&gt;Anyone who advises companies on AI should use it themselves. Not for a demo, but day to day, with real data and real consequences.&lt;/p&gt;

&lt;p&gt;I run HafenPixel, my web development business in Hamburg, with my own back office in which AI agents do the groundwork. This article covers what they take on, what I still decide myself – and the rules I have set for it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;My five rules at a glance&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Nothing goes out without approval&lt;/strong&gt; – internally the AI works freely, externally I decide&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No figure without a source&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client data only when it is cleared&lt;/strong&gt; – the AI does not read my inbox&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Every project has a budget and a clear criterion&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The AI may disagree&lt;/strong&gt; – and so may I&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What the AI takes on
&lt;/h2&gt;

&lt;p&gt;The agents work for me, not for themselves. Specifically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Analysis:&lt;/strong&gt; bringing together search data, visitor numbers and keyword data and saying what matters. What used to take half a day of spreadsheets is now an overview within minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research:&lt;/strong&gt; competitors, trade media, legal changes – with sources, so I can check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drafts:&lt;/strong&gt; texts, posts, page concepts and, when needed, emails. A draft is always a proposal for me, never a result.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking my own visibility:&lt;/strong&gt; regular tests of how AI assistants such as ChatGPT or Gemini talk about my business. This has become one of my most important channels for enquiries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tasks and reminders:&lt;/strong&gt; whatever follows from an analysis lands in the system as a task with a date – not in my head.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I decide myself
&lt;/h2&gt;

&lt;p&gt;The line is simple: &lt;strong&gt;anything that goes outside or costs money, I decide.&lt;/strong&gt; This is how the work is split:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;The AI&lt;/th&gt;
&lt;th&gt;Me&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Analysis&lt;/td&gt;
&lt;td&gt;brings data together, highlights what stands out&lt;/td&gt;
&lt;td&gt;decide what follows from it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Research&lt;/td&gt;
&lt;td&gt;collects, with sources&lt;/td&gt;
&lt;td&gt;check the sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Texts and pages&lt;/td&gt;
&lt;td&gt;writes drafts&lt;/td&gt;
&lt;td&gt;cut, change, approve&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;td&gt;plans content, prepares posts, measures the effect&lt;/td&gt;
&lt;td&gt;decide topics and tone, approve every post&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Emails&lt;/td&gt;
&lt;td&gt;writes a draft when needed&lt;/td&gt;
&lt;td&gt;read my inbox myself and approve every email&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Client relationships&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;conversations, assessments, bad news&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And there is one thing no table captures: &lt;strong&gt;how it sounds.&lt;/strong&gt; Whether a sentence sounds like me, I notice when I read it. No AI can do that for me.&lt;/p&gt;

&lt;h2&gt;
  
  
  An everyday example: marketing
&lt;/h2&gt;

&lt;p&gt;This shows most clearly in marketing, the area that is most likely to slip alongside client projects. The agents take on much of the groundwork – and I decide what of it goes outside.&lt;/p&gt;

&lt;p&gt;The cycle behind my marketing looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Measure&lt;/strong&gt; – search data, visitors, enquiries by source&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan&lt;/strong&gt; – actions with reasons and dates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Draft&lt;/strong&gt; – pages, posts, research&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Approve&lt;/strong&gt; – I decide what goes out &lt;em&gt;(the only step that always stays with me)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure again&lt;/strong&gt; – does it work, or not?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Checking visibility:&lt;/strong&gt; the agents analyse search data and compare it with my plan. Whatever does not hold up is dropped instead of me continuing to optimise in the wrong place – rule 5 has an example.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keeping an eye on AI assistants:&lt;/strong&gt; regular tests check what ChatGPT or Gemini answer when someone asks for a provider like me. Where the answers have gaps, that becomes a task for the website. Because around a third of my enquiries come this way, this is now as important as Google.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source of every enquiry:&lt;/strong&gt; every enquiry is recorded with its source. That shows me which channels actually lead to projects – and which only bring clicks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research for guest articles:&lt;/strong&gt; the agents find suitable trade media, with sources. Which ones I contact and what I write there is my decision.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content on request:&lt;/strong&gt; texts are only created when I order them – rule 4 below shows how that is set up.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What I deliberately do not automate in marketing:&lt;/strong&gt; nothing is posted automatically, and no editor or contact receives an automatic email. Which topics I cover and how I sound stays with me.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  My five rules
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Nothing goes out without approval
&lt;/h3&gt;

&lt;p&gt;The line runs between inside and outside. Internally the agents may work freely: analyse, research, write drafts, create tasks. Anything that goes outside – an email, a post, a change to my website – only goes out after my approval. That costs a few seconds per item and prevents exactly the mistakes you cannot take back.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. No figure without a source
&lt;/h3&gt;

&lt;p&gt;Language models sound confident even when they are guessing. So the rule is: every figure I use has to go back to a source – my own data, a study, a document.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;An example from working on my website:&lt;/strong&gt; I wanted to write that "more than a third" of my enquiries come via AI assistants. The analysis of my lead tracking showed just under a third. So the page now says "around a third".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  3. Client data only when it is cleared
&lt;/h3&gt;

&lt;p&gt;What a client entrusts to me does not end up in a text, a reference or an analysis without asking. Some projects I mention only anonymously, some not at all. The agents know these rules and stick to them – and I still check.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What the AI never gets to see:&lt;/strong&gt; the AI does not read my inbox. It only writes an email draft when I need one – with the information I give it for that.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  4. Every project has a budget and a clear criterion
&lt;/h3&gt;

&lt;p&gt;AI costs real money per request. Every project in my back office therefore has a fixed monthly budget and a success criterion I measure it against. This is what it looks like for a real example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project: Texts on request&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Success criterion&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Every agreed text is delivered as a checked draft – no texts nobody ordered.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Budget&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;fixed limit per month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pace&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;only on request, not continuously&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;draft for approval, never published directly&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The criterion stops an agent from busily producing things nobody needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. The AI may disagree – and so may I
&lt;/h3&gt;

&lt;p&gt;A good agent says when an assumption is wrong. When reviewing my own plan for more visibility, the analysis showed that two of my assumptions were wrong. In turn, I reject suggestions that look good on paper but do not fit me. Both are normal and intended.&lt;/p&gt;

&lt;h2&gt;
  
  
  What works well – and what does not
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Works well:&lt;/strong&gt; anything that needs a lot of material and little judgement – bringing data together, writing drafts, research with sources, preparing routine tasks. This saves me hours every week.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Works less well:&lt;/strong&gt; anything that needs a feel for things – whether a reply suits a client, whether a text sounds too smooth, whether an idea fits the brand. The AI then gives a plausible but interchangeable answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Surprisingly important:&lt;/strong&gt; good foundations. The more clearly my own rules, positioning and wording are documented, the better the drafts get. Most of the work was not in the technology, but in writing down how I actually work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this has to do with the AI literacy obligation
&lt;/h2&gt;

&lt;p&gt;Under the European AI Act, companies that use AI have to support the AI literacy of their staff. The five rules above are essentially exactly that: clear agreements on what AI is used for, where its limits are and who decides what. In a team of several people, that includes everyone knowing and practising these rules. I have written a separate article on what the obligation actually requires: &lt;a href="https://hafenpixel.de/en/behind-the-scenes/ai-literacy-article-4-ai-act" rel="noopener noreferrer"&gt;AI literacy under Article 4 AI Act&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does AI replace employees in your business?&lt;/strong&gt;&lt;br&gt;
No. HafenPixel is a one-person business, and AI does not change that. It takes on groundwork so there is more time for the actual work for clients.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do clients get texts written by AI?&lt;/strong&gt;&lt;br&gt;
Clients get results I take responsibility for. Drafts may be created with AI, but every text and every piece of code only goes out after I have checked it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the AI read your emails?&lt;/strong&gt;&lt;br&gt;
No. The AI does not read my inbox. It only writes an email draft when I need one, and every email goes out only after my approval.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>freelance</category>
      <category>automation</category>
    </item>
    <item>
      <title>How I Manage a Corporate Client's Websites as a Solo</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Tue, 13 Oct 2026 11:27:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/how-i-manage-a-corporate-clients-websites-as-a-solo-4i2m</link>
      <guid>https://dev.to/joshmsn/how-i-manage-a-corporate-clients-websites-as-a-solo-4i2m</guid>
      <description>&lt;p&gt;One corporate client, several websites, a steady flow of new project sites — and on the other side, one person. Most people assume that takes an agency.&lt;/p&gt;

&lt;p&gt;I look after exactly that kind of website landscape for a corporate client. Here's how it works day to day, and where the limits are.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The ground rules&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No update without a backup&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing goes live untested&lt;/strong&gt; — test environment first, then production&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance in fixed intervals&lt;/strong&gt;, not "whenever there's time"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring&lt;/strong&gt;, so problems surface before anyone calls&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Short paths&lt;/strong&gt;: Teams and phone instead of a ticket system&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The starting point
&lt;/h2&gt;

&lt;p&gt;Corporate work rarely is one big project. It's many small ones, in three streams:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance:&lt;/strong&gt; WordPress core, theme and plugin updates, security, performance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Changes:&lt;/strong&gt; new content, adjusted pages, new or extended features&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New pages:&lt;/strong&gt; project websites that have to fit the existing landscape&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of it is big on its own. Together it adds up — and because several sites are involved, every mistake multiplies. An update that breaks a plugin may break it on several sites at once. So everything depends on routines.&lt;/p&gt;

&lt;h2&gt;
  
  
  Updates never go straight live
&lt;/h2&gt;

&lt;p&gt;The most important rule is the simplest one: &lt;strong&gt;nothing gets tried out on production.&lt;/strong&gt; Every update and every change follows the same order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Backup.&lt;/strong&gt; A full backup before every update. If something goes wrong, the previous state is back in minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test environment.&lt;/strong&gt; Updates and changes land on a copy first. Do forms work? Custom extensions? Mobile layout?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live.&lt;/strong&gt; Only when everything works on the copy does it go to the real site.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It takes a bit longer than clicking "update". Worth it: a bug on staging is annoying; a bug on a corporate website is a problem other people notice.&lt;/p&gt;

&lt;p&gt;Sites of the same client usually share plugins and custom extensions. An update that breaks one will likely break the others. Catch it on staging, and you've prevented it several times over.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixed intervals instead of constant firefighting
&lt;/h2&gt;

&lt;p&gt;Updates are bundled, tested together and deployed together, in &lt;strong&gt;fixed intervals&lt;/strong&gt;. For me that means one thoroughly tested state instead of five half-tested ones. For the client it means predictability — nobody gets surprised by a change that slipped in between.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitoring: see problems before the client does
&lt;/h2&gt;

&lt;p&gt;Sites can fail without anyone touching them: server issues, an expiring certificate, an external service that stops responding. So everything is &lt;strong&gt;monitored continuously&lt;/strong&gt;. If something breaks, I hear about it — ideally before anyone at the client notices.&lt;/p&gt;

&lt;p&gt;Good support is invisible. It stands out by nothing standing out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Short paths: Teams and phone, no tickets
&lt;/h2&gt;

&lt;p&gt;Requests come to me directly via &lt;strong&gt;Teams&lt;/strong&gt; or a &lt;strong&gt;quick call&lt;/strong&gt;. No ticket system, no project manager, no account manager. Whoever asks talks to whoever builds.&lt;/p&gt;

&lt;p&gt;That works because one person knows every site and every extension. "The new contact person is missing on the project page" needs no briefing — I know which page, how it's built and where the data lives.&lt;/p&gt;

&lt;p&gt;In an agency, the same request often gets logged, handed to someone who may not know the site, then reported back. Every handover costs time and risks losing something.&lt;/p&gt;

&lt;h2&gt;
  
  
  New project websites: designer + one developer
&lt;/h2&gt;

&lt;p&gt;Project sites are built &lt;strong&gt;individually&lt;/strong&gt;: a designer delivers the design, I implement it. That's more than the page itself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it has to fit the existing landscape technically — same plugins, same standards, same update routine&lt;/li&gt;
&lt;li&gt;from day one it's backed up, tested and monitored like the others&lt;/li&gt;
&lt;li&gt;and it stays with me: whoever built it maintains it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The designer focuses on how it looks; I focus on what keeps it stable and maintainable for years.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the limits are
&lt;/h2&gt;

&lt;p&gt;One person can't do everything. Three limits belong on the table:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No 24/7 on-call.&lt;/strong&gt; If you need guaranteed response times at night, you need a team in shifts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No large parallel project.&lt;/strong&gt; If a project needs five developers at once, an agency is the better fit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Absences have to be planned.&lt;/strong&gt; Holidays are agreed early so nothing critical falls into that window.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Against the biggest risk — everything depending on one person — one rule helps: &lt;strong&gt;code and access stay with the client.&lt;/strong&gt; Everything is built so any other developer could pick it up. The relationship lasts because it works, not because the client is locked in.&lt;/p&gt;

&lt;h2&gt;
  
  
  When the model fits
&lt;/h2&gt;

&lt;p&gt;Client size is no argument for an agency. The kind of work is. A steady stream of updates, changes and new pages on systems you need to know benefits more from continuity than from team size — and that's exactly what one person who stays provides.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Full write-up on &lt;a href="https://hafenpixel.de/en/behind-the-scenes/managing-corporate-websites" rel="noopener noreferrer"&gt;hafenpixel.de&lt;/a&gt;. If you've built a similar setup — or hit its limits — I'd like to hear about it in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>freelancing</category>
      <category>webdev</category>
      <category>devops</category>
    </item>
    <item>
      <title>Moving a Live SaaS from Firebase to Supabase: 283 Functions, 139 Tables, Zero Password Resets</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Tue, 06 Oct 2026 13:59:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/moving-a-live-saas-from-firebase-to-supabase-283-functions-139-tables-zero-password-resets-naj</link>
      <guid>https://dev.to/joshmsn/moving-a-live-saas-from-firebase-to-supabase-283-functions-139-tables-zero-password-resets-naj</guid>
      <description>&lt;p&gt;In mid-August 2026, &lt;a href="https://laizynote.eu" rel="noopener noreferrer"&gt;LaizyNote&lt;/a&gt; ran entirely on Firebase: data in Firestore, logic in Cloud Functions, sign-in via Firebase Auth. Four weeks later it ran on Supabase — same users, same subscriptions, and nobody had to reset their password.&lt;/p&gt;

&lt;p&gt;Here's how that worked while the product stayed live, and what went wrong along the way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The migration in numbers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;283&lt;/strong&gt; Firebase functions inventoried and decided one by one&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;139&lt;/strong&gt; tables, all with Row Level Security&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;206&lt;/strong&gt; SQL migrations in the repository&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3 weeks&lt;/strong&gt; from first code to the auth cutover&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0&lt;/strong&gt; password resets&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why move at all?
&lt;/h2&gt;

&lt;p&gt;Not for cost. The migration plan says it explicitly: Firebase would have stayed cheaper than any rebuild. The driver was &lt;strong&gt;data sovereignty&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;LaizyNote stores freelancers' business data — clients, revenue, hours. For a product on a &lt;code&gt;.eu&lt;/code&gt; domain, it should be clear where that data lives and who controls it. With Supabase it lives in Frankfurt, and the whole data model is kept as SQL migrations in the repo. If needed, the system could be self-hosted instead of reconstructed from a cloud console.&lt;/p&gt;

&lt;p&gt;A second reason showed up during planning: &lt;strong&gt;real columns instead of documents.&lt;/strong&gt; Many content types had a personal and a team collection in Firestore, maintained in parallel. In Postgres that's one table with an owner and an optional workspace — roughly half the data structures.&lt;/p&gt;

&lt;h2&gt;
  
  
  283 functions, decided one by one
&lt;/h2&gt;

&lt;p&gt;Before anything moved, every function Firebase ran — callables, scheduled jobs, document triggers — got an entry in a ledger. Each entry has exactly one status:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Count&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;active&lt;/td&gt;
&lt;td&gt;successor exists and is wired up&lt;/td&gt;
&lt;td&gt;253&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;offline&lt;/td&gt;
&lt;td&gt;successor exists, deliberately not used yet&lt;/td&gt;
&lt;td&gt;19&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;decommission&lt;/td&gt;
&lt;td&gt;no longer needed&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;blocked&lt;/td&gt;
&lt;td&gt;no complete successor yet&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The decommissioned ones are the interesting part. A nightly job that corrected usage counters became pointless because Postgres now checks limits inside the same transaction. Password-reset and verification mails are handled by Supabase Auth. A one-time repair function was replaced by a default value.&lt;/p&gt;

&lt;p&gt;The ledger isn't a spreadsheet: a script parses the code and fails on any function without a registered successor. Nothing could slip through, not even in the rush before cutover.&lt;/p&gt;

&lt;h2&gt;
  
  
  One switch per area
&lt;/h2&gt;

&lt;p&gt;The key building block: every part of the app talks to a &lt;strong&gt;gateway&lt;/strong&gt; instead of calling Firebase directly — one for notes, one for projects, one for auth, and so on. Each gateway had a Firebase adapter first and a Supabase adapter later, selected by one environment switch per area.&lt;/p&gt;

&lt;p&gt;Two details paid off:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Only one exact value switches.&lt;/strong&gt; Any typo meant Firebase, so a typo could never point the app at an empty database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No silent fallback.&lt;/strong&gt; Switch set to Supabase but no client configured? The app fails loudly instead of quietly using Firebase.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On August 31 the transition mode ran in the browser for the first time: Firebase signed the user in, Postgres served the notes. That worked because user IDs are &lt;strong&gt;computed, not looked up&lt;/strong&gt;: each new UUID is derived deterministically from the old Firebase UID. The import could be re-run any number of times without links shifting.&lt;/p&gt;

&lt;p&gt;Data came over through 46 import scripts, one per domain. Fields that didn't fit a clean column yet went into a legacy JSON column first — nothing lost, even if not yet modelled.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan versus reality
&lt;/h2&gt;

&lt;p&gt;The original plan said: one long branch, &lt;strong&gt;no&lt;/strong&gt; dual backend, &lt;strong&gt;no&lt;/strong&gt; Edge Functions. Both got built.&lt;/p&gt;

&lt;p&gt;The dual setup happened because it spreads risk — each area could be switched, verified and switched back on its own. Edge Functions came in on September 4, once it was clear Google should leave the system entirely, Cloud Functions included.&lt;/p&gt;

&lt;p&gt;A plan is a hypothesis. Changing it isn't the failure; changing it without documenting why would be.&lt;/p&gt;

&lt;h2&gt;
  
  
  From Firestore Rules to Row Level Security
&lt;/h2&gt;

&lt;p&gt;Every rule was rewritten as a Postgres policy, many with a comment pointing at the line in the old &lt;code&gt;firestore.rules&lt;/code&gt;. Result: &lt;strong&gt;139 tables, all with RLS, 141 policies&lt;/strong&gt;, all using one central function to resolve the current user — none reads it on its own.&lt;/p&gt;

&lt;p&gt;Columns users must not change (like their account type) are additionally protected with column-level grants as an allow-list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five bugs green tests would have missed
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A revoke that does nothing.&lt;/strong&gt; In Postgres, revoking a single column privilege has no effect if the role was granted the whole table earlier — you just get a warning. A guest could have promoted themselves. The check that policies &lt;em&gt;exist&lt;/em&gt; was green; only a test probing what they &lt;em&gt;do&lt;/em&gt; caught it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Empty isn't unset.&lt;/strong&gt; JavaScript's &lt;code&gt;||&lt;/code&gt; falls through on &lt;code&gt;''&lt;/code&gt;; SQL's &lt;code&gt;coalesce&lt;/code&gt; only on &lt;code&gt;NULL&lt;/code&gt;. A customer with an empty bonus field would have lost their bonus.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A function that throws instead of returning NULL.&lt;/strong&gt; During the transition, Firebase UIDs still flowed through the system. A built-in tried to cast them to UUID and raised an error — six storage policies blocked every query.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An empty table is silent data loss.&lt;/strong&gt; A settings table existed, grants and all, with zero rows. Switching over would have wiped 17 accounts' settings. Since then a reconciliation script counts every table against its Firestore source.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dead error branches.&lt;/strong&gt; The new gateways throw stable error codes, but a dozen call sites still compared against raw Firebase strings. Those branches never ran — including the lockout after repeated failed sign-ins. A dedicated test now prevents provider error strings from leaking.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The lesson from all five: in a migration, checking that something is &lt;em&gt;there&lt;/em&gt; isn't enough. Check that it &lt;em&gt;does&lt;/em&gt; what it should, with real data, from the user's side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cutover day
&lt;/h2&gt;

&lt;p&gt;Billing and the Stripe webhook moved on September 9, authentication on September 10:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Passwords:&lt;/strong&gt; Firebase's scrypt hashes were imported into Supabase Auth in a compatible format. Nobody set a new password.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User IDs:&lt;/strong&gt; every account got exactly the UUID derived from its Firebase UID — all links stayed valid.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subscriptions:&lt;/strong&gt; existing Stripe customers are found via a mapping table, older ones additionally via the legacy Firebase UID in their Stripe metadata.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before the switch: ~5,700 unit tests, ~1,800 server function tests, 303 policy checks, and a core-data reconciliation with not a single ID missing. 70 orphaned rows that no longer existed in Firebase were deleted after explicit approval.&lt;/p&gt;

&lt;p&gt;On September 13, Firebase was removed from the client. That commit touched 279 files and deleted more than 24,000 lines.&lt;/p&gt;

&lt;h2&gt;
  
  
  What got easier — and what didn't
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Easier&lt;/th&gt;
&lt;th&gt;Harder&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One table per content type instead of personal + team copy&lt;/td&gt;
&lt;td&gt;No built-in offline write queue — built a custom IndexedDB outbox&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Joins in access rules are cheap&lt;/td&gt;
&lt;td&gt;No App Check equivalent — accepted deliberately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Limits checked atomically in the database&lt;/td&gt;
&lt;td&gt;Realtime delivers single rows, not query results&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scheduled data jobs directly in Postgres (&lt;code&gt;pg_cron&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;No direct equivalent for Firestore triggers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Supabase handles auth mails&lt;/td&gt;
&lt;td&gt;Tighter CPU and memory limits for Edge Functions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What I take away
&lt;/h2&gt;

&lt;p&gt;The migration worked because it was &lt;strong&gt;reversible&lt;/strong&gt;: every area could be switched and switched back, every function had a recorded status, every import could be re-run. A platform switch isn't one big leap — it's many small ones you can verify individually.&lt;/p&gt;

&lt;p&gt;And: Firebase was the right choice to start with. Migrate when you have a clear reason and a project big enough to benefit. Without a reason, you're just trading known problems for unknown ones.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Full write-up on &lt;a href="https://hafenpixel.de/en/behind-the-scenes/firebase-to-supabase-migration-laizynote" rel="noopener noreferrer"&gt;hafenpixel.de&lt;/a&gt;. Related: &lt;a href="https://hafenpixel.de/en/behind-the-scenes/saas-billing-stripe-laizynote" rel="noopener noreferrer"&gt;how LaizyNote's Stripe billing works on Supabase&lt;/a&gt;. Questions welcome in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>firebase</category>
      <category>postgres</category>
      <category>saas</category>
    </item>
    <item>
      <title>I Got a WordPress Site to 972 ms — and I Won't Show You a Before/After</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Wed, 09 Sep 2026 08:57:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/i-got-a-wordpress-site-to-972-ms-and-i-wont-show-you-a-beforeafter-b7n</link>
      <guid>https://dev.to/joshmsn/i-got-a-wordpress-site-to-972-ms-and-i-wont-show-you-a-beforeafter-b7n</guid>
      <description>&lt;p&gt;Every WordPress performance post follows the same script: a red screenshot, a green screenshot, and a percentage in the headline.&lt;/p&gt;

&lt;p&gt;I can't give you that one, and the reason is the most useful thing in this article.&lt;/p&gt;

&lt;p&gt;A care service had a slow WordPress site on Divi. I reviewed it and fixed it in under two hours. The documented end state: &lt;strong&gt;972 ms load time, 2.0 MB page size, 65 requests, Pingdom grade B87.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What I don't have is an archived baseline. The original numbers were never saved. So I'm not going to reverse-engineer a "73% faster!" headline out of memory — which, if you read enough of these posts, is exactly what a lot of them are doing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Two problems, one of them invisible to tooling
&lt;/h2&gt;

&lt;p&gt;Visitors experienced this as two separate annoyances. Pages built up slowly. And above the actual content sat a banner asking them to unblock external content — which looked like part of the site but was a consent misconfiguration.&lt;/p&gt;

&lt;p&gt;That second one matters methodologically: &lt;strong&gt;a pure performance report would have scored it as irrelevant.&lt;/strong&gt; It costs almost no milliseconds. It just ruins the page. You only catch it by opening the site like a human being after you've read the waterfall.&lt;/p&gt;




&lt;h2&gt;
  
  
  The actual causes
&lt;/h2&gt;

&lt;p&gt;Nothing exotic. Pingdom and PageSpeed pointed at a short list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No effective page cache.&lt;/strong&gt; WordPress rebuilt pages from scratch on repeat visits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Oversized PNGs.&lt;/strong&gt; Images shipped far larger than their rendered size, barely compressed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A misassigned Borlabs content blocker.&lt;/strong&gt; It was attached to too broad a container, so the placeholder landed on regular page content instead of on an embedded third-party service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Worth saying plainly: &lt;strong&gt;"Divi is slow" would have been a lazy diagnosis.&lt;/strong&gt; Page builders do generate more CSS and markup than a hand-built theme. But the actual weight here was caching, images and one wrong selector. The theme was never touched.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I did, in order
&lt;/h2&gt;

&lt;p&gt;Order matters when the clock is running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Caching first.&lt;/strong&gt; WP Rocket, so WordPress can reuse finished page output instead of recomputing every visit. A page cache doesn't speed up any individual asset — it removes work from the critical start of the request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then the media.&lt;/strong&gt; Images evaluated against their &lt;em&gt;actual rendered size&lt;/em&gt;. An image displayed at 800 px wide has no business being several thousand pixels of lossless PNG. Right dimensions, right format for the subject, compression where the loss isn't visible in normal use.&lt;/p&gt;

&lt;p&gt;Those two attack different parts of the problem: caching reduces server work and time-to-HTML, image work reduces what the browser then has to download and decode. They compound rather than overlap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then the consent blocker.&lt;/strong&gt; Borlabs Cookie blocking external content until consent is correct behavior — &lt;em&gt;when there's actually a consent-requiring service at that spot&lt;/em&gt;. Assigned too broadly, the placeholder covers normal content. I fixed the assignment. I did &lt;strong&gt;not&lt;/strong&gt; switch consent management off to make a banner disappear, which would have been fast and professionally wrong. Afterwards I checked the page both with and without consent given.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then verification.&lt;/strong&gt; After every change: home page, navigation, forms, embedded content. Minification and deferred JavaScript will happily buy you a green score and a broken menu.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I deliberately didn't do
&lt;/h2&gt;

&lt;p&gt;This list is the actual craft.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Didn't swap the theme.&lt;/strong&gt; A Divi replacement means retesting layout, content and responsive behavior. That is not a two-hour job.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Didn't bulk-disable plugins.&lt;/strong&gt; Plugin &lt;em&gt;count&lt;/em&gt; isn't the metric. Whether a plugin does unnecessary work on the request being measured is.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Didn't enable aggressive JS delay.&lt;/strong&gt; Its side effects on navigation and forms couldn't be tested properly in the time available, so it stayed off.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good performance work is usually a small number of causes fixed properly, plus a list of risky things you chose not to touch.&lt;/p&gt;




&lt;h2&gt;
  
  
  Reading the result honestly
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Documented after&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Performance grade&lt;/td&gt;
&lt;td&gt;B87&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Page size&lt;/td&gt;
&lt;td&gt;2.0 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Load time&lt;/td&gt;
&lt;td&gt;972 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Requests&lt;/td&gt;
&lt;td&gt;65&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Effort&lt;/td&gt;
&lt;td&gt;under two hours&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That 2.0 MB is worth staring at: the site is under one second and still shipping 65 requests and a meaningful payload for a simple page. &lt;strong&gt;"Fast" and "fully optimized" are not the same state.&lt;/strong&gt; More was possible. It would have changed the ratio of effort, risk and measurable benefit.&lt;/p&gt;

&lt;p&gt;Without an archived baseline, the honest claim is the documented end state after under two hours. Less spectacular than a fabricated percentage, considerably more credible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you take one operational habit from this post: archive the baseline before you touch anything.&lt;/strong&gt; Not for the client — for yourself, so you can tell later which change actually did the work.&lt;/p&gt;




&lt;h2&gt;
  
  
  Optimize or rebuild?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Targeted optimization&lt;/th&gt;
&lt;th&gt;Rebuild&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Makes sense when&lt;/td&gt;
&lt;td&gt;design and content still work, the tech slows things down&lt;/td&gt;
&lt;td&gt;structure, content or audience no longer fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Typical levers&lt;/td&gt;
&lt;td&gt;caching, image formats, configuration errors&lt;/td&gt;
&lt;td&gt;information architecture, templates, content, tech&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Effort&lt;/td&gt;
&lt;td&gt;hours to days&lt;/td&gt;
&lt;td&gt;weeks to months&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Risk&lt;/td&gt;
&lt;td&gt;small and reversible&lt;/td&gt;
&lt;td&gt;rankings, redirects, editorial work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Outcome&lt;/td&gt;
&lt;td&gt;same site, measurably faster&lt;/td&gt;
&lt;td&gt;new site, new starting point&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This project was clearly the left column: three bounded causes, none of them structural.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Archive your baseline measurement.&lt;/strong&gt; Without it you have no honest story, only a number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open the site as a user.&lt;/strong&gt; A consent placeholder over your content costs no milliseconds and ruins the page anyway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Caching and image sizing before micro-optimizations.&lt;/strong&gt; Don't hunt milliseconds in a script while shipping megabytes of unnecessary image data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never fix a consent problem by disabling consent management.&lt;/strong&gt; Fix the assignment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A green metric with a broken menu is a failed optimization.&lt;/strong&gt; Re-test function after every change.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Full technical write-up on &lt;a href="https://hafenpixel.de/en/behind-the-scenes/wordpress-performance-optimization-divi" rel="noopener noreferrer"&gt;hafenpixel.de&lt;/a&gt;. If you want the deeper end of WordPress work, here's &lt;a href="https://hafenpixel.de/en/behind-the-scenes/onoffice-wordpress-integration" rel="noopener noreferrer"&gt;an onOffice CRM integration three agencies couldn't finish&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>performance</category>
      <category>webdev</category>
      <category>seo</category>
    </item>
    <item>
      <title>I Replaced a CMS With Two JSON Files and Nine Functions</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Thu, 03 Sep 2026 08:56:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/i-replaced-a-cms-with-two-json-files-and-nine-functions-3fmc</link>
      <guid>https://dev.to/joshmsn/i-replaced-a-cms-with-two-json-files-and-nine-functions-3fmc</guid>
      <description>&lt;p&gt;The default answer to "I need a website I can update myself" is WordPress. Sometimes that's right. This time it wasn't.&lt;/p&gt;

&lt;p&gt;A therapy practice had an aging Jimdo site. The replacement needed to look current, lead more clearly to enquiries, and — this is the part that shaped everything — not carry the maintenance overhead of a full CMS.&lt;/p&gt;

&lt;p&gt;So instead of asking &lt;em&gt;"which CMS?"&lt;/em&gt; I asked a different question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which content does she genuinely need to edit?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer was short: seminars, and the enquiries that come from them. Everything else — therapy services, terms, the about page — changes maybe twice a year.&lt;/p&gt;

&lt;p&gt;That answer is the entire architecture.&lt;/p&gt;




&lt;h2&gt;
  
  
  What actually got built
&lt;/h2&gt;

&lt;p&gt;A PHP 8 website. No framework. No MySQL. Service pages live in plain, clearly structured templates. A small protected admin area handles the two things that move: seminars and enquiries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzau1gnadopk0v6qbh3dk.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzau1gnadopk0v6qbh3dk.webp" alt="Editing a seminar in the admin area: base data, image and multiple dates" width="800" height="817"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Seminars and enquiries are stored as structured JSON in protected directories. For this data volume — one editor, a handful of records, no concurrent transactions — that is simpler to back up and reason about than adding a database server to the stack.&lt;/p&gt;




&lt;h2&gt;
  
  
  The whole data layer
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Writing: JSON_PRETTY_PRINT keeps the file readable, LOCK_EX prevents&lt;/span&gt;
&lt;span class="c1"&gt;// two processes from leaving half a file behind.&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;seminare_save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$seminare&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;json_encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$seminare&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="no"&gt;JSON_PRETTY_PRINT&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;JSON_UNESCAPED_UNICODE&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;JSON_UNESCAPED_SLASHES&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;file_put_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;SEMINARE_FILE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;LOCK_EX&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Reading: older records had a single date field. The migration runs&lt;/span&gt;
&lt;span class="c1"&gt;// on load, not as a one-off script, so existing records stay compatible.&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;seminare_load&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;json_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file_get_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;SEMINARE_FILE&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;is_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

    &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$data&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dates'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'date'&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dates'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="s1"&gt;'date'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'date'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="s1"&gt;'time'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'time'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;]];&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dates'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dates'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Public listing: sorted by the next date that has not passed yet.&lt;/span&gt;
&lt;span class="c1"&gt;// A seminar with three dates stays visible until the last one is over.&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;seminar_next_date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$seminar&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;?array&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$today&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Y-m-d'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$future&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;array_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$seminar&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dates'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
        &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$d&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'date'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nv"&gt;$today&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;usort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$future&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;strcmp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'date'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nv"&gt;$b&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'date'&lt;/span&gt;&lt;span class="p"&gt;]));&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$future&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three things in there are worth more than they look.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;LOCK_EX&lt;/code&gt; on the write.&lt;/strong&gt; Flat-file storage without a lock is how you end up with a truncated JSON file and a site that 500s. One flag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The migration runs on read, not as a script.&lt;/strong&gt; Seminars originally had a single &lt;code&gt;date&lt;/code&gt;. When they needed multiple dates, the shape changed. Instead of a one-off migration script that someone forgets to run on the backup restore, &lt;code&gt;seminare_load()&lt;/code&gt; normalizes old records every time. Existing data stays compatible forever, and there's no migration state to track.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The public list sorts by &lt;em&gt;next open date&lt;/em&gt;, not by file order.&lt;/strong&gt; That's why a seminar with three dates stays visible until the last one passes, without the editor having to create it three times or hide it manually afterwards.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where the boundary sits
&lt;/h2&gt;

&lt;p&gt;An off-the-shelf seminar platform would have given more: online payment, automatic reminders, capacity management, participant exports.&lt;/p&gt;

&lt;p&gt;None of that matched the workflow. It would have added recurring cost, another account, and a &lt;em&gt;binding&lt;/em&gt; booking process — for a practice where participation is confirmed personally, by a human, on purpose.&lt;/p&gt;

&lt;p&gt;So "Register now" doesn't open a checkout. It opens the contact form, pre-filled with the seminar title and topic. The enquiry lands in the admin area &lt;em&gt;and&lt;/em&gt; in the inbox. She reads, replies, confirms.&lt;/p&gt;

&lt;p&gt;That's an &lt;strong&gt;enquiry system&lt;/strong&gt;, not a booking system. Naming it honestly kept the scope from drifting.&lt;/p&gt;




&lt;h2&gt;
  
  
  Security without a plugin stack
&lt;/h2&gt;

&lt;p&gt;"No CMS" is not a security feature by itself. Fewer components means less update surface, not zero responsibility.&lt;/p&gt;

&lt;p&gt;What's actually in there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;password hashes, protected sessions, CSRF tokens on every writing action&lt;/li&gt;
&lt;li&gt;escaped output, sensitive directories blocked at the server config level&lt;/li&gt;
&lt;li&gt;contact form: server-side validation, honeypot, session rate limit, privacy confirmation&lt;/li&gt;
&lt;li&gt;image uploads validated by real MIME type via &lt;code&gt;finfo&lt;/code&gt;, size-capped, stored under a random filename, old files removed on replacement&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the part people skip: &lt;strong&gt;PHP version, server config and backups still need attention.&lt;/strong&gt; The difference is that there's one small, readable codebase to reason about instead of a general-purpose CMS full of features this project never uses.&lt;/p&gt;




&lt;h2&gt;
  
  
  When this is the wrong call
&lt;/h2&gt;

&lt;p&gt;I'd move to a database the moment any of these show up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;more than one person editing at the same time&lt;/li&gt;
&lt;li&gt;binding bookings with real capacity management&lt;/li&gt;
&lt;li&gt;reporting across records&lt;/li&gt;
&lt;li&gt;data volume where "read the whole file" stops being sane&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The nice part: that migration is contained. All data access sits in &lt;code&gt;seminare_load()&lt;/code&gt; and &lt;code&gt;seminare_save()&lt;/code&gt;. The public pages and the admin area only ever see arrays. Swapping to MySQL replaces that thin layer, not the templates.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask "what needs editing?" before "which CMS?"&lt;/strong&gt; The answer is usually much smaller than a CMS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flat-file JSON is a legitimate choice at small scale&lt;/strong&gt; — with &lt;code&gt;LOCK_EX&lt;/code&gt;, and with a clear threshold for when it stops being one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run schema migrations on read.&lt;/strong&gt; No script to forget, no state to track, old backups keep working.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name the feature honestly.&lt;/strong&gt; "Enquiry system" instead of "booking system" prevented a month of scope creep.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concentrate data access in a few functions.&lt;/strong&gt; It's what makes "we'll move to a database later" a real option instead of a comforting lie.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Full technical write-up on &lt;a href="https://hafenpixel.de/en/behind-the-scenes/custom-php-seminar-management-friederike-lindecke" rel="noopener noreferrer"&gt;hafenpixel.de&lt;/a&gt;. The live site is &lt;a href="https://friederikelindecke.de" rel="noopener noreferrer"&gt;friederikelindecke.de&lt;/a&gt;. Happy to argue about flat files in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>architecture</category>
      <category>showdev</category>
    </item>
    <item>
      <title>A Shopify Theme Update Is a Migration, Not a Click</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Thu, 27 Aug 2026 08:54:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/a-shopify-theme-update-is-a-migration-not-a-click-47b5</link>
      <guid>https://dev.to/joshmsn/a-shopify-theme-update-is-a-migration-not-a-click-47b5</guid>
      <description>&lt;p&gt;The Shopify admin shows a friendly "Update available" button on your theme. On a stock theme, you click it. On a shop with two years of custom Liquid in it, that button is a trap.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mantraroma.shop/" rel="noopener noreferrer"&gt;Mantraroma&lt;/a&gt; sells silver jewelry with real gemstones. The shop didn't need a rebuild — it needed to get faster, move to a current theme version, and let customers browse by gemstone or by jewelry type. All while keeping the custom features that were already there.&lt;/p&gt;

&lt;p&gt;Here's what that actually involved.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why a theme update stops being a click
&lt;/h2&gt;

&lt;p&gt;A new theme version cannot simply overwrite individually changed files. Copy the old files over the new ones and you lose the theme developer's fixes. Take the new files wholesale and you lose your custom work.&lt;/p&gt;

&lt;p&gt;So the upgrade to Symmetry 7.4.0 started with an inventory, not with an upload:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which snippets had actually been modified?&lt;/li&gt;
&lt;li&gt;Which settings belonged to the old theme version?&lt;/li&gt;
&lt;li&gt;Which app blocks and extra scripts were attached to which templates?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only after separating &lt;strong&gt;theme default&lt;/strong&gt; from &lt;strong&gt;app code&lt;/strong&gt; from &lt;strong&gt;project-specific work&lt;/strong&gt; could anything move. The new version went up as its own working copy, and customizations were transferred feature by feature — slower than copy-paste, but it preserves the upstream improvements you're upgrading for in the first place.&lt;/p&gt;

&lt;p&gt;Then: home page, collection pages, product pages, cart and mobile navigation, checked against the old shop. Plus a performance measurement after every substantial change.&lt;/p&gt;




&lt;h2&gt;
  
  
  Filters that match how people actually shop
&lt;/h2&gt;

&lt;p&gt;Jewelry browsing is preference-driven. Some visitors start with "I want a ring." Others start with "I want moonstone." A search box and rigid categories serve neither well.&lt;/p&gt;

&lt;p&gt;So the shop filters on exactly two axes: &lt;strong&gt;gemstone&lt;/strong&gt; and &lt;strong&gt;jewelry type&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4y128gil61rxnx66bg22.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4y128gil61rxnx66bg22.webp" alt="Mantraroma collection page with the gemstone swatch row and the jewelry-type entry points above the filtered lapis lazuli earrings" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For gemstones, a text list is useless — a stone is recognized visually before its name is read. The swatches are built from the existing variant images:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight liquid"&gt;&lt;code&gt;&amp;lt;!-- Theme settings: gemstone is registered as its own swatch option --&amp;gt;
swatch_option_name   = "Edelstein"
swatch_method        = "variant-images"   // image comes from the variant
swatch_style         = "icon_circle"      // circular picker instead of a text list
enable_filter_swatches = true

&amp;lt;!-- Color values as a fallback when no variant image exists --&amp;gt;
swatch_value_list =
  Amethyst:#9966cc      Granat:#8c381c       Labradorit:#657b83
  Malachit:#0BDA51      Mondstein:#3aa8c1    Onyx:#353935
  Rosenquarz:#f7cac9    Tigerauge:#e08d3c    Türkis:#008888

&amp;lt;!-- Liquid renders the filter values available in each collection --&amp;gt;
&lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;values&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;-%}&lt;/span&gt;
  &amp;lt;label class="filter-group__item&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;active&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt; …--active&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
                &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt; …--disabled&lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;"
    &lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;filter_group_is_swatch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt; data-swatch="&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;downcase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;"
      &lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
        style="--swatch-background-image: url(&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;)"
      &lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;elsif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;color&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
        style="--swatch-background-color: rgb(&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;swatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;rgb&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;)"
      &lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;
    &lt;span class="cp"&gt;{%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;%}&lt;/span&gt;&amp;gt;
&lt;span class="cp"&gt;{%-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;endfor&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;-%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Jewelry type stayed text-based on purpose. "Ring", "necklace" and "earrings" are read faster as words than as tiny icons.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The unglamorous part that makes or breaks this:&lt;/strong&gt; product data has to speak one language. "Moonstone", "moon stone", and a stone mentioned only in a product title are three different things to a filter. Most of the work was not presentation — it was a reliable relationship between filter value, product variant and image.&lt;/p&gt;




&lt;h2&gt;
  
  
  The performance series
&lt;/h2&gt;

&lt;p&gt;Performance wasn't measured once at the end. Every stage got its own numbers, which turned out to be the useful part:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Start&lt;/th&gt;
&lt;th&gt;Lazy loading&lt;/th&gt;
&lt;th&gt;Cookie banner&lt;/th&gt;
&lt;th&gt;Minification&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pingdom grade&lt;/td&gt;
&lt;td&gt;71&lt;/td&gt;
&lt;td&gt;69&lt;/td&gt;
&lt;td&gt;69&lt;/td&gt;
&lt;td&gt;72&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Page size&lt;/td&gt;
&lt;td&gt;6.1 MB&lt;/td&gt;
&lt;td&gt;2.0 MB&lt;/td&gt;
&lt;td&gt;1.6 MB&lt;/td&gt;
&lt;td&gt;2.1 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Load time&lt;/td&gt;
&lt;td&gt;8.11 s&lt;/td&gt;
&lt;td&gt;1.34 s&lt;/td&gt;
&lt;td&gt;1.04 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.7 s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Requests&lt;/td&gt;
&lt;td&gt;168&lt;/td&gt;
&lt;td&gt;167&lt;/td&gt;
&lt;td&gt;140&lt;/td&gt;
&lt;td&gt;134&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PageSpeed Desktop&lt;/td&gt;
&lt;td&gt;98&lt;/td&gt;
&lt;td&gt;99&lt;/td&gt;
&lt;td&gt;96&lt;/td&gt;
&lt;td&gt;99&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PageSpeed Mobile&lt;/td&gt;
&lt;td&gt;56&lt;/td&gt;
&lt;td&gt;51&lt;/td&gt;
&lt;td&gt;86&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;86&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile FCP&lt;/td&gt;
&lt;td&gt;7.0 s&lt;/td&gt;
&lt;td&gt;5.6 s&lt;/td&gt;
&lt;td&gt;2.3 s&lt;/td&gt;
&lt;td&gt;2.3 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile LCP&lt;/td&gt;
&lt;td&gt;24.8 s&lt;/td&gt;
&lt;td&gt;12.6 s&lt;/td&gt;
&lt;td&gt;3.5 s&lt;/td&gt;
&lt;td&gt;3.8 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Load time fell by roughly 91%. Page weight by about two thirds. Mobile PageSpeed went from 56 to 86 while desktop was already sitting at 98.&lt;/p&gt;

&lt;p&gt;Now read the table sideways, because that's where it gets interesting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optimization is not linear.&lt;/strong&gt; Lazy loading cut page weight and load time dramatically — and the synthetic Pingdom grade &lt;em&gt;dropped&lt;/em&gt; from 71 to 69. Minification produced the fastest load time and the best desktop score while the measured page size went back up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The biggest mobile win didn't come from minification.&lt;/strong&gt; Mobile LCP dropped from 24.8 s to 3.5 s after the media load and third-party scripts were brought under control — before the final optimization stage ran at all.&lt;/p&gt;

&lt;p&gt;Test timing, cache state, third parties and whichever hero image happened to load can all move individual numbers. The useful signal is never one green score; it's the pattern across load time, requests and Core Web Vitals together.&lt;/p&gt;




&lt;h2&gt;
  
  
  Filters and SEO have to be designed together
&lt;/h2&gt;

&lt;p&gt;A good filter can generate an enormous number of URL states: rings with moonstone, necklaces with onyx, everything in a price band. Almost none of those are a page worth indexing.&lt;/p&gt;

&lt;p&gt;The discipline:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;editorially maintained &lt;strong&gt;collection and landing pages&lt;/strong&gt; stay the index targets&lt;/li&gt;
&lt;li&gt;filters help &lt;em&gt;within&lt;/em&gt; those pages&lt;/li&gt;
&lt;li&gt;canonicals, Shopify's URL logic and a robots rule for variant parameters keep thin state URLs out of the index&lt;/li&gt;
&lt;li&gt;product and article pages carry structured data and unique metadata&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shopify fixes parts of sitemap and routing for you. The answer isn't to fight that with more scripts — it's to be rigorous on the layers you &lt;em&gt;do&lt;/em&gt; control: clean product data, clear collections, internal links, and a theme that doesn't invent unnecessary URL variants.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Treat a theme update on a customized shop as a migration.&lt;/strong&gt; Inventory first, transfer feature by feature, never file-over-file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build swatches from variant images you already have.&lt;/strong&gt; A stored color value is a fallback, not the plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A filter is only as good as your product data.&lt;/strong&gt; Inconsistent naming turns one filter into three broken ones.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure after every stage, not once at the end.&lt;/strong&gt; The intermediate rows tell you which change actually did the work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One score is not a diagnosis.&lt;/strong&gt; A synthetic grade can fall while the site genuinely gets faster.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Full technical write-up on &lt;a href="https://hafenpixel.de/en/behind-the-scenes/shopify-filters-performance-mantraroma" rel="noopener noreferrer"&gt;hafenpixel.de&lt;/a&gt;. I've also written about &lt;a href="https://hafenpixel.de/en/behind-the-scenes/shopify-custom-cart-no-apps" rel="noopener noreferrer"&gt;replacing three Shopify apps with custom Liquid&lt;/a&gt; if you're in app-diet mode.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>shopify</category>
      <category>performance</category>
      <category>webdev</category>
      <category>ecommerce</category>
    </item>
    <item>
      <title>Your Stripe Webhook Is Not Your Entitlement System</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Thu, 20 Aug 2026 06:52:51 +0000</pubDate>
      <link>https://dev.to/joshmsn/your-stripe-webhook-is-not-your-entitlement-system-883</link>
      <guid>https://dev.to/joshmsn/your-stripe-webhook-is-not-your-entitlement-system-883</guid>
      <description>&lt;p&gt;Stripe Checkout returns &lt;code&gt;success&lt;/code&gt;. The money moved. Job done, right?&lt;/p&gt;

&lt;p&gt;That is the moment the actual product logic begins. Which plan does this user own &lt;em&gt;right now&lt;/em&gt;? Which features may they use? What happens when the card fails next month, when they cancel mid-period, or when a webhook shows up nine minutes late?&lt;/p&gt;

&lt;p&gt;I built billing for &lt;a href="https://laizynote.eu" rel="noopener noreferrer"&gt;LaizyNote&lt;/a&gt; myself — Stripe for payments, invoices and retries, Supabase Auth for identity, Edge Functions for the event handling, and Postgres for the state the app actually reads, including the access rules. Here is the part that took the longest, and it wasn't the Checkout.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update (October 2026):&lt;/strong&gt; LaizyNote moved from Firebase to Supabase in September 2026. This post describes the current architecture.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  A payment is not an entitlement
&lt;/h2&gt;

&lt;p&gt;LaizyNote has two plans — Free and Plus — plus monthly and yearly billing, coupons, referral bonuses, time-limited access grants and separately purchased AI credits. Behind a simple pricing table sits a state machine.&lt;/p&gt;

&lt;p&gt;The rule that kept me out of trouble: &lt;strong&gt;the application never trusts a button, a redirect or a URL parameter.&lt;/strong&gt; A user can abandon Checkout, open it twice, or already own a subscription. A webhook can arrive late. A payment can fail &lt;em&gt;after&lt;/em&gt; the first successful activation.&lt;/p&gt;

&lt;p&gt;The stored plan has to be derived from verified Stripe data, and only from that.&lt;/p&gt;




&lt;h2&gt;
  
  
  One function decides, and it lives in the database
&lt;/h2&gt;

&lt;p&gt;The mistake I see most often in SaaS codebases: five different modules each interpreting &lt;code&gt;subscription.status&lt;/code&gt; slightly differently. The pricing screen says Plus, some other code path reads the raw &lt;code&gt;tier&lt;/code&gt; column and says Free.&lt;/p&gt;

&lt;p&gt;So there is exactly one function that answers "which plan is in force" — and it is a Postgres function, so every query and every access rule sees the same answer, whether the call comes from the app, an Edge Function or a scheduled job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Simplified.&lt;/span&gt;
&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;effective_tier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p_user_id&lt;/span&gt; &lt;span class="n"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;
&lt;span class="k"&gt;language&lt;/span&gt; &lt;span class="k"&gt;sql&lt;/span&gt; &lt;span class="k"&gt;stable&lt;/span&gt; &lt;span class="k"&gt;security&lt;/span&gt; &lt;span class="k"&gt;definer&lt;/span&gt;
&lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="err"&gt;$$&lt;/span&gt;
  &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;select&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt;
        &lt;span class="c1"&gt;-- past_due and unpaid stay entitled on purpose: Stripe is still retrying.&lt;/span&gt;
        &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;coalesce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stripe_subscription_id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;
             &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'trialing'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'past_due'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'unpaid'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="s1"&gt;'free'&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;normalize_tier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;bonus_access_tier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bonus_access_expires_at&lt;/span&gt;
    &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;subscriptions&lt;/span&gt;
    &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p_user_id&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;coalesce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;
    &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt;
      &lt;span class="c1"&gt;-- A bonus lifts the plan, never lowers it - and expires by timestamp.&lt;/span&gt;
      &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;bonus_access_expires_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
           &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tier_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bonus_access_tier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tier_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;normalize_tier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bonus_access_tier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;tier&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;
  &lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s1"&gt;'free'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;$$&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three decisions worth stealing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;past_due&lt;/code&gt; and &lt;code&gt;unpaid&lt;/code&gt; stay entitled.&lt;/strong&gt; Stripe is still retrying the card. Yanking features the moment a payment method expires punishes your most forgiving customers for a bank's timeout. The payment problem gets flagged in the UI instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus access is a separate layer that expires by timestamp.&lt;/strong&gt; No job has to write "bonus over" into a row. The function compares against &lt;code&gt;now()&lt;/code&gt;. Nothing to forget, nothing to backfill.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A bonus lifts, never lowers.&lt;/strong&gt; One comparison that prevents handing a paying Plus customer a promotional grant and quietly downgrading them.&lt;/p&gt;




&lt;h2&gt;
  
  
  Stripe is the source of truth. It is not your database.
&lt;/h2&gt;

&lt;p&gt;Webhook processing translates Stripe objects into a compact row in &lt;code&gt;subscriptions&lt;/code&gt;: plan, billing cycle, current period, cancel-at-period-end, failed-payment flags.&lt;/p&gt;

&lt;p&gt;That projection matters. Without it, every page navigation would hit the Stripe API — latency and rate limits included. With it, the plan loads alongside the rest of the account data, and the underlying Stripe subscription and price stay traceable.&lt;/p&gt;

&lt;p&gt;The webhook Edge Function verifies the signature first, then doesn't trust the single event: it re-reads all of the customer's subscriptions from Stripe. If more than one turns out to be entitled, it raises an integrity alert instead of silently picking one.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;checkout.session.completed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;maps the purchase to the user account, activates the plan&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;customer.subscription.created&lt;/code&gt; / &lt;code&gt;.updated&lt;/code&gt; / &lt;code&gt;.deleted&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;reconciles sign-ups, plan changes and cancellations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;invoice.paid&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;records a successful payment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;invoice.payment_failed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;flags the problem for the UI&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;One migration detail worth mentioning: older subscriptions still carry the former Firebase user ID in their Stripe metadata. A separate customer-mapping table plus a fallback lookup keeps them assigned correctly — no customer had to resubscribe.&lt;/p&gt;




&lt;h2&gt;
  
  
  The gate lives in Postgres, not in the frontend
&lt;/h2&gt;

&lt;p&gt;The app hides features that don't belong to your plan and stops you creating content past a Free limit. Good for comprehension. Worthless as protection — anyone can call the API directly.&lt;/p&gt;

&lt;p&gt;So the gate sits in the database. Every table has Row Level Security, and the insert policy checks the plan quota in the same breath as ownership:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="nv"&gt;"notes: insert within quota"&lt;/span&gt;
  &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;notes&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;insert&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
  &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="k"&gt;check&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt;
      &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
        &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_workspace_member&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;workspace_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;within_team_content_limit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;workspace_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'notes'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="n"&gt;owner_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current_user_id&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;within_personal_content_limit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'notes'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Limits live in their own table; usage counters are maintained by triggers inside the same transaction. That made the old nightly "recount and fix drift" audit unnecessary.&lt;/p&gt;

&lt;p&gt;Where an action is more than a row, the Edge Function checks the effective plan: automatic backups need Plus, automation rules are capped at three on Free, and AI usage is booked by a single database function that checks the monthly quota and deducts credits atomically — two concurrent requests can't spend the same balance.&lt;/p&gt;

&lt;p&gt;For team workspaces, entitlement follows the &lt;strong&gt;workspace owner&lt;/strong&gt;, read through a dedicated security-definer function. If every invited member inherited the workspace plan, a Free user collaborating in someone else's Plus team would suddenly have Plus features in their own private space.&lt;/p&gt;




&lt;h2&gt;
  
  
  Webhooks are not enough
&lt;/h2&gt;

&lt;p&gt;Webhooks are the fastest way to learn about a Stripe change. They are not a consistency guarantee. Events get delayed, retried, or delivered twice.&lt;/p&gt;

&lt;p&gt;Two things follow from that:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Processing must be idempotent.&lt;/strong&gt; Every event is recorded by ID in a &lt;code&gt;stripe_webhook_events&lt;/code&gt; table before it is processed. A repeat is either already done (answer 200 immediately) or still in progress (answer 409 so Stripe retries later); a stuck run releases its lock after 15 minutes. Separately purchased AI credits additionally use the Stripe Session ID as a unique booking key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Something has to reconcile.&lt;/strong&gt; A &lt;code&gt;pg_cron&lt;/code&gt; job calls a reconcile Edge Function every night. It replays the same logic as the webhook against Stripe and downgrades subscriptions that no longer exist there. A second job handles expired cancellations and bonus grants. Webhooks give you speed; the scheduled pass gives you correctness.&lt;/p&gt;




&lt;h2&gt;
  
  
  Would I use WooCommerce instead? Sometimes.
&lt;/h2&gt;

&lt;p&gt;I have also built subscription billing on WooCommerce Subscriptions, for a standalone calculation tool with a WordPress backend. It was the right call there.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Stripe + Supabase&lt;/th&gt;
&lt;th&gt;WooCommerce Subscriptions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fits&lt;/td&gt;
&lt;td&gt;a standalone app with its own user accounts&lt;/td&gt;
&lt;td&gt;a product where WordPress is already the platform&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User management&lt;/td&gt;
&lt;td&gt;already in place (Supabase Auth)&lt;/td&gt;
&lt;td&gt;a second user world to keep in sync&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subscription logic&lt;/td&gt;
&lt;td&gt;you build it: webhooks, plan logic in SQL, reconciliation&lt;/td&gt;
&lt;td&gt;largely covered by the plugin&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Edge cases (bonus, limits, teams)&lt;/td&gt;
&lt;td&gt;free to model, directly in access rules&lt;/td&gt;
&lt;td&gt;bound to the plugin data model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upfront effort&lt;/td&gt;
&lt;td&gt;high&lt;/td&gt;
&lt;td&gt;low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ongoing maintenance&lt;/td&gt;
&lt;td&gt;your own code, no plugin updates&lt;/td&gt;
&lt;td&gt;plugin, theme and WordPress updates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;LaizyNote &lt;em&gt;is&lt;/em&gt; the product. Vue and Supabase already provide the app, the accounts and the data model. Bolting on WordPress purely for billing would have created a second user and data domain to reconcile forever.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Derive entitlement, never store it as the truth.&lt;/strong&gt; One function, one decision point — ideally in the database, so nothing can bypass it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't cut off access on the first failed payment.&lt;/strong&gt; &lt;code&gt;past_due&lt;/code&gt; and &lt;code&gt;unpaid&lt;/code&gt; mean Stripe is still working on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model temporary grants as their own layer with an expiry timestamp&lt;/strong&gt; — and make sure they can only lift a plan, never lower it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assume every webhook will be delivered twice and one will be missed.&lt;/strong&gt; Event dedup plus a scheduled reconciliation job.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The hard part isn't Checkout. It's the transitions&lt;/strong&gt; — paid to overdue, active to cancelled, Plus back to Free without deleting anyone's data.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Full technical write-up on &lt;a href="https://hafenpixel.de/en/behind-the-scenes/saas-billing-stripe-laizynote" rel="noopener noreferrer"&gt;hafenpixel.de&lt;/a&gt;. If you want the wider story of building this thing solo, I wrote about &lt;a href="https://hafenpixel.de/en/behind-the-scenes/building-my-own-saas-laizynote" rel="noopener noreferrer"&gt;16 months of LaizyNote&lt;/a&gt; too. Questions welcome in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>stripe</category>
      <category>saas</category>
      <category>firebase</category>
      <category>webdev</category>
    </item>
    <item>
      <title>I Spent 16 Months Building My Own SaaS Solo — Why the Last 10% Takes Months</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Wed, 22 Jul 2026 09:18:29 +0000</pubDate>
      <link>https://dev.to/joshmsn/i-spent-16-months-building-my-own-saas-solo-the-last-10-took-longer-than-the-first-90-288</link>
      <guid>https://dev.to/joshmsn/i-spent-16-months-building-my-own-saas-solo-the-last-10-took-longer-than-the-first-90-288</guid>
      <description>&lt;p&gt;16 months. Several hundred hours alongside client work. One finished product.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://laizynote.eu" rel="noopener noreferrer"&gt;LaizyNote&lt;/a&gt; — a business operating system for freelancers and solo entrepreneurs: notes, tasks, projects, time tracking, contacts, calendar, documents and an AI assistant in a single interface.&lt;/p&gt;

&lt;p&gt;I've written plenty about client projects. This is different — this one is mine. And that changes everything: the perspective, the responsibility, and the honest realization of how much a "finished" SaaS actually takes.&lt;/p&gt;

&lt;p&gt;No code in this one. Just the parts that were genuinely hard.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why build your own SaaS?
&lt;/h2&gt;

&lt;p&gt;Out of my own need. It bugged me that there was no tool you could start with for free, that had everything I needed — and that would later also help me &lt;em&gt;run&lt;/em&gt; my business. The big names can do a lot, but they're bloated: you spend weeks setting up before you jot down your first thought.&lt;/p&gt;

&lt;p&gt;I wanted the opposite: start instantly, yet have everything on board when you need it. While building, it became clear this isn't a niche — it's a gap. Freelancers juggle five tools (notes here, time tracking there, invoices somewhere else) and none of them shows how their business is actually doing.&lt;/p&gt;

&lt;p&gt;That last part — &lt;strong&gt;Business Insights&lt;/strong&gt; — is the one feature I'd single out. Because LaizyNote already knows your time, projects, clients and revenue, it can derive the numbers you'd otherwise keep in a spreadsheet: your &lt;em&gt;real&lt;/em&gt; hourly rate (not the one you bill), the trend over years, client health, whether your portfolio leans too heavily on one client. Other tools show you what you did. This shows you what it earned you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hard part #1: keeping an overview at scale
&lt;/h2&gt;

&lt;p&gt;The biggest technical challenge wasn't a single difficult feature. It was keeping an overview: where which data lives, where it flows, who is allowed to see what — and making sure it stays that way while ten other things change.&lt;/p&gt;

&lt;p&gt;LaizyNote runs on Supabase (Postgres with access rules in the database, Edge Functions, hosted in Frankfurt). It started out on Firebase and moved over completely in September 2026. Every user has a personal space but can also share team workspaces with roles and permissions. That's where it gets tricky: every single query has to know whether it concerns personal or shared team data, and whether the user may access it at all.&lt;/p&gt;

&lt;p&gt;With other people's data you can't afford a single mistake. So the access rules live directly in the database — it decides on every query what someone may see, never the browser. Everything follows the same patterns: consistent data paths, workspace-specific caches, centrally defined rules instead of special cases per feature. It sounds bureaucratic. It's the only way a new feature doesn't quietly break three old ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hard part #2: why the last 10% takes months
&lt;/h2&gt;

&lt;p&gt;Prototyping is incredibly fast today. A new module stands in days. What eats time is the polish — the last 10% that separates a hobby project from a product people trust with their work.&lt;/p&gt;

&lt;p&gt;That 10% is made of things nobody notices as long as they work, and that stand out immediately when they don't:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What happens with empty data, on the first login, with 10,000 entries?&lt;/li&gt;
&lt;li&gt;A link that should open the right plan straight after sign-up — and quietly fails if a single parameter is missing.&lt;/li&gt;
&lt;li&gt;A bonus offer that accidentally locks out everyone who ever deleted an account.&lt;/li&gt;
&lt;li&gt;A CSS rule that silently shifts the entire app by 16 pixels.&lt;/li&gt;
&lt;li&gt;Six languages that have to be maintained with every new line of text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these is big on its own. But there are hundreds of them, and each one wants to be found, understood and cleanly solved.&lt;/p&gt;

&lt;p&gt;The lesson that stuck: &lt;strong&gt;passing tests don't prove it works in the real app.&lt;/strong&gt; Some bugs only show up when you operate it yourself in the browser. So a lot gets tested by hand — especially anything involving real money or other people's data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hard part #3: building AI into a product
&lt;/h2&gt;

&lt;p&gt;Daisy is the AI assistant in LaizyNote. You write to her in plain language and she can act: create tasks, structure projects, link contacts, summarize time and numbers. "Create a project &lt;em&gt;Website&lt;/em&gt; with three tasks for Emma" becomes exactly those entries.&lt;/p&gt;

&lt;p&gt;The crucial part: &lt;strong&gt;she asks before every write action.&lt;/strong&gt; She shows a preview — "5 tasks will be created" — and only a confirm click executes it. AI that writes into your data on its own, without you watching, would be a breach of trust.&lt;/p&gt;

&lt;p&gt;Building AI into a real product brings a challenge classic development doesn't have: &lt;strong&gt;it's not predictable.&lt;/strong&gt; The same question can be answered slightly differently twice. The model doesn't always stick to the required format. Answers sometimes run too long mid-sentence. None of this is checkable with "is the code correct" — it has to be tried by hand, over and over. Two constraints mattered most: privacy (Daisy runs through a European AI provider, EU-hosted — fitting for a &lt;code&gt;.eu&lt;/code&gt; product) and cost control (usage quotas and a fixed monthly cap per user, so neither the user nor I get a nasty surprise).&lt;/p&gt;

&lt;h2&gt;
  
  
  The part I underestimated
&lt;/h2&gt;

&lt;p&gt;The biggest surprise wasn't the technology. It was how much is needed &lt;em&gt;around&lt;/em&gt; the product before you can bill a single customer.&lt;/p&gt;

&lt;p&gt;A SaaS isn't just an app. It's a brand with a name, logo and voice. Legal texts, terms, a privacy policy, a service description that holds up contractually. Payment processing with subscriptions, cancellations, yearly and monthly prices, vouchers and invoices. Automated emails, backups, and processes for when someone deletes their account. Users never see most of it — but without that foundation there's no product you can trust.&lt;/p&gt;

&lt;p&gt;I thought building the product was the work. In truth the product is one half; the other is brand, law, payment and operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Would I do it again?
&lt;/h2&gt;

&lt;p&gt;Yes — much of it exactly the same. Firebase was the right call to get started: it took scaling and auth off my plate so I could focus on the product. As the feature set grew, a relational database with access rules directly on the tables became the better foundation, which is why LaizyNote runs on Supabase today. What I'd change is the planning — I'd cut some data structures differently from the start (things you only understand once you've built them wrong), and I'd budget for all the surrounding work earlier instead of treating it as "I'll do that at the end".&lt;/p&gt;

&lt;p&gt;The result is live and publicly available, with all modules in use. Anyone can start for free — which was the whole point from the beginning.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Takeaways if you're building your own SaaS:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Prototyping is fast; the polish is the real work — plan for it.&lt;/li&gt;
&lt;li&gt;With other people's data, the database decides, never the browser.&lt;/li&gt;
&lt;li&gt;AI is unpredictable — it needs manual testing and clear, honest limits.&lt;/li&gt;
&lt;li&gt;A SaaS is half product, half brand/law/operations.&lt;/li&gt;
&lt;li&gt;Green tests are no proof. When in doubt, use it yourself.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Full write-up (and the product) on &lt;a href="https://hafenpixel.de/en/behind-the-scenes/building-my-own-saas-laizynote" rel="noopener noreferrer"&gt;hafenpixel.de&lt;/a&gt;. You can &lt;a href="https://laizynote.eu" rel="noopener noreferrer"&gt;try LaizyNote for free&lt;/a&gt; — no credit card. Happy to answer questions in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>saas</category>
      <category>webdev</category>
      <category>vue</category>
      <category>ai</category>
    </item>
    <item>
      <title>I Fixed a Broken onOffice WordPress Integration – Here's What 3 Agencies Missed</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Tue, 02 Jun 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/i-fixed-a-broken-onoffice-wordpress-integration-heres-what-3-agencies-missed-2k77</link>
      <guid>https://dev.to/joshmsn/i-fixed-a-broken-onoffice-wordpress-integration-heres-what-3-agencies-missed-2k77</guid>
      <description>&lt;p&gt;&lt;strong&gt;HR Hanse Holding&lt;/strong&gt; manages properties in Hamburg and runs their portfolio on &lt;a href="https://www.onoffice.com/" rel="noopener noreferrer"&gt;onOffice enterprise&lt;/a&gt; – the market-leading real estate CRM in Germany (30,000+ users, 6,000+ companies). The properties needed to appear on their WordPress website. Custom design, filters, working detail pages.&lt;/p&gt;

&lt;p&gt;Three agencies had tried before me. None succeeded. Zero properties on the website. Detail pages returning 404. Default plugin layout that didn't match the brand.&lt;/p&gt;

&lt;p&gt;The typical diagnosis: "The plugin doesn't work."&lt;/p&gt;

&lt;p&gt;In reality, the plugin works fine. The configuration around it was broken.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Starting Point: Zero Listings
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://wp-plugin.onoffice.com/" rel="noopener noreferrer"&gt;onOffice plugin for WordPress&lt;/a&gt; was installed, the API key entered – but not a single property showed up. Clicking a detail page link returned a 404. The standard layout didn't match the corporate design anyway.&lt;/p&gt;

&lt;p&gt;Two root causes. Both classic. Both missed by the previous agencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem 1: API Permissions (The Silent Killer)
&lt;/h2&gt;

&lt;p&gt;The API user in onOffice had "Read properties" set to &lt;strong&gt;"own only"&lt;/strong&gt; instead of &lt;strong&gt;"all"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Small toggle, massive impact: the API only returns properties &lt;em&gt;personally assigned&lt;/em&gt; to the API user. A technical API account typically has zero properties assigned – so the API returns an empty list.&lt;/p&gt;

&lt;p&gt;Here's the nasty part: &lt;strong&gt;the API doesn't return an error.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;API&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;with&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;wrong&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;permissions&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"own only"&lt;/span&gt;&lt;span class="err"&gt;):&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"records"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;--&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;NOT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;an&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;error&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"countabsolute"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;API&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;with&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;correct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;permissions&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"all"&lt;/span&gt;&lt;span class="err"&gt;):&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"records"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;--&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;properties&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"countabsolute"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Status 200, empty list. If you don't know where the toggle is in the onOffice admin panel, you'll search for the bug in the plugin code forever.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; onOffice admin → API settings → API user → Set "Read properties" to "all".&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem 2: Permalink Structure Breaks Routing
&lt;/h2&gt;

&lt;p&gt;The onOffice plugin registers custom rewrite rules for detail pages. These rules &lt;strong&gt;only work&lt;/strong&gt; when WordPress permalinks are set to &lt;strong&gt;"Post name"&lt;/strong&gt; (&lt;code&gt;/%postname%/&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;With any other setting – "Plain", "Day and name", "Numeric" – the plugin's routing logic simply doesn't kick in. Detail page links lead to 404.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Quick diagnostic:&lt;/strong&gt; If the list view shows properties but clicking on individual listings returns a 404 → go to Settings → Permalinks → select "Post name" → click "Save Changes" once (even if nothing appears to change). WordPress regenerates the rewrite rules, and the detail pages start working.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once both problems were fixed: 22 properties in the list view, detail pages reachable. But the default design was still generic – and that's where the real work started.&lt;/p&gt;




&lt;h2&gt;
  
  
  Custom Templates in &lt;code&gt;templates.dist/&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Here's something most WordPress developers don't know: the onOffice plugin loads its templates from a &lt;code&gt;templates.dist/&lt;/code&gt; directory &lt;strong&gt;inside the plugin folder&lt;/strong&gt;. You place your custom template files there alongside the defaults and select them in the plugin settings.&lt;/p&gt;

&lt;p&gt;The catch: during a plugin update, &lt;strong&gt;the entire plugin folder gets replaced&lt;/strong&gt; – including &lt;code&gt;templates.dist/&lt;/code&gt;. Your custom templates are gone.&lt;/p&gt;

&lt;p&gt;That's exactly what happened with the previous agencies. They either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lost their templates on every update, or&lt;/li&gt;
&lt;li&gt;Worked with CSS overrides that broke whenever the plugin's HTML structure changed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The clean approach: build custom templates &lt;strong&gt;and&lt;/strong&gt; secure them with a recovery mechanism.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project Structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wp-content/plugins/
├── onoffice-for-wp-websites/          ← main plugin (don't touch)
│   └── templates.dist/
│       ├── estate/
│       │   ├── default_list.php
│       │   ├── default_detail.php
│       │   ├── cardgrid.php            ← custom list view
│       │   └── custom_detail.php       ← custom detail page
│       └── onoffice-style.css          ← custom stylesheet
│
└── onoffice-template-guard/            ← recovery plugin
    ├── onoffice-template-guard.php
    └── backup/                         ← protected backup copies
        └── templates.dist/
            └── ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What the Custom Templates Do
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;List view (&lt;code&gt;cardgrid.php&lt;/code&gt;):&lt;/strong&gt; 3-column card grid (responsive → 2 → 1 column) with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Main image with hover zoom&lt;/li&gt;
&lt;li&gt;Marketing type badge (e.g. "BUY" / "RENT")&lt;/li&gt;
&lt;li&gt;Property title, meta line, fact boxes (rooms, area)&lt;/li&gt;
&lt;li&gt;Price display and detail link&lt;/li&gt;
&lt;li&gt;Location filter via &lt;a href="https://tom-select.js.org/" rel="noopener noreferrer"&gt;TomSelect&lt;/a&gt; multiselect&lt;/li&gt;
&lt;li&gt;Pagination via &lt;code&gt;paginate_links()&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhafenpixel.de%2Fassets%2Fimages%2Fhh_listenansicht.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhafenpixel.de%2Fassets%2Fimages%2Fhh_listenansicht.webp" alt="Custom list view with card grid and location filter" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;3-column card grid with location filter and pagination on verwaltung-hh.com&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Detail page (&lt;code&gt;custom_detail.php&lt;/code&gt;):&lt;/strong&gt; Full exposé presentation with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image gallery with lightbox (arrow navigation, keyboard support, image counter)&lt;/li&gt;
&lt;li&gt;Dynamic highlight badges via &lt;code&gt;getFieldLabel()&lt;/code&gt; (balcony, elevator, parking, etc.)&lt;/li&gt;
&lt;li&gt;Key data from onOffice field configuration&lt;/li&gt;
&lt;li&gt;Property description with clean typography&lt;/li&gt;
&lt;li&gt;OpenStreetMap via Leaflet.js (more on GDPR below)&lt;/li&gt;
&lt;li&gt;Sticky contact person sidebar (avatar, phone, email)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhafenpixel.de%2Fassets%2Fimages%2Fhh_detailansicht.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhafenpixel.de%2Fassets%2Fimages%2Fhh_detailansicht.webp" alt="Custom detail page with gallery and key data" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Detail page: image gallery, key data, OpenStreetMap map, contact person box&lt;/em&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  The Template Guard: Surviving Plugin Updates
&lt;/h2&gt;

&lt;p&gt;Custom templates in &lt;code&gt;templates.dist/&lt;/code&gt; work great – until the next plugin update wipes them. The solution: a custom WordPress plugin that automatically restores them.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;onOffice Template Guard&lt;/strong&gt; hooks into &lt;code&gt;upgrader_process_complete&lt;/code&gt; – it only fires when WordPress performs a plugin update. After every onOffice update, it checks whether the custom files are still present and restores them from a protected backup if needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Simplified recovery logic (onOffice Template Guard)&lt;/span&gt;
&lt;span class="nf"&gt;add_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'upgrader_process_complete'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$upgrader&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$options&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$options&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'type'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'plugin'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nv"&gt;$templates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'templates.dist/estate/cardgrid.php'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'templates.dist/estate/custom_detail.php'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'templates.dist/onoffice-style.css'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="nv"&gt;$plugin_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;WP_PLUGIN_DIR&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/onoffice-for-wp-websites/'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$backup_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;WP_PLUGIN_DIR&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/onoffice-template-guard/backup/'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$templates&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$tpl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;file_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$plugin_dir&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$tpl&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Template missing → restore from backup&lt;/span&gt;
            &lt;span class="nf"&gt;wp_mkdir_p&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;dirname&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$plugin_dir&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$tpl&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
            &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nb"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$backup_dir&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$tpl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$plugin_dir&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$tpl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the WordPress admin there's a status page under &lt;strong&gt;Tools → onOffice Template Guard&lt;/strong&gt;: which templates are present, whether the backup is intact, and a manual restore button.&lt;/p&gt;

&lt;p&gt;The plugin doesn't run on every page load – only after updates. Zero performance overhead.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;On maintainability:&lt;/strong&gt; The Template Guard isn't a technical highlight – and that's the point. A team maintaining this site two years from now will understand what it does in thirty seconds. The admin page shows green or red. The hook only fires after updates. The backup lives in a fixed location. Sometimes the best solution is the most boring one.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  GDPR: OpenStreetMap Instead of Google Maps
&lt;/h2&gt;

&lt;p&gt;Property pages without a map are like exposés without an address. Google Maps is the default, but has GDPR implications in the EU: on load, IP addresses and browser data are sent to Google. This requires cookie consent, and many users decline – so the map is hidden behind a "Load external content" overlay.&lt;/p&gt;

&lt;p&gt;The alternative: &lt;strong&gt;&lt;a href="https://leafletjs.com/" rel="noopener noreferrer"&gt;Leaflet.js&lt;/a&gt; with OpenStreetMap tiles.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;42 KB gzipped&lt;/li&gt;
&lt;li&gt;Open source&lt;/li&gt;
&lt;li&gt;OpenStreetMap servers don't process personal data under GDPR&lt;/li&gt;
&lt;li&gt;Map is immediately visible – no consent banner, no overlay&lt;/li&gt;
&lt;li&gt;Coordinates come directly from the onOffice dataset (no extra geocoding needed)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For users who need navigation, there's an "Open in Google Maps" button that passes coordinates as an external link – without embedding Google Maps on the page itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;After the integration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;22 properties&lt;/strong&gt; live, fully synchronised from onOffice&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;List view:&lt;/strong&gt; 3-column card grid with location filter and pagination&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detail pages:&lt;/strong&gt; Gallery, key data, OpenStreetMap map, contact person&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update-safe:&lt;/strong&gt; Template Guard auto-restores after plugin updates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GDPR-compliant:&lt;/strong&gt; No Google Maps, no external trackers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Responsive:&lt;/strong&gt; Mobile-optimised across all breakpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Live result: &lt;a href="https://verwaltung-hh.com" rel="noopener noreferrer"&gt;verwaltung-hh.com&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;p&gt;If you're working on an onOffice WordPress integration:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;When "the plugin doesn't work" → check API configuration first.&lt;/strong&gt; The permission toggle between "own only" and "all" is the #1 cause of empty listings. The API returns 200 with an empty array – no error message to guide you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Permalink structure is a prerequisite, not a detail.&lt;/strong&gt; "Post name" (&lt;code&gt;/%postname%/&lt;/code&gt;) is required for the plugin's routing to work. Everything else → 404 on detail pages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Custom templates go in &lt;code&gt;templates.dist/&lt;/code&gt;&lt;/strong&gt; – this is the intended way to build custom designs. Yet most developers don't know about it and resort to fragile CSS overrides.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Protect your templates with &lt;code&gt;upgrader_process_complete&lt;/code&gt;.&lt;/strong&gt; It sounds like overkill until the next update wipes your work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OpenStreetMap + Leaflet.js is a drop-in Google Maps replacement&lt;/strong&gt; that eliminates GDPR complexity entirely.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>wordpress</category>
      <category>php</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Self-Revoking Guest Tokens: A WordPress Pattern Without Cron</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Tue, 05 May 2026 11:07:00 +0000</pubDate>
      <link>https://dev.to/joshmsn/self-revoking-guest-tokens-a-wordpress-pattern-without-cron-l1h</link>
      <guid>https://dev.to/joshmsn/self-revoking-guest-tokens-a-wordpress-pattern-without-cron-l1h</guid>
      <description>&lt;p&gt;An ecological consultancy hired me to digitise their reporting workflow. Field surveys, FFH pre-checks, monitoring protocols — nine different report templates, each with mandatory fields, a corporate letterhead, and case numbers that can't collide.&lt;/p&gt;

&lt;p&gt;The interesting requirement: &lt;strong&gt;field staff have to fill in the reports on site&lt;/strong&gt;, but most of them don't have WordPress accounts. Seasonal hires, freelancers, interns. Creating a user, assigning capabilities, deactivating later — too much friction.&lt;/p&gt;

&lt;p&gt;So they need guest access. Per report. With the right scope. With a clean expiry.&lt;/p&gt;

&lt;p&gt;Here's how I built it without a cron job.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape of the problem
&lt;/h2&gt;

&lt;p&gt;Each report instance lives in a custom table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;fm_form_instances&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt;            &lt;span class="nb"&gt;BIGINT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;project_id&lt;/span&gt;    &lt;span class="nb"&gt;BIGINT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;template_id&lt;/span&gt;   &lt;span class="nb"&gt;BIGINT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt;        &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;  &lt;span class="c1"&gt;-- 'entwurf' | 'abgeschlossen'&lt;/span&gt;
    &lt;span class="n"&gt;data_json&lt;/span&gt;     &lt;span class="nb"&gt;LONGTEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The state machine is intentionally tiny: a report is either &lt;strong&gt;draft&lt;/strong&gt; (&lt;code&gt;entwurf&lt;/code&gt;) or &lt;strong&gt;completed&lt;/strong&gt; (&lt;code&gt;abgeschlossen&lt;/code&gt;). Once completed, it can't be edited. The PDF is generated, the cloud backup runs, done.&lt;/p&gt;

&lt;p&gt;Guest access only makes sense for drafts. Once the report is submitted, the link should die. The question is &lt;em&gt;how&lt;/em&gt; it dies.&lt;/p&gt;

&lt;h2&gt;
  
  
  The naive options
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Option A: cron job.&lt;/strong&gt; Run hourly, find expired tokens, delete them. Predictable, but it requires WordPress cron to actually fire (unreliable on low-traffic sites) and adds a moving part.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option B: TTL on the token.&lt;/strong&gt; Store an &lt;code&gt;expires_at&lt;/code&gt; timestamp, check it on every request. Simple, but you have to pick a duration. Too short and field staff get logged out mid-report. Too long and abandoned tokens linger.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option C: tie the token's lifecycle to the report's lifecycle.&lt;/strong&gt; No timer. No cron. The token dies the moment its purpose is fulfilled.&lt;/p&gt;

&lt;p&gt;I went with C.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FM_Guest_Access&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;create_for_instance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$created_by&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="nv"&gt;$instance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get_row&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s2"&gt;"SELECT id, status FROM &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;instances_table&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; WHERE id = %d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nv"&gt;$instance_id&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="no"&gt;ARRAY_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Only drafts can receive a guest link.&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;$instance&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;$instance&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'status'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'entwurf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="nv"&gt;$token&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;wp_generate_password&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nv"&gt;$password_hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;wp_hash_password&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$password&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Exactly one active access per instance.&lt;/span&gt;
        &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'instance_id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'%d'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'instance_id'&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'access_token'&lt;/span&gt;  &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'password_hash'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$password_hash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'status'&lt;/span&gt;        &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'created_by'&lt;/span&gt;    &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;$created_by&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;]);&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'instance_id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'access_token'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$token&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;revoke_for_instance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'instance_id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'%d'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two-line &lt;code&gt;revoke_for_instance&lt;/code&gt; gets called from exactly one place — the form-completion handler:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FM_Form_Instance&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// ... validate, render PDF, upload to cloud ...&lt;/span&gt;

        &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'abgeschlossen'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Self-revoke: the guest link dies with the draft.&lt;/span&gt;
        &lt;span class="n"&gt;FM_Guest_Access&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;revoke_for_instance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$instance_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the whole pattern. The status transition &lt;code&gt;entwurf → abgeschlossen&lt;/code&gt; is the trigger. No cron, no TTL counter, no hunt for expired records.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this buys you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;No background processes.&lt;/strong&gt; The plugin works on hosting where WP-Cron is unreliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No "stale token" class of bug.&lt;/strong&gt; A token can't outlive the report it was issued for, because completing the report destroys the token in the same transaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cleaner mental model.&lt;/strong&gt; When I look at the table six months later, every active record corresponds to a report that's still being worked on. There's no archive of dead tokens to forget about.&lt;/p&gt;

&lt;h2&gt;
  
  
  The auth flow itself
&lt;/h2&gt;

&lt;p&gt;For completeness, here's how the guest actually logs in. The URL has the token as a query parameter, the password is entered manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com/?fm_project_slug=abc&amp;amp;fm_guest_token=&amp;lt;40 char string&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;authenticate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$password&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// JOIN to also check the parent draft is still active.&lt;/span&gt;
    &lt;span class="nv"&gt;$row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get_row&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$wpdb&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"SELECT g.*, i.status AS instance_status
         FROM &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; g
         JOIN &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;instances_table&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; i ON i.id = g.instance_id
         WHERE g.access_token = %s
           AND g.status = 'active'
           AND i.status = 'entwurf'
         LIMIT 1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nv"&gt;$token&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="no"&gt;ARRAY_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;wp_check_password&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'password_hash'&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$row&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The JOIN is the safety net. Even if revocation somehow failed (DB error, bug, manual edit), the parent's status check still gates access.&lt;/p&gt;

&lt;h2&gt;
  
  
  When this pattern fits
&lt;/h2&gt;

&lt;p&gt;This works when access is &lt;strong&gt;scoped to a single bounded resource&lt;/strong&gt; with a clear lifecycle event. Reports, support tickets, draft invoices, signature requests — anything that goes through a discrete completion step.&lt;/p&gt;

&lt;p&gt;It doesn't fit when access is open-ended (a guest seat on a team workspace, for example) or when the access object outlives its triggering event. For those, you're back to TTL or revocation lists.&lt;/p&gt;

&lt;p&gt;But for the common case — "let someone do one thing, then forget them" — coupling token death to domain event is dramatically cleaner than running a janitor.&lt;/p&gt;

&lt;p&gt;You can read the full case study (German) here: &lt;a href="https://hafenpixel.de/hinter-den-kulissen/artenschutz-projektmanager-wordpress" rel="noopener noreferrer"&gt;hafenpixel.de/hinter-den-kulissen/artenschutz-projektmanager-wordpress&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;English: &lt;a href="https://hafenpixel.de/en/behind-the-scenes/species-protection-project-manager-wordpress" rel="noopener noreferrer"&gt;hafenpixel.de/en/behind-the-scenes/species-protection-project-manager-wordpress&lt;/a&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>php</category>
      <category>security</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Why I Wrote a Pixel-by-Pixel Multiply Blend in PHP-GD to Beat Dompdf</title>
      <dc:creator>Joshua</dc:creator>
      <pubDate>Tue, 28 Apr 2026 05:05:45 +0000</pubDate>
      <link>https://dev.to/joshmsn/why-i-wrote-a-pixel-by-pixel-multiply-blend-in-php-gd-to-beat-dompdf-232j</link>
      <guid>https://dev.to/joshmsn/why-i-wrote-a-pixel-by-pixel-multiply-blend-in-php-gd-to-beat-dompdf-232j</guid>
      <description>&lt;p&gt;A real estate broker came to me with a familiar problem. Every property exposé — the glossy multi-page PDF that goes to potential buyers — was being assembled by hand in an Adobe layout tool. Address typed in. Prices typed in. Photos imported one by one. Floor plans appended. Logo placed. Disclaimer pasted. PDF exported. Filed somewhere. Sent.&lt;/p&gt;

&lt;p&gt;That's 45 minutes per listing. And the moment a price changes, you're starting over.&lt;/p&gt;

&lt;p&gt;The agency was already on WordPress. JetEngine was already managing properties as custom post types. So the path was clear: generate the exposé directly from the data — one click, one PDF, pixel-perfect corporate design.&lt;/p&gt;

&lt;p&gt;The first 80% of that plugin was straightforward. PHP, Dompdf, an HTML template, FPDI to merge in the floor plan PDFs. Done in a week.&lt;/p&gt;

&lt;p&gt;The last 20% almost killed me.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Dompdf opacity problem
&lt;/h2&gt;

&lt;p&gt;The cover page of an exposé is one of those classic real-estate looks: a hero photo of the property, with a dark gradient overlay so the headline is legible.&lt;/p&gt;

&lt;p&gt;In CSS, that's three lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.cover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url(...)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="py"&gt;background-blend-mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.overlay&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(...);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;strong&gt;Dompdf&lt;/strong&gt;, both &lt;code&gt;background-blend-mode&lt;/code&gt; and &lt;code&gt;opacity&lt;/code&gt; are unreliable. They render inconsistently between Dompdf versions, between fonts, between paper sizes. I spent three hours coaxing different combinations before accepting that this isn't going to work.&lt;/p&gt;

&lt;p&gt;The obvious move would be to swap libraries. mPDF? wkhtmltopdf? Browserless?&lt;/p&gt;

&lt;p&gt;But all of those add operational weight: wkhtmltopdf is a binary that needs to be installed and updated on the host. Browserless is an external service. mPDF would mean rewriting the templating layer.&lt;/p&gt;

&lt;p&gt;The agency wanted something they could deploy on standard WordPress hosting. No binaries. No external services. No black boxes.&lt;/p&gt;

&lt;p&gt;So I went the other way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-compute the blend in PHP-GD
&lt;/h2&gt;

&lt;p&gt;If Dompdf can't blend at render time, the blend has to happen &lt;em&gt;before&lt;/em&gt; Dompdf sees the image. Which means doing it in PHP, with GD, pixel by pixel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Multiply-blend two images of the same size&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;multiply_blend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$overlay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$width&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;imagesx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;imagesy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$y&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nv"&gt;$height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$y&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nv"&gt;$width&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;imagecolorat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nv"&gt;$o&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;imagecolorat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$overlay&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

            &lt;span class="c1"&gt;// Multiply formula per channel: (a × b) / 255&lt;/span&gt;
            &lt;span class="nv"&gt;$r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;$b&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0xFF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$o&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0xFF&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nv"&gt;$g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;$b&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;  &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0xFF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$o&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;  &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0xFF&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nv"&gt;$bl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;$b&lt;/span&gt;      &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0xFF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$o&lt;/span&gt;      &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0xFF&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="nv"&gt;$color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;imagecolorallocate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$bl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nb"&gt;imagesetpixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's brute-force math, twice the resolution times two channels per pixel. On a 1600×900 cover image, that's roughly 1.4 million iterations per blend. Slow.&lt;/p&gt;

&lt;p&gt;Then you encode the result as JPEG with high quality and embed it as a base64 data-URI directly in the HTML that goes into Dompdf:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nb"&gt;ob_start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nb"&gt;imagejpeg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$blended&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;92&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$encoded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;base64_encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;ob_get_clean&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nv"&gt;$dataUri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"data:image/jpeg;base64,&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$encoded&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dompdf doesn't know it's looking at a blended image. It just sees &lt;code&gt;&amp;lt;img src="data:image/jpeg;..."&amp;gt;&lt;/code&gt; and embeds the bytes. Pixel-perfect output.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cache makes it fast
&lt;/h2&gt;

&lt;p&gt;Brute-force blending is fine &lt;em&gt;if you don't do it often&lt;/em&gt;. The plugin generates each PDF once, then caches it in &lt;code&gt;wp-content/uploads/&lt;/code&gt;. It only re-renders when the underlying data changes — and it knows that via a hash:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;inex_get_or_generate_pdf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$cached_version&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_post_meta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'_inex_pdf_cache_version'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$current_version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;inex_get_cache_version&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$filepath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;hash_equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$cached_version&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$current_version&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$fileurl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Serve from cache, sub-second&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;inex_acquire_pdf_generation_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;WP_Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'locked'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'PDF being generated, please retry'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;inex_collect_expose_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nf"&gt;inex_render_expose_pdf_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$filepath&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'.tmp'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nb"&gt;rename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$filepath&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'.tmp'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$filepath&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// atomic&lt;/span&gt;
        &lt;span class="nf"&gt;update_post_meta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'_inex_pdf_cache_version'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$current_version&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;inex_release_pdf_generation_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$post_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three things worth flagging in this snippet:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;hash_equals&lt;/code&gt;&lt;/strong&gt; for the cache check — not strictly security-critical here, but it sets the right habit. Same function that protects token comparison.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;rename&lt;/code&gt; on a &lt;code&gt;.tmp&lt;/code&gt; file&lt;/strong&gt; is atomic on POSIX filesystems. A concurrent reader never sees a half-written PDF.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;try/finally&lt;/code&gt;&lt;/strong&gt; for the lock release. If rendering throws, the lock still clears. No "stuck PDFs" after a failed deploy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The cache version is computed by hashing every relevant meta field plus the modification times of the gallery images. Change the price → hash changes → next download regenerates. Nobody pushes a "refresh" button. Nobody runs a cron job.&lt;/p&gt;

&lt;h2&gt;
  
  
  When does this approach make sense?
&lt;/h2&gt;

&lt;p&gt;A custom PHP-GD blend plus Dompdf isn't elegant. It's a workaround stacked on a workaround. Six hundred lines of plugin code do the work that one CSS rule would have done if Dompdf supported it.&lt;/p&gt;

&lt;p&gt;But it ships in a single PHP plugin. No binaries. No external dependencies. No vendor lock-in. Standard WordPress hosting handles it. Cold render: 5–15 seconds. Cached read: under one second.&lt;/p&gt;

&lt;p&gt;The lesson, for me, was that "swap the library" isn't always the right reflex. Sometimes the cheapest path forward is a &lt;strong&gt;precomputation stage in your own stack&lt;/strong&gt; that hides the limitation from the layer that has it.&lt;/p&gt;

&lt;p&gt;You can read the full case study (German) here: &lt;a href="https://hafenpixel.de/hinter-den-kulissen/expose-generator-jetengine-wordpress" rel="noopener noreferrer"&gt;hafenpixel.de/hinter-den-kulissen/expose-generator-jetengine-wordpress&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or the English version: &lt;a href="https://hafenpixel.de/en/behind-the-scenes/expose-generator-jetengine-wordpress" rel="noopener noreferrer"&gt;hafenpixel.de/en/behind-the-scenes/expose-generator-jetengine-wordpress&lt;/a&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>php</category>
      <category>webdev</category>
      <category>pdf</category>
    </item>
  </channel>
</rss>
