Code Audit

Full-stack audit of YAS Marketplace and Legal AI Platform — March 12, 2026

2 Critical Blockers Before Launch
YAS Marketplace

Next.js 15 · PostgreSQL · Redis · AWS S3

Needs Payment Integration
Launch Readiness75%

Pages

14 buyer + 15 admin

API Endpoints

12 groups

DB Models

28 models

Auth

JWT + bcrypt

i18n

EN + AR / RTL

Payment

MOCK ONLY ⚠️

Last commit: Mar 10, 2026 704 tests / 33 suites
Legal AI Platform

Next.js · PostgreSQL · Zoom SDK 3.8.10

Subscription & Zoom Untested
Launch Readiness60%

Dashboard Pages

12 pages

Auth

Phone OTP

Video

Zoom SDK (untested)

i18n

EN + AR / RTL

Subscription

UI only ⚠️

Wallet

UI only ⚠️

Last commit: Feb 23, 2026 Infrastructure present

Confirmed Strengths

Bilingual EN/AR with RTL

Full bilingual support with RTL layout switching across both platforms — a genuine competitive advantage in Kuwait.

704 Automated Tests

The Marketplace has 704 automated tests across 33 suites using Vitest — above average for early-stage startups.

Production-Grade DB Schema

28 well-indexed Prisma models with proper KWD decimal precision (10,3), audit logging, and full lifecycle modeling.

Role-Based Access Control

BUYER / SELLER / ADMIN / SUPER_ADMIN roles with admin approval gates for products, sellers, and auctions.

Complete Admin Panel

15 admin pages covering users, seller applications, products, auctions, raffles, transactions, payouts, reports, and system health.

Seller Workflow Complete

Full seller lifecycle: apply → approval → product listing → auction management → earnings → payouts.

Critical & High-Priority Gaps

No Real Payment GatewaycriticalMarketplace

All transactions are simulated. KNET UI is built but no real gateway credentials or integration code exists. No real money moves through the system.

Owner: Ziad + AbdulghafarEffort: 2–3 weeks
Zoom SDK Never Tested in ProductioncriticalLegal AI

The Zoom Video SDK is loaded from CDN. Server-side JWT generation for Zoom sessions has not been verified in a live environment. Meeting creation and participant joining flows are untested.

Owner: ZiadEffort: 3–5 days
Subscription Backend Not ImplementedhighLegal AI

Subscription plans are displayed in the UI but no payment processing, plan activation, or feature gating is connected to a backend.

Owner: ZiadEffort: 1–2 weeks
Wallet System UI-OnlyhighLegal AI

Wallet balance display exists but no top-up mechanism, transaction history, or deduction logic is connected.

Owner: ZiadEffort: 1 week
Reasoning Leakage in OCR OutputhighOCR Pipeline

The OCR model's chain-of-thought is appearing in the extracted text output. The system prompt must explicitly strip reasoning tokens before returning output.

Owner: JohnEffort: 1–2 days

Technical Debt Register

No rate limiting on auth endpoints
Bothhigh
No CI/CD pipeline configured
Bothhigh
SMS notifications are stub-only
Marketplacemedium
Push notifications (FCM) are stub-only
Marketplacemedium
No error monitoring (Sentry etc.)
Bothmedium
No CSRF protection on API routes
Bothmedium
Redis is single point of failure for sessions
Marketplacelow
PAYPAL in PaymentGateway enum (dead code)
Marketplacelow

Priority Action Plan

Tier 1 — Critical
1Integrate KNET via MyFatoorah or Tap Payments
Marketplace→ Ziad + Abdulghafar2–3 weeks
2Test and validate Zoom SDK in production
Legal AI→ Ziad3–5 days
3Implement subscription backend (plan activation, feature gating)
Legal AI→ Ziad1–2 weeks
4Implement wallet top-up and deduction backend
Legal AI→ Ziad1 week
5Fix OCR reasoning leakage (model prompt fix)
OCR Pipeline→ John1–2 days
Tier 2 — High Priority
6Add rate limiting to auth endpoints (login, register, OTP)
Both→ Abdulghafar2–3 days
7Set up CI/CD pipeline (GitHub Actions)
Both→ Ziad2–3 days
8Integrate SMS provider for Marketplace notifications
Marketplace→ Abdulghafar1–2 days
9Integrate FCM for push notifications
Marketplace→ Abdulghafar2–3 days
10Document Zoom JWT implementation before Jassim departs
Both→ Jassim1 day
Tier 3 — Medium Priority
11Set up error monitoring (Sentry)
Both→ Ziad1 day
12Set up performance monitoring
Both→ Ziad1–2 days
13Implement Legal AI search (vector DB + model)
Legal AI→ Ziad3–4 weeks
14Add CSRF protection to API routes
Both→ Abdulghafar1–2 days
15Clean up PAYPAL from PaymentGateway enum
Marketplace→ Abdulghafar30 min