AI Engineering Case Study · 2025

Building an AI-Powered Legal Assistant for the UAE

A production application combining Large Language Models, Retrieval-Augmented Generation, and a curated UAE legal knowledge base — serving real users in Arabic and English.

Gemini 2.5GPT-5RAGSupabaseTanStack StartEdge RuntimeArabic NLP

Live Product

uaelawhelp.ae — a bilingual (Arabic / English) legal information platform focused on UAE federal and emirate-level law. Live and serving end users on a custom domain.

Problem

Legal advice in the UAE is expensive, slow, and rarely available in plain Arabic. Expatriates and citizens alike struggle to understand labor law, rental law, family/personal-status law, and inheritance rules. Generic chatbots (ChatGPT, Gemini) hallucinate UAE-specific statutes and cite non-existent articles.

Solution Architecture

  • Multi-model AI gateway — routes queries to Gemini 2.5 Pro for long-context reasoning and GPT-5 for nuanced legal drafting.
  • Retrieval-Augmented Generation (RAG) — every answer is grounded in a curated corpus of UAE federal laws, ministerial decisions, and Court of Cassation rulings.
  • Bilingual pipeline — Arabic-first UX with automatic English translation for foreign documents.
  • Voice input — speech-to-text transcription for users who prefer to ask questions verbally in Arabic.
  • Document analysis — users upload contracts, court papers, or fatwas and receive structured AI analysis with citations.
  • Live legal updates — automated daily checks for new UAE legislation, with admin moderation before publishing.

Technical Stack

  • Frontend: React 19, TanStack Start v1 (SSR), Tailwind CSS v4
  • Backend: TanStack server functions on Cloudflare Workers (edge runtime)
  • Database: Supabase (Postgres) with Row-Level Security and role-based access
  • AI Models: Google Gemini 2.5 Pro/Flash, OpenAI GPT-5, Whisper for voice
  • Auth: Supabase Auth (email + Google OAuth)
  • Mobile: Capacitor wrapper for iOS and Android deployment
  • Payments: Subscription paywall with quota management

Engineering Highlights

  • Streaming AI responses with token-level rendering for sub-second perceived latency.
  • Custom Arabic prompt engineering — system prompts enforce citation of specific UAE federal law articles.
  • Admin dashboard with analytics, AI usage tracking, user management, and content moderation.
  • SEO-optimized SSR with route-level metadata for 40+ public pages.
  • Full audit logging, security scanning, and rate limiting.

Impact

The platform is the first production AI legal assistant in the UAE built end-to-end by a single developer — covering data, AI orchestration, full-stack web, mobile deployment, and DevOps. It demonstrates practical application of state-of-the-art AI to a high-stakes, domain-specific problem.

About the Developer

Ali Kabol Faghiri — AI Application Developer based in the UAE. View full portfolio →

Contact: Dxb8581@gmail.com

اسأل مستشار AIمجاناً · بدون تسجيل