SHEET 02projects/zaher-ai-platform/ REVISED 

Zaher.AI GEO tooling

The GEO and SEO platform I run at Zaher.AI: AI visibility audits on n8n, Stripe next to Paymob, enterprise SSO and seats, on AWS with the workflow engine on Azure.

Year
2025
Type
Client work
Status
Live in production, private repositories
Stack
  • TypeScript
  • Node.js
  • React
  • PostgreSQL
  • Drizzle
  • Redis
  • BullMQ
  • n8n
  • AWS
  • CloudFront
  • Azure Container Apps
  • Stripe
  • Paymob
  • Ory Polis

Zaher.AI is a GEO and SEO agency serving MENA. Its work is keeping Arabic brands visible as discovery moves from Google to AI assistants. As Head of Development & Technology I own the technology behind that: the customer platform, the audit pipelines, the infrastructure and the internal tooling.

The code is private and the work runs for clients, so this page has no links, client names or revenue figures. The numbers below come from our own incident notes and pull requests. The AI visibility checker on this site is a small public tool in the same area.

How an AI visibility audit is measured

The product clients pay for is an audit of how AI assistants talk about their brand, so the method has to hold up.

We ask the engines real shopper questions. ChatGPT, Gemini and Perplexity answers are captured through DataForSEO, and AI Overviews come from Google results. Claude and Grok were added later. A few engines have no way to capture a real answer, so those answers are simulated and the report labels them as simulated.

For each engine we use the model most people get in the consumer app, usually the free or default tier, and not the vendor’s newest API flagship. A GEO audit is supposed to show what a shopper sees, and most shoppers never change the default.

Questions come in two kinds. Unbranded questions don’t mention the brand, so they show whether AI names you on its own. Branded questions name you and show what AI says once you’re in the conversation. Each question runs three times per engine by default, because answers change from run to run.

An LLM judge then reads every answer and extracts signals: is the brand mentioned, is it recommended, which other brands and stores come up and in what role, and quotes to back each label. The judge doesn’t produce scores. The app computes every score from those signals, and each scoring number is editable and versioned, so an old report never shifts when we tune a weight.

The metrics use two separate answer pools:

Metric Answer pool
Mention rate, citation score, share of voice Unbranded answers only
Recommendation share, sentiment, roles Every answer that names the brand, branded questions included

That split is why a report can say a brand was mentioned in 0% of answers and recommended in 44% of the answers that named it. Both numbers are true, and the report now says which pool each one comes from.

A few rules came out of mistakes we caught in our own pipeline:

  • The step that simulates or collects answers never knows which brand is being audited. When brand-named and brand-free questions shared one model call, the same 15 questions scored 7/15 mentions in production batches, 15/15 in a single call and 8/15 once we split them. The cause was what the batch contained, not its size.
  • An answer that names the brand but mixes in another company’s facts still counts as a mention, with an accuracy error. A different business with the same name doesn’t count.
  • Analysis prose gets the counts from the database. When a model was asked to write the analysis and count mentions itself, it disagreed with the stored numbers.

The judge was picked with a bake-off. Candidate judges labelled the same stored answers, and three judges from other vendors graded the results blind, because a judge from the same model family as a candidate favoured it heavily. The winner is a GPT model on Azure AI Foundry with an OpenRouter fallback. We also ran a fallback drill to make sure audits keep going when the primary fails.

The n8n audit pipeline

The app is a TypeScript and Node.js service with a React client, Postgres through Drizzle, and Redis with BullMQ for queues. The heavy audit work runs in n8n. The app dispatches an audit to an n8n webhook, n8n calls the engines and the judge, and the results come back to the app, which owns the scoring and the report.

Large audits are split into chunks. One fix made sure the app keeps the question list n8n echoes back for each chunk, because n8n fills in market and language details the app doesn’t send. Another wrapped every webhook call in one helper that retries when n8n answers HTTP 200 with an empty body. All 14 webhook URLs can now be changed at runtime from the admin panel, with AWS Secrets Manager as the fallback. That work turned up a deploy script that copied only one of the 14 webhook keys out of Secrets Manager, so the other 13 had always run on their hardcoded defaults.

Moving the n8n platform to Azure Container Apps

n8n started on one VPS with Docker Compose and SQLite. That was the agency’s whole workflow engine: more than 250 workflows, 63 of them live in production. I moved it to Azure Container Apps, and it has been in production there since 23 September 2026.

