توصيل مباشر من المزرعةبدون وسطاء
خير تونس
HB
Engineering credits · Proof of ownership

This platform was designed
& engineered by Hamza Belgacem

Full-stack engineering of Khir Tounes— a Tunisian farm-to-table marketplace connecting farmers directly to consumers: RTL Arabic storefront, interactive national map, consent-first AI farmer acquisition, a cost-routed multi-model AI layer, and the admin and farmer consoles behind them. This page is the developer's signature: intentionally unlinked, unindexed, and reachable only by a private path.

SIGNATURE  HB·KT·2026 · 9x4k-7q2m-a1c8 · BUILT JUL 2026

Developer

Full name
Hamza Belgacem
Role
Full-stack Engineer — marketplace & AI platforms
Base
Tunisia · working with UK/EU clients
Project
Khir Tounes — khirtounes.tn
Delivery
Solo build — design handoff → AI layer → VPS production

Specialised in building operational platforms where product, compliance and AI cost all have to work at once: server-rendered commerce with server-side pricing integrity, provider-agnostic LLM gateways with per-task model routing and spend metering, consent-driven data pipelines designed around real privacy law, and RTL-native design systems — delivered end-to-end from schema to TLS-terminated production.

16
Pages & views built
12
API endpoints
13
Database models
24
Tunisian governorates mapped
4
AI tasks · 4 model tiers
100%
Server-rendered, RTL-native
Under the hood

Technologies integrated

A modern, self-hosted stack — typed end-to-end, cheap to run, and portable off any single vendor.

Next.js 16 + React 19
App Router · Turbopack · RSC
TypeScript + Tailwind v4
typed end-to-end · design tokens
Prisma 7 + SQLite
driver adapter · migrations · seed
Anthropic Claude API
4 models · structured outputs
AI routing gateway
per-task tiers · cost ledger
Leaflet + OpenStreetMap
24 governorates · live pins
jose JWT + bcrypt
httpOnly sessions · RBAC
Edge proxy guard
route + API protection
RTL Arabic design system
3 Arabic typefaces · tokens
24 hand-built SVG illustrations
produce icon system
Server-side order pricing
never trusts the client
PM2 · Nginx · Let's Encrypt
multi-site VPS production
Engineering stories

Challenges overcome

The problems that separate a template from a platform — each solved, verified live, and in production.

01

Filling an empty marketplace — without scraping

The brief was to auto-scrape Facebook and TikTok and publish farmer profiles. That breaks platform terms and Tunisian data-protection law. Re-architected it into a consent-first acquisition pipeline: AI drafts the profile and invitation from public content, the record stays *private*, and nothing is published until the farmer activates by phone — with a consent ledger and right-to-erasure built in.

02

AI that a business can actually afford

Rather than hard-wiring one model, built a provider-agnostic gateway with a task registry: each task routes to the cheapest tier that does the job (Haiku → Sonnet → Opus → Fable). Every call is metered and written to a cost ledger, and the admin can switch a task's model at runtime from a dashboard — no redeploy.

03

A design prototype translated verbatim

The client delivered a 1,900-line HTML/CSS design prototype in a bespoke DSL. Ported it pixel-faithfully to React Server Components — including a 24-icon inline SVG produce system, three Arabic typefaces, and a full RTL token layer — with zero design regressions and no UI framework.

04

A map that tells the truth about coverage

The prototype's stylized SVG map couldn't represent real geography. Replaced it with Leaflet over OpenStreetMap covering all 24 governorates, colour-coded by whether a governorate actually has registered farmers — empty ones convert into a recruitment call-to-action instead of pretending to have supply.

05

Auth that survives the edge runtime

Session verification runs in the proxy layer, where Node APIs don't exist. Split the JWT logic into an edge-safe module (jose only) consumed by the proxy, and a Node module handling cookies — so `/admin`, `/dashboard` and every privileged API are gated by signature + role before a request ever reaches the app.

06

Shipping onto a live shared VPS

Deployed alongside four existing production sites: isolated on its own port behind an added Nginx server block and TLS, with PM2 process management. Diagnosed and resolved the real-world traps — a Node major-version upgrade breaking a neighbouring app's native module, and a stale Prisma client after a schema migration.

HAMZA BELGACEM · KHIR TOUNES PLATFORM · 2026THIS PAGE IS INTENTIONALLY UNLINKED · NOINDEX