Blog category

Architecture & Engineering

Engineering explainers and deep dives on building systems that hold up in production: API design, databases, authentication, multi-tenancy and performance.

71 articles

11 min read· October 2026

Building a chargeback and dispute management workflow

A chargeback is a deadline with money attached. How to build a dispute management workflow that ingests the dispute, assembles evidence before the deadline, tracks the lifecycle as a state machine, and keeps your ledger correct whichever way it resolves.

Read article
11 min read· October 2026

Scaling Live Classes and Video for Thousands of Students

Live classes for thousands of students do not scale as peer-to-peer video. Separate interactive seminars from one-to-many broadcasts, route media through a selective forwarding server rather than a mesh, lean on a specialist media vendor for the hard transport, and handle recordings and chat as their own scaling problems.

Read article
12 min read· October 2026

One Platform, Many Schools: Tenant Isolation for EdTech Done Right

When one EdTech platform serves many schools, each school’s students, grades and payments must never leak into another’s. Enforce isolation in the database with a tenant column and PostgreSQL row-level security, not in application code alone, scope every query to the school, and test the boundary on every build. A cross-school data leak of student grades ends trust instantly.

Read article
12 min read· October 2026

Your First Enterprise Customer Wants SSO, Audit and an SLA: What to Build

A big prospect just asked for SSO, an audit log, an uptime SLA and a security review before they sign. What each request really means, which to build now and which to defer, what to buy instead of build, and how to answer a security questionnaire honestly when you have no SOC 2. A triage table, so you do not stall the deal building things it never needed.

Read article
13 min read· October 2026

Migrating a SaaS Off Firebase to Postgres Without Downtime

How to move a live SaaS from Firebase to PostgreSQL without taking customers offline: decide whether you should, model the document data as relational tables, then run a dual-write migration, backfill, verify, cut over reads, and retire Firebase last. A phase plan, the schema-mapping decisions that bite, and SQL. Firestore collections do not map one-to-one to tables, and that is where migrations go wrong.

Read article
11 min read· October 2026

Building a SaaS Onboarding Flow That Activates Users

A SaaS onboarding flow is the guided path from sign-up to the first time a user gets real value. Build it around one measurable activation event, store each step server-side so it survives a refresh, make every step resumable and idempotent, seed sample data, and measure drop-off per step. Here is the data model and the checks that make it reliable.

Read article
10 min read· October 2026

Building a SaaS Notification System: In-App and Email

A SaaS notification system turns events into messages a user sees, across in-app and email, from one source of truth. Model events once, fan out to channels a user has opted into, store in-app notifications so a read state survives devices, batch noisy events into digests, and deliver through a queue that is safe to retry. Here is the data model and the dispatch logic.

Read article
10 min read· October 2026

Team Workspaces and Invitations for a B2B SaaS

Team workspaces let several users share one account with their own roles; invitations are how they get in. Build a membership table that joins users to workspaces with a role, issue single-use signed invite tokens that expire, check seat limits inside the join transaction, and handle the cases most teams miss: the invited email already has an account, or the last owner tries to leave. Here is the model.

Read article
10 min read· October 2026

Building a Roles and Permissions UI for Your SaaS

A roles and permissions UI lets a customer admin decide who can do what. Build it on permissions as the atomic unit, roles as named bundles of permissions, a matrix an admin can read, and a server-side check the UI only mirrors. The screen is the easy part; the trap is a UI that shows access the backend does not actually enforce. Here is the model and the check.

Read article
10 min read· October 2026

CSV Import, Export and Bulk Actions in a SaaS

CSV import, export and bulk actions move data in and out of your SaaS in large batches. Validate the whole file before writing anything, make the import idempotent so a re-run does not duplicate rows, report errors per row with line numbers, and run anything large as a background job. The hard part is not parsing CSV; it is being correct when half the file is wrong. Here is the pattern.

Read article
10 min read· October 2026

Plan-Based Rate Limiting and Quotas in a SaaS

Rate limits cap requests per short window; quotas cap usage per billing period. Both should vary by plan and be enforced per tenant, counted atomically so two requests cannot both take the last unit, and surfaced with clear 429 responses and reset headers. The difference between the two, and where each is enforced, is what most teams get wrong. Here is the model and the counter.

