All projects
LiveSaaS

SAIMA: AI Marketing Platform

An Arabic-first command centre for brand, content and publishing

A SaaS platform for Saudi businesses that brings brand identity, AI generation of copy, images, video and voice, scheduling and publishing, campaigns and analytics into one Arabic-first workspace. It is live in pre-launch with approved accounts.

Visit the live sitesaimahub.ai
My role
Head of Development (lead engineer): I led engineering on the platform end to end, from frontend, API and database to the AI pipeline, integrations and deployment
Timeline
Jun – Nov 2026
Platforms
Web app, REST API, Cloud
saimahub.ai
Hero with the platform hub connecting social and marketplace channels
Mobile hero with the channel hub and main call to action
Database tables
~158
API endpoints
~260
Automated tests
~740
Lines of code
~166k

The problem

A small marketing team in Saudi Arabia typically works across a dozen tools: one for design, one for captions, one for video, one for scheduling, each priced separately and most of them English-first. The brand is never held consistently in one place.

  • Brand voice and identity were not stored anywhere the tools could use.
  • Arabic, and Saudi dialect in particular, is poorly served by most AI tools.
  • Publishing to Instagram, TikTok, Snapchat and YouTube meant signing in to each one.
  • Usage-based AI costs were hard to price into a subscription.

The solution

One workspace where the brand is defined once and every generator uses it.

  • Brand identity stored as structured data that feeds every AI request.
  • An AI studio for copy, images, video and voice, including Saudi-dialect voices.
  • Scheduling and publishing to Meta, TikTok, Snapchat, YouTube, Threads and Google Business Profile from one calendar.
  • Salla store integration for product-based content.
  • Plans, credits and wallets, with billing through Moyasar and Apple Pay built and paused until launch.
  • Per-brand team permissions, and affiliate and platform-admin portals.

Architecture

A Next.js product over a TypeScript API, with AI generation run by a background worker so slow jobs never block requests. The code lives in 31 split repositories under one GitHub organisation.

SAIMA platform

Product

  • Next.js 16 web app in 6 zones: app, admin, affiliate, auth, developer, marketing
  • 18 feature packages
  • Shared ui, sdk, platform, fintech-core and deploy packages

API

  • Node 22 running TypeScript directly, no build step
  • ~260 endpoints: 43 backend route modules plus 28 Next route handlers
  • Async generation worker

AI runtime

  • Claude, OpenAI, Gemini, Veo, ElevenLabs
  • Python AI service
  • Deterministic video renderer

Data

  • PostgreSQL, pglite in tests
  • Row-level security
  • Cloudflare R2

Engineering decisions

Two things make an AI SaaS hard to run: costs that change with every request, and data from many customers in one database. Both were designed for at the schema level.

A ledger for credits
AI usage is charged against each workspace’s credit wallet, and every charge is written to a transaction log that can be audited. A provider-credit ledger tracks what each AI vendor costs, and plan allowances are set from margin, with video priced per second.
Isolation in the database
Every query is scoped to its workspace across ~158 tables, and 68 named row-level-security policies cover about 101 of them in the database as well.
Slow work off the request path
Image, video and voice jobs run asynchronously in a generation worker and report back, keeping the API responsive.
Provider-agnostic AI
Text, image, video and voice requests route to Claude (Opus, Sonnet, Haiku), OpenAI and Gemini image models, Gemini voice, Veo 3.1 and ElevenLabs through one internal interface.
A video renderer that is deterministic
A headless browser places every frame at its exact time and ffmpeg encodes them, with the voice-over mixed with designed sound effects. Claude writes a “director” script for each video. The same engine makes collage videos from product photos and drives Motion Studio v5, with a 3D camera, live backgrounds, word-level sync and motion blur.
Claude-designed content
A carousel designer lays out 2 to 10 slides, the eight dashboard agents answer with Claude, and each brand gets an AI-generated landing page on its own subdomain.
Verified integrations
Salla, Meta (Facebook, Instagram, Messenger and WhatsApp webhooks), TikTok, Snapchat, YouTube, Threads and Google Business Profile. OAuth tokens are encrypted with AES-256-GCM using key ids, and refreshed; incoming webhooks are verified with HMAC signatures.
A modular front end
The app is split into Next.js zones and feature packages that share one UI kit and a typed SDK.
Visual regression at scale
A matrix shoots 22 app screens at 1440 and 390 px in light and dark, so a change that shifts a layout shows up before release.
Own deployment control plane
GitHub Actions builds, an atomic switch, one-step rollbacks and a preview for every pull request with isolated preview cookies, on self-hosted Docker and Caddy.
Written for AI answer engines too
The public site publishes an llms-full.txt so AI assistants can read what the product does.

Web

  • Next.js 16
  • React 19
  • TypeScript 5.9
  • Tailwind CSS 4
  • shadcn/ui
  • GSAP

Backend

  • Node.js 22
  • TypeScript
  • Python (AI service)

Data

  • PostgreSQL
  • pglite (tests)
  • Row-level security
  • Cloudflare R2

AI

  • Anthropic Claude
  • OpenAI images
  • Google Gemini and Veo 3.1
  • ElevenLabs

Integrations

  • Salla
  • Meta
  • TikTok
  • Snapchat
  • YouTube
  • Threads
  • Google Business Profile
  • Moyasar
  • Apple Pay
  • Resend

Delivery

  • Docker
  • Caddy
  • GitHub Actions
  • Hetzner

Where it stands

SAIMA runs at saimahub.ai as a pre-launch: sign-up is register-then-admin-approval and payments are paused ahead of the public launch.

  • Approved accounts use the studio, publishing and portals today; billing through Moyasar is built and switched off until launch.
  • About 740 automated tests in 66 files cover the API, the credits and the interface.
  • The codebase is ~166k lines (TypeScript ~129k, SQL ~21k, JavaScript ~13k), split into independently deployable repositories and packages.
  • 731 commits between 18 August and 3 November 2026.

Need something like this?

Tell me about the operation you want to organise and I will map it into a clear system before writing a line of code.

Let's talk