Production B2B SaaS Architecture

APEX — Construction Estimation & Management Ecosystem

Try Live Platform
A

Executive System Architecture Summary

APEX is engineered as a Dual-Client B2B SaaS Platform (React Web SPA + React Native Expo Mobile Client) powered by a Metadata-Driven Calculation Engine and a 33-Table PostgreSQL Relational Spine. Every saved estimate atomically snapshots its formula version, material prices, waste margins, and live USD-to-DZD exchange rates.
  • Zero-Deploy Dynamic Formula Engine: Administrators configure N civil engineering categories, equations, and dynamic input fields directly from the database without code deployments.
  • Transactional Cost Snapshotting: Atomic PostgreSQL transactions freeze unit prices, waste factors, and FX rates to protect historical budgets from market volatility.
  • Cross-Platform Field & Office Clients: Shared API contracts serving a responsive React Web SPA and a 35+ screen Expo SDK 52 mobile client with full Arabic RTL mirroring.
  • SaaS Quota & AI Governance: Subscription middleware enforcing per-tier project limits and metered Groq LLaMA-3.3-70B engineering consultations.
1

End-to-End Dual-Client Runtime Topology (Hover over any node to trace connections)

HTTPS / REST Axios + JWT Auth & Quota Metered Dynamic Formulas & Snapshots postgres.js Transactions (SQL) AI Chat Live FX Media PDF Reports React Web SPA React Router · TanStack Query Expo Mobile App React Native · 35+ RTL Screens Express API Server Auth · Catalog · Estimation · Admin JWT + Plan Quota Gate 15m Access · 7d Silent Refresh Dynamic Cost Engine Formulas · Waste · Market Factor PostgreSQL Store 33 Tables · 7 Functional Domains Groq LLM Engine llama-3.3-70b Bilingual ExchangeRate API USD → DZD · 3s Fallback Cache Cloudinary CDN Project & Site Assets PDF & SMTP Service Automated Devis Delivery
Unified Express API serving both React SPA (Web) and React Native (Expo 52) clients with live USD-to-DZD synchronization. Interactive SVG · Hover nodes to inspect paths
2

Relational Estimation Spine & Transactional Snapshot Model (Hover tables to highlight foreign-key links)

ACCOUNT & SAAS ENTITLEMENTS PROJECT & FORMULA SNAPSHOTS ITEMIZED COST LINES (DZD) users PK id : uuid UK email : varchar role : user_role (CLIENT/ADMIN) language : varchar (ar/en) subscriptions PK subscription_id : uuid FK user_id · plan_id : uuid status : subscription_status features_snapshot : jsonb plans & features PK plan_id : uuid name_en / name_ar : varchar price · duration : numeric / int projects PK project_id : uuid FK user_id · subscription_id name · status : ACTIVE/COMPLETED image_url · budget_category estimation PK estimation_id : uuid FK project_id · subscription_id budget_type : text total_budget : numeric (DZD) project_details (Leaf Node) PK id : uuid FK estimation_id · selected_formula_id formula_version_snapshot : int values (jsonb) · results (jsonb) estimation_detail_service PK detail_id : uuid FK project_details_id · service_id quantity : double precision unit_price_snapshot : DZD exchange_rate_snapshot : USD/DZD sub_total : numeric estimation_detail_material PK detail_id : uuid FK project_details_id · material_id quantity · quantity_with_waste unit_price_snapshot : DZD waste_factor_snapshot : % exchange_rate_snapshot : USD/DZD sub_total : numeric
Each leaf calculation executes inside a single SQL transaction, freezing formula versions, material waste margins, and currency rates. Interactive Schema Spine
3

33-Table Relational Schema Inventory

Functional Domain Core Tables Count
Identity & Auth users, refresh_tokens, password_reset_tokens 3
SaaS Entitlements plan_types, plans, features, subscriptions 4
Estimation Spine projects, estimation, project_details, estimation_detail_material, estimation_detail_service 5
Dynamic Formula Engine categories, formulas, formula_output, field_definitions, field_types, units, coefficients 7
Price Catalog & FX material_config, resource_catalog, service_config, financial_settings, exchange_rate_log 5
Bilingual Content Hub articles, article_types, tags, article_tags, likes, saves, predefined_questions, app_translations 8
AI Consultation Audit ai_usage_history 1
Total Architecture 7 Cohesive Business Domains 33
4

Core Engineering Pillars & Client Capabilities

Subsystem Architectural Implementation
Dynamic Engine
Zero-Deploy Formulas
Evaluates NON_MATERIAL and MATERIAL expressions dynamically at runtime using database-driven field_definitions and coefficients.
Mobile Engineering
5-Tier Expo SDK 52 App
Built across 5 decoupled layers (Presentation, Hooks/Context, Services, API Mappers, Infrastructure) with 35+ screens and native PDF export via expo-print.
Resilience
Silent Token Lifecycle
Axios request/response interceptors inject Bearer tokens and automatically execute silent 7-day refresh cycles on HTTP 401 without interrupting field workflows.
Localization
Full RTL & Bilingual JSONB
Complete Arabic Right-to-Left (RTL) layout mirroring alongside English, backed by bilingual database columns and localized AI assistant responses.
FX Resilience
3-Tier Currency Fallback
Fetches live USD-to-DZD rates with a 3-second timeout, applies administrative market_factor multipliers, and falls back to cached exchange_rate_log entries offline.

Experience the APEX SaaS Platform Live

Sign up and test the full estimation workflow, dynamic civil engineering categories, AI assistant, and PDF Devis export—includes 5 free projects on registration.

Launch Live Web Application