Read article
10 min read· October 2026

Building an Activity Feed Users Trust

An activity feed is the human-readable timeline of what happened in an account: who did what, when. Build it on one append-only event stream written in the same transaction as the change, render it per audience with the viewer's permissions applied, group noisy events, and page it by cursor. It overlaps with the audit log but is not the same thing. Here is the model and where the two differ.

Read article
10 min read· October 2026

Adding Comments and @Mentions to Your SaaS

Comments let users discuss a record in place; @mentions pull a specific person in. Build a comment model that attaches to any resource, parse mentions on the server from stable user IDs rather than trusting the text, check that the mentioned person may actually see the record, and fire a notification only to people who should get one. The spoofing and permission traps are where this goes wrong. Here is the model.

Read article
11 min read· October 2026

A Scheduler and Recurring Jobs for Your SaaS

A scheduler runs work on a clock: nightly digests, billing retries, reminders, cleanups. Build it on jobs stored in your database, claimed atomically so two workers never run the same job, made idempotent so a retry or double-fire is harmless, retried with backoff on failure, and able to catch up a run the server missed. A loose cron that fires an unguarded endpoint is where the incidents come from. Here is the pattern.

Read article
10 min read· October 2026

Full-Text Search in a SaaS: Postgres vs a Search Engine

Full-text search lets users find records by words, not exact matches. For most SaaS, PostgreSQL full-text search with a tsvector column and a GIN index is enough and keeps one fewer system to run. Reach for a dedicated search engine when you need typo tolerance, instant-search speed at scale or complex ranking. Whichever you pick, every query must stay scoped to the tenant. Here is the decision and the SQL.

Read article
11 min read· October 2026

Building File Storage and Sharing in a SaaS: Safe Uploads, Done Right

File storage in a SaaS is more than an upload button: it is presigned uploads that never route bytes through your server, per-tenant object keys, type and size limits enforced server-side, a scan before a file is usable, and short-lived signed links for sharing. Here is the design, with TypeScript.

Read article
11 min read· October 2026

Generating PDF Reports and Invoices in a SaaS Without Breaking Production

PDF generation looks trivial until it blocks a request, runs out of memory, or produces two invoices with the same number. The real decisions are HTML-to-PDF versus a drawing library, running generation off the request, storing the result, and making invoice numbers deterministic. Here is the design, with TypeScript.

Read article
11 min read· October 2026

Building the SaaS Dashboard: Metrics, Charts and Date Ranges That Stay Fast

A SaaS dashboard is a reporting problem, not a chart problem. The work is pre-aggregating metrics so a page load is not a full-table scan, bucketing by the user's time zone, scoping every query to one tenant, and caching the result. The chart library is the last decision. Here is the design, with SQL.

Read article
10 min read· October 2026

Multi-Currency Support in a SaaS: Store Money in Minor Units

Multi-currency breaks SaaS products that store money as floats or assume two decimal places. The rules are simple and strict: integer minor units, the currency code beside every amount, the right number of decimals per currency, and a recorded exchange rate for any conversion. Here is the design, with TypeScript and SQL.

Read article
10 min read· October 2026

Internationalising a SaaS: i18n, RTL and Locale Data Without a Rewrite

Internationalisation is an architecture decision, not a translation task. Get the structure right early: no hard-coded strings, plural and interpolation rules that survive translation, locale-aware dates and numbers, and a layout that mirrors cleanly for right-to-left languages. Here is the design, with TypeScript.

Read article
11 min read· October 2026

Safe User Impersonation for SaaS Support Teams: Consent, Scope and Audit

Support staff logging in as a customer is useful and dangerous. Done safely it keeps the staff identity separate from the customer, limits what impersonation can do, times out, shows a banner, and records every action in the audit log under the real person who took it. Here is the design, with TypeScript and SQL.

Read article
11 min read· October 2026

Data Retention and Deletion in a SaaS: Export, Purge and Legal Hold

Deleting a row is easy; deleting a user across a real system is not. You need retention periods per data type, a soft-delete then hard-delete flow, scheduled purge jobs, a data export for the user, and a legal hold that overrides deletion. Backups and logs are where it goes wrong. Here is the design, with SQL.