The new setup splits n8n into main, worker and webhook apps, with Postgres Flexible Server, Azure Managed Redis, Bicep for the infrastructure and KQL alerts to Slack. The main app runs as a single replica, because a second one would fire every schedule twice.

The cutover was scripted. A sync script copied workflow definitions from the old server to Azure as many times as needed before the switch, and it reported and skipped anything that had been edited on the Azure side. A second script checked that Azure served every webhook path production would send to. Before cutover I proved a Postgres point-in-time restore: about 13.5 minutes for 256 GB.

Azure Managed Redis is clustered, and n8n needs a hash tag on two separate key prefixes. Without one, the worker failed on every poll. Without the other, every cache write failed quietly, about 318 errors a day.

A Redis watchdog for n8n

Six days after cutover, a managed Redis node failed over while the Azure health page still said “Available”. n8n ran zero executions for about 17 minutes. Its connections to the dead node went silent with no reset, the Redis client had no socket timeout, and only the kernel’s TCP retry limit ended the wait.

The fix is a custom n8n image with a watchdog: it pings Redis every 5 seconds and destroys the socket if no bytes at all arrive for 15 seconds. My first version waited for the PONG itself, and it killed a healthy worker, because blocking queue reads share the same connection. In a replay harness that drops packets on live sockets, the stock image hadn’t recovered after 53 minutes and the patched one recovered in 16 seconds. n8n’s own health endpoint said “ok” throughout, so a queue heartbeat monitor now watches for a stall.

Replit to AWS

Early in 2026 the app moved from Replit to AWS, and I worked mostly on the deploy and database side of that move. GitHub Actions builds a package, ships it to S3 and hands it to CodeDeploy, which installs it on EC2 and restarts the app under PM2. Postgres runs on RDS with a read replica, runtime config comes from Secrets Manager, logs go to CloudWatch, and Drizzle migrations run as part of the deploy.

Later I added the repo rules a growing team needs: CODEOWNERS on about 50 sensitive paths, conventional commits checked on PR titles, husky hooks, ESLint and Prettier, a CI workflow and Dependabot.

Payments: Stripe next to Paymob

Paymob handles Egyptian cards and wallets. I added Stripe as a second gateway instead of a replacement, with no migration of existing subscribers. Prices are in USD with our own SAR and EGP amounts taken from the database, so what a customer pays matches what the pricing page shows. Checkout and billing management use Stripe’s hosted pages.

The webhook verifies signatures and answers 503 when Stripe isn’t configured, so Stripe retries later. Settlement is one atomic pending-to-paid claim, because the webhook and the redirect page can race to settle the same order. Stripe charges a renewal about an hour after the period ends, so Stripe subscriptions get a three-day grace window before anything expires.

Enterprise SSO, team seats and admin roles

Our enterprise plan promised SSO and team seats, so I built them. A company account owns its email domains, has a seat limit, and has managers and members. Sign-in goes through a self-hosted Ory Polis, which puts SAML and OIDC behind one OAuth flow. We build our own patched Polis image because the upstream image shipped with a known remote code execution flaw.

When a company turns on “Require SSO”, password login, signup, password reset and Google or Microsoft sign-in are blocked for its domains, and existing sessions are signed out. Managers invite people by email, and members get extra rights only by grant: viewing billing, editing the brand profile or managing the account.

The same work closed a class of account takeover in Microsoft sign-in, where a multi-tenant app trusts the email claim that any tenant admin can set. Now an email counts as verified only when Microsoft vouches for it.

Inside the company, the admin panel uses database-backed roles with a permission resolver. Routes and screens are gated by permission, and roles can be managed at runtime.

Splitting the marketing site at the edge

The marketing site moved to its own repository so a separate team can own it without touching the app. Both sit behind one CloudFront distribution. By default requests go to the app. A CloudFront Function sends only the marketing page list to the S3 bucket, and it never sends app paths there, whatever the list says.

The first version baked the page list into the function. After a missed redeploy, 52 of 119 production pages fell through to the app as soft 404s. The list now lives in a CloudFront KeyValueStore that the marketing deploy publishes, and the deploy fails its smoke test if / isn’t served from the bucket. The marketing deploy role can only write to S3. It can’t change the router code, because a router change could leak the header the app uses to verify requests came through CloudFront.

Console

Type help and press Enter.