Read article
11 min read· October 2026

Building an Internal Admin Tool: Custom Build vs Retool, and How to Choose

Every product grows an internal admin tool for support, operations and finance to do their jobs. The question is build or use a low-code platform like Retool. It turns on who uses it, how sensitive the actions are, and where your data lives. Here is the decision, and how to build one safely if you do. With SQL.

Read article
9 min read· October 2026

Technical SEO Checklist for 2026: The Foundation That Lets You Rank

A practical technical SEO checklist for 2026: the crawlability, indexing, speed, structured data and sitemap work that lets content rank at all, with exact Core Web Vitals thresholds and a JSON-LD example you can copy.

Read article
9 min read· October 2026

Local and Geo SEO for Service Businesses: Rank Where Your Customers Are

A practical guide to local and geo SEO for service businesses: how search decides who ranks for a place, the location pages and LocalBusiness markup that help, why consistent details matter, and how to scale across cities and countries organically.

Read article
16 min read· October 2026

SaaS Entitlements: Enforcing Plans, Limits and Add-ons in Code

SaaS entitlements are the rules that say what each customer may use: features, numeric limits and add-ons. Store them in your own database, write them from billing webhooks, check them in one server-side function, and count usage atomically. Here is the data model, the TypeScript check and the SQL.

Read article
15 min read· October 2026

Designing a Public API for Your SaaS: Keys, Versioning and Limits

A public SaaS API is a contract you cannot easily take back. Issue prefixed API keys and store only their hash, scope every key to one tenant, version so old clients never break, paginate with cursors, accept idempotency keys and publish rate limits. Here is the design, with TypeScript and SQL.

Read article
14 min read· October 2026

Sending Webhooks to Your SaaS Customers: Retries, Signing and Logs

Outgoing webhooks let your customers react to events in your SaaS without polling. Write each event to an outbox in the same transaction, deliver from a queue, sign with HMAC-SHA256 following the Standard Webhooks spec, retry with backoff for about a day, block internal addresses, and give customers delivery logs and replay.

Read article
14 min read· October 2026

Custom Domains for SaaS Customers: DNS, TLS and Routing

Custom domains let each SaaS customer serve your product at their own address. The customer adds a CNAME or A record, you verify ownership, a platform issues TLS automatically, and your app maps the Host header to a tenant. Here is how on Vercel, Cloudflare for SaaS or self-hosted Caddy, with code and the security traps.

Read article
13 min read· October 2026

Zero-Downtime Database Migrations for SaaS: A PostgreSQL Playbook

The rules for changing a live SaaS database without taking customers offline: why migrations cause downtime, the expand-migrate-contract release order, PostgreSQL-safe forms of risky statements, batched backfills, multi-tenant schema concerns and the CI checks that enforce it all. SQL examples throughout.

Read article
13 min read· October 2026

SaaS SLAs, Uptime and Status Pages: What to Promise Customers

How to choose an uptime commitment for a SaaS without over-promising: SLI, SLO and SLA in plain terms, how much downtime each percentage allows, why your SLA cannot beat your dependencies, what an SLA document should define, how to measure uptime with a health check, and how to run an honest status page.

Read article
14 min read· October 2026

SaaS Backup and Disaster Recovery: RPO, RTO and Restore Drills

A practical backup and disaster recovery plan for a SaaS: what RPO and RTO mean and how to choose them, what managed Postgres providers give you, why you still need an independent logical copy, how to restore a single tenant, and a restore-drill script that proves your backups work. Sources from PostgreSQL, AWS and Neon documentation.

Read article
13 min read· October 2026

Customer-Facing Analytics in SaaS: Build or Embed?

Build customer-facing analytics yourself when you need a few fixed charts that match your product. Embed a BI tool when customers want to explore, filter and build their own reports. Either way, lock every query to the tenant on the server and serve it from rollups, not your live tables. Costs, code and a decision table.

Read article
12 min read· October 2026

SaaS Technical Due Diligence: What Investors and Buyers Check

SaaS technical due diligence checks whether the product can scale, whether the code and IP are clean, and what fixing the gaps will cost. Reviewers look at architecture, code quality and tests, security, open-source licences, IP ownership, delivery metrics, infrastructure cost and key-person risk. What each area involves, the evidence to prepare, and how to fix gaps first.

Read article
15 min read· October 2026

PostgreSQL Row-Level Security for Multi-Tenant SaaS, with Tests

A working guide to PostgreSQL row-level security for multi-tenant apps: the roles, policies and FORCE setting, passing the tenant with set_config and SET LOCAL through a connection pool, the pitfalls that silently bypass RLS, and the CI tests that prove one tenant cannot reach another.

Read article
15 min read· October 2026

Lovable and Supabase Migrations: Stop Editing Production by Hand

Why hand edits to a production Supabase database break things, how Lovable records its own migrations, and a seven-step workflow to fix it: measure drift, pull a baseline, rebuild from files, write each change as a migration with its RLS policies, test it with pgTAP, deploy from CI, and decide where Lovable fits.

Read article
13 min read· October 2026

Rate Limiting Without Redis on Serverless: Postgres and Memory

The implementation behind the rate limits on this site, which run on serverless hosting with no Redis: the Postgres table and atomic upsert, which store each endpoint uses and why, cleanup without a cron job, failing open during a database outage, and why analytics beacons use a memory-only limiter so they do not wake the database on every page view.

Read article
15 min read· October 2026

Multi-Tenant vs Single-Tenant SaaS: A Decision Table

Multi-tenant is the default for SaaS; single-tenant is a paid exception for customers whose contracts demand it. A decision table, cost at 10, 100 and 1,000 tenants, noisy neighbours, per-tenant restores, compliance-driven isolation, and how to move a customer between the two models.

Read article
14 min read· October 2026

Database per Tenant vs Shared Schema: How Each Scales

A shared schema with row-level security scales to thousands of tenants on one set of migrations; a database per tenant scales isolation, not tenant count. Connection arithmetic, migration fan-out, per-tenant restore SQL, noisy-neighbour controls and how to move one tenant out of the pool.

Read article
12 min read· October 2026

Stripe Connect for Marketplaces: Express vs Custom, Fees and Payouts

How Stripe Connect works for a marketplace in 2026: Standard, Express and Custom accounts and the controller properties replacing them, direct, destination and separate charges, what Connect costs, how payouts and refunds move, and who verifies sellers, with TypeScript examples.

Read article
14 min read· October 2026

Turning a Single-Tenant App Into Multi-Tenant SaaS Without a Rewrite

You can make a single-tenant app multi-tenant without rewriting it: add a tenants table and a tenant_id column, backfill it in batches, enforce it with constraints added NOT VALID, scope every query, switch on PostgreSQL row-level security, then move customers over one at a time. The phases, the SQL, the risks and how long each step usually takes.

Read article
12 min read· October 2026

Better Auth vs NextAuth vs Clerk for a B2B SaaS: An Honest Comparison

For a new B2B SaaS in 2026, Better Auth is the self-hosted default, Clerk is the fastest hosted option if its per-user pricing fits, and NextAuth (Auth.js) is right for existing apps that already run on it. What each one gives you for organizations, roles and enterprise SSO, what it costs, and why this site still runs NextAuth.

Read article
12 min read· October 2026

Marketplace Split Payments, Escrow and Seller Payouts Explained

How a marketplace splits one payment between itself and its sellers: the three money-flow models, why holding seller funds is not escrow, the ledger that makes commission, refunds and payouts correct, SQL for releasing and paying out balances, and how TheSkinProof records commission per order line.

Read article
13 min read· October 2026

Integrating bKash, Nagad and SSLCommerz in One Checkout

How to run bKash, Nagad, SSLCommerz and cash on delivery behind one checkout: a shared payment interface, bKash token reuse and create/execute calls, SSLCommerz sessions, IPN and the validation API, marking orders paid safely, and what TheSkinProof runs in production.

Read article
13 min read· October 2026

Stop Overselling: Stock Reservation Inside the Order Transaction

Why two customers can buy the last unit, and how to stop it in PostgreSQL: the conditional UPDATE, SELECT ... FOR UPDATE, a CHECK constraint as a floor, locking lines in a fixed order to avoid deadlocks, when to reserve stock during payment, and a concurrency test that proves the fix.

Read article
17 min read· October 2026

One GCC Checkout for Tabby, Tamara and Checkout.com: Webhooks and Refunds

An engineering guide to running buy now, pay later and card payments through one checkout in Saudi Arabia and the UAE: how Tabby, Tamara and Checkout.com differ on amounts, statuses, capture, webhooks and refunds, a TypeScript provider interface that hides those differences, and how to handle webhooks that arrive out of order or twice.

Read article
18 min read· October 2026

M-Pesa Daraja STK Push: The Production Failure Cases to Test

An engineering guide to M-Pesa Express (STK Push) on Safaricom Daraja for teams in Kenya: how the flow works, why the callback is untrusted, the six failure cases to test before production, an idempotent TypeScript callback handler keyed on CheckoutRequestID that confirms through the STK Push query, and a reconciliation job for callbacks that never arrive.

Read article
19 min read· October 2026

Paystack vs Flutterwave for a Next.js Checkout: Fees, Webhooks, Splits

An engineering comparison of Paystack and Flutterwave for teams building a Next.js checkout in Nigeria and across Africa: published fees and settlement, countries, amount units, split payments, webhook verification and test mode, plus an App Router route handler that verifies signatures on the raw body with a constant-time compare and confirms each payment exactly once.

Read article
14 min read· October 2026

FHIR API Integration for Startups: SMART on FHIR, Epic and Cerner Sandboxes

A practical guide to FHIR API integration for health startups: the R4 resources you will use, SMART on FHIR launch flows, the Epic and Oracle Health (Cerner) sandboxes, bulk data export, a TypeScript sample, and where the time really goes.

Read article
17 min read· October 2026

Double-Entry Ledger Database Design in PostgreSQL

A working double-entry ledger schema for PostgreSQL: accounts, journal entries and postings, a deferred trigger that rejects unbalanced entries, bigint minor units, idempotency keys, reversal-only corrections, balance strategies and multi-currency, plus a TypeScript posting function.

Read article
16 min read· October 2026

Building a payment orchestration layer: routing, retries, failover

A payment orchestration layer routes each payment to the right processor, retries and fails over without charging twice, keeps saved cards portable and normalises webhooks. Routing rules, a TypeScript router, buy-or-build options, and how RAITHub would build a thin layer.

Read article
16 min read· October 2026

Ecommerce site search: Postgres, Meilisearch, Typesense or Algolia

Start with Postgres full-text search and pg_trgm, move to Meilisearch or Typesense when you need facets and instant results, and pay for Algolia when merchandising tools matter more than cost. Pricing, relevance, typo tolerance, multilingual text and zero-result analytics, with working samples.

Read article
15 min read· October 2026

Building a Product Configurator for an Online Store: Rules, Pricing and 3D

A product configurator is a rules engine with a preview on top. This guide covers option compatibility and dependencies, a server-side price rules engine, 2D layers versus 3D with three.js or model-viewer, SKU and BOM generation, B2B quotes, performance, and when an off-the-shelf customizer is enough.

Read article
19 min read· October 2026

Usage-Based Billing for SaaS: Metering, Stripe Meters and Invoices

Usage-based billing works when every billable event is written once to your own database, rolled into hourly totals and sent to the billing system with an idempotency key. Event design, late events, Stripe Billing meters versus Metronome, Orb and Lago, credits, invoice previews, plan limits and overage alerts, with SQL and TypeScript.

Read article
14 min read· October 2026

Building a Next.js E-commerce Admin: Orders, Stock and Roles

The seven areas an ecommerce admin needs, the Next.js App Router patterns that keep it safe (server actions with permission checks, keyset pagination, optimistic UI), and when Shopify, Medusa or Payload admin is enough instead of a custom build.

Read article
16 min read· October 2026

FEFO Fulfilment: Shipping Short-Dated Stock First

FEFO (first expired, first out) ships the batch closest to expiry first. How to choose between FEFO and FIFO, allocate batches at order time or pick time, enforce a minimum remaining shelf life, split lines across partial batches, return goods to stock, print pick lists, and allocate safely in PostgreSQL with FOR UPDATE SKIP LOCKED.

Read article
16 min read· October 2026

Feature Flags for SaaS: Plans, Rollouts and Kill Switches

Feature flags in a SaaS do four jobs: release, experiment, plan entitlement and kill switch. Target by tenant, roll out with a stable hash, delete flags on a schedule, and test both paths. Here is how, with a TypeScript evaluator and a buy-or-build comparison.

Read article
14 min read· October 2026

SaaS Admin Panel: Build It or Buy It?

Buy an internal tool such as Retool or Appsmith when staff need simple data screens fast; build the admin into your app when it touches tenant data, money or customer accounts. Cited pricing and licences for Retool, Appsmith, Forest Admin and React-admin, and how to do RBAC, audit logs, impersonation and data export safely.

Read article
20 min read· October 2026

One Platform, Many Agencies: Tenant Isolation for Property Portals

A multi-agency property platform stays safe when the agency is the tenant: agency_id on every row, PostgreSQL row-level security on every table, co-broking as an explicit agreement, public search from a separate projection, and a cross-agency IDOR suite in CI.

Read article
13 min read· October 2026

Why Is My Next.js App So Slow in Production? Six Causes and Fixes

Most slow Next.js apps have one of six problems: pages rendering on every request by accident, uncached database reads, N+1 queries, too much client JavaScript, unoptimised images, or a server far from its database. How to tell which one you have from TTFB and LCP, and the fixes, with the ISR and cached queries this site uses to keep its database mostly asleep.

Read article
16 min read· September 2026

API Rate Limiting Explained: Fixed Window, Sliding Window and Token Bucket

How the three common rate limiting algorithms work, with code for each; why an in-memory counter fails on serverless; and the Postgres-backed limiter this website runs instead of Redis, including its trade-offs, its three-bucket login limit and the per-recipient cap on confirmation emails.

Read article
7 min read· April 2026

Next.js Production Checklist: 15 Things Teams Forget

From missing error boundaries to unconfigured ISR, here is a checklist for shipping Next.js apps that actually work in production.

Read article
8 min read· July 2026

Core Web Vitals: A Practical Optimization Guide (2026)

A practical, honest guide to Core Web Vitals in 2026: what LCP, INP and CLS mean, the thresholds Google uses, and the specific fixes that move the numbers.

Read article
7 min read· April 2026

JWT vs Session Authentication: Which Should You Use?

A clear, honest guide to JWT vs session authentication: how each works, the real trade-offs, security pitfalls, and a practical rule for choosing.

Read article
7 min read· April 2026

Monolith vs Microservices for Startups

A practical, honest guide to monolith vs microservices for startups — the real trade-offs, a side-by-side comparison, rough costs, and when splitting actually pays off.

Read article
7 min read· March 2026

Next.js vs React: Which Should You Choose in 2026?

An honest Next.js vs React comparison for 2026 — what each really is, when to pick which, and how the decision shapes SEO, cost and hiring for your product.

Read article
8 min read· March 2026

PostgreSQL Indexing: A Practical Guide for Developers

A practical PostgreSQL indexing guide: what indexes do, the main types, when to use each, how to read EXPLAIN, and the mistakes that quietly slow apps down.

Read article
8 min read· March 2026

PostgreSQL vs MongoDB for SaaS: A Practical Comparison

An honest, practical comparison of PostgreSQL and MongoDB for SaaS products, covering data models, transactions, scaling, cost and multi-tenancy.

Read article
7 min read· March 2026

React Server Components Explained (with Examples)

A plain-English guide to React Server Components: what they do, how they differ from client components, real code examples, and when they actually help your product.

Read article
7 min read· February 2026

What Are Webhooks and How to Build Them Reliably

A practical, honest guide to what webhooks are, how they differ from polling, and the engineering patterns (signing, retries, idempotency) that make them reliable in production.

Read article
8 min read· February 2026

What Is Idempotency in API Design (and Why It Matters)

A plain-English guide to idempotency in API design: what it means, why duplicate charges and orders happen, and how idempotency keys make retries safe.

Read article