← All projects
Case study · Fintech · Mobile · AI
Spirex

An Arabic-first AI trading analyst, live on Google Play with paying subscribers.

Spirex turns a pair and a timeframe into a full trade plan, lets users talk to an AI analyst in real time, reads chart screenshots, and sells all of it through a coin economy that works without a payment gateway. Designed, built, shipped and operated by one person.
RoleFounder, product, design, full-stack, releases
TimelineDec 2025 → Aug 2026, ongoing
PlatformAndroid (live), iOS (built), Next.js web
StackReact Native 0.82, TypeScript, Supabase Edge Functions, PostgreSQL, OpenAI
Spirex home screen design Spirex mascot
28,900+
registered users
4.8★
Google Play rating
56
store releases, now v8.3.0
41
screens, ~45k lines of TypeScript

Overview.

Who it is for, what was broken, what shipped.
The audience

Arabic-speaking retail traders

Gulf-dialect users trading gold, forex, crypto and US indices on MT4, MT5 and TradingView. Most existing tools are English-only, expensive, and assume card payments that many of these users do not have.

The problem

Analysis takes an hour and still feels like guessing

Reading structure, marking order blocks, sizing the position and keeping discipline is slow, error-prone and emotional. Signal groups on Telegram are opaque and unverifiable.

The product

One tap to a validated trade plan

A native app where the AI does the technical read, the math is checked before it reaches the user, position sizing is built in, and a voice analyst answers follow-ups. Sold through tiers and coins, paid by bank transfer with in-app approval.

Feature walkthrough.

Screen by screen, with what each element does.
A home screen that reads the market for you
01 · Home

A home screen that reads the market for you

The first screen answers three questions in a glance: what session is open, how the market feels, and what the assistant thinks you should look at right now.

  • 1
    Session awarenessDetects the active trading session (Asian, European, US) and warns when an index market is closed so the analysis will rely on yesterday's close.
  • 2
    Mascot nudgeThe Spirex mascot surfaces a one-line brief, gold's move today for example, and offers to open the full analysis or ask the AI assistant with one tap.
  • 3
    Market mood and moversA sentiment gauge and a counter of strong 24-hour moves, computed from live prices without spending an analysis credit.
  • 4
    Voice assistant entryA live card that starts a real-time voice call with the AI analyst from the home screen.
  • 5
    Below the foldThe Spirex Vision card, a Gold Now card with live XAU/USD price and momentum, a 24-hour chart with volume bars, market chips for EUR/USD, BTC and ETH, and the daily discipline tip.
From a pair and a timeframe to a complete trade plan
02 · AI analysis

From a pair and a timeframe to a complete trade plan

Pick gold, silver, a forex pair, a crypto pair or a US index. The setup screen shows what the engine already knows, you choose the timeframe and the discipline style, and the backend fetches candles, computes the indicators server-side and asks GPT-4o for a structured signal.

  • 1
    Engine status and market readBefore spending a credit the screen shows whether the gold engine is online, plus live liquidity, volatility and chart-trend reads.
  • 2
    Timeframe pickerDaily, 4 hours, 1 hour or 15 minutes. The analysis is multi-timeframe underneath, so the pick sets the horizon, not the context.
  • 3
    Analysis styleStandard says WAIT when there is no clear setup. Take the risk pushes for a direction. Each style has its own discipline rules server-side.
  • 4
    What the engine usesSeven technical indicators, ten years of history and four timeframes, all computed on the edge function so the model receives facts, not raw candles.
  • 5
    The resultBUY, SELL or WAIT with a confidence score, entry zone, stop loss, two targets and risk-reward, validated by a geometry guard that repairs or downgrades broken setups, then saved to My Analyses.
Talk to the analyst, live, in Gulf Arabic
03 · Spirex AI

Talk to the analyst, live, in Gulf Arabic

A speech-to-speech call over WebRTC to OpenAI's realtime model. The assistant has a personality, knows the markets, and can look things up mid-sentence.

  • 1
    Real-time voice, interruptibleThe status pill shows the session state. Audio is low-latency WebRTC with Arabic transcription, and you can cut in while it is speaking.
  • 2
    Live tools during the callFunction calls are relayed to a Supabase Edge Function that fetches live prices, FX rates, news, the Fear & Greed index and top movers, then feeds the answer back into the session.
  • 3
    Text chat with tier routingThe keyboard button switches to the same persona in text, routed to GPT-4o or GPT-4o-mini by subscription tier with daily message limits.
  • 4
    Metered and abuse-resistantThe entitlement pill reflects the server's decision. Trial minutes are bound to device id plus email, sessions carry a server-issued second budget, and 30-second heartbeats stop force-quit from dodging the meter.
Screenshot any chart, get a setup back
04 · Spirex Vision

Screenshot any chart, get a setup back

Traders already live in MT4, MT5 and TradingView. Vision meets them there: upload a chart screenshot and the model reads it.

  • 1
    Three steps, no broker integrationPick, Analyze, Result. A screenshot from MT4, MT5, TradingView or any app is enough.
  • 2
    Reads pair, timeframe and priceOpen photos or take a picture with the camera. GPT-4o vision extracts the instrument and levels before analysing the structure.
  • 3
    Returns entry, stop and targetsThe output uses the same signal format as the standard analysis, so the lot calculator works on it too. A guide explains how to take a screenshot the model can read.
05 · Risk Guard and lot calculator

Capital protection built into the flow

Most retail losses come from position size, not direction. Spirex puts the risk math one tap away from every signal.

  • 1
    Risk GuardEnter balance, risk percentage (1 to 3 percent) and leverage (1:100 to 1:1000). The app recalculates exposure live.
  • 2
    Calculate my lot and executeAfter an analysis, one button sizes the contract from your balance and risk, using the signal's stop distance.
  • 3
    Discipline tipsShort daily reminders on the home screen about emotion and rules.
Every market gets its own engine
06 · Markets hub and community

Every market gets its own engine

The Signals tab is the hub: pick a market, see what your tier unlocks, and start. Around it sit the community layer, a live win ticker of results and a Telegram channel.

  • 1
    Tier and live statusThe badge shows the active plan and whether live market data is flowing.
  • 2
    Featured marketsGold is the flagship engine with unlimited analysis on PRO and above. Silver, forex, indices and crypto each have their own card and gate.
  • 3
    Crypto VIP strategiesExclusive RSI, MACD and EMA strategies on Binance data with a 30-minute cooldown per pair to keep analysis quality high.
A dual-coin economy and manual payments that scale
07 · Wallet and subscriptions

A dual-coin economy and manual payments that scale

Spirex sells in markets where card payments are unreliable, so the monetisation had to work without a payment gateway. The profile is the wallet.

  • 1
    Plan badge and legacy-safe tiersSixteen historical subscription ids map to today's buckets, so a paying user from an old version never loses access.
  • 2
    Gold balanceGold coins unlock gold analysis and VIP strategies. Unlimited from PRO up, so the balance reads infinity.
  • 3
    Silver pointsSilver coins pay for regular analyses. New users get a welcome bonus, and a coin is refunded automatically when an analysis fails technically.
  • 4
    Subscription details and paymentsActivation date, coins used and plan management. Upgrades go through a payment-proof flow: upload the transfer receipt, watch a countdown for the review window, and an admin approves it. Entitlements are written server-side only.
Operations without a laptop
08 · Admin dashboard

Operations without a laptop

An in-app admin role manages the business from the same build users run. The user list is blurred here for privacy.

  • 1
    Search any userBy name, email or phone, then change tier, top up coins or set a role in place.
  • 2
    Live KPIsSubscribers per tier, free users, total accounts and total revenue, straight from Postgres.
  • 3
    Approvals and the kill switchReview uploaded payment proofs, and use the app_updates table to push every installed client to the Play Store when an endpoint changes.
Light and dark themes
Arabic and English strings
Background analysis with local notifications
Free gold trial
Coming-soon gates per market
Bootsplash and custom branding
Google Sign-In
Privacy policy and settings

Architecture.

A thin native client, two edge functions, one Postgres.
Clients
React Native app41 screens · custom state-machine navigator · contexts + AsyncStorage · Reanimated 4 · WebRTC · Notifee · light/dark theming
Next.js 14 web appGold, forex, crypto and subscription pages on the same Supabase project
In-app admin dashboardRole-gated screen for users, tiers, coins and payment approvals
→
Supabase Edge Functions (Deno)
spirex-analyzeAsset-class router · provider fallback chain · server-side indicator engine · GPT-4o JSON signal · geometry guard · Vault RPCs for keys
spirex-ai7 request types: chat, session, voice_status, log_voice_usage, run_tool, suggest, tts · tier routing · usage metering
Auth + Postgres + Vaultprofiles, coins, payment_proofs, trade_signals, app_updates, voice_usage, chat_usage · RLS · SECURITY DEFINER RPCs
→
External services
OpenAIgpt-4o analysis and vision · gpt-4o-mini suggestions · gpt-realtime voice · gpt-4o-mini-tts · transcription
Market dataBinance · Twelve Data · Yahoo Finance fallback · CoinGecko · gold-api · Frankfurter FX · Fear & Greed · RSS news
DistributionGoogle Play (signed AAB) · Telegram channel · force-update gate
The previous backend was a self-hosted n8n workflow on a VPS. It was fully ported to spirex-analyze in August 2026, which removed the server, the plain-HTTP endpoints and the keys stored in workflow JSON.

Engineering deep dives.

The six problems that shaped the codebase.

1. Porting a visual n8n pipeline to serverless, and hiding the keys

Problem
The analysis backend ran on a self-hosted n8n VPS with API keys inside workflow JSON, reachable over plain HTTP.
Approach
Rewrote it as a Deno edge function: an asset-class router, a provider chain with fallbacks (Twelve Data, then Binance PAXG proxy or Yahoo, silver via SI=F futures), and an indicator engine (EMA, RSI, MACD, ATR, fractal swings, FVG detection) that runs server-side so the model receives facts, not raw candles. Keys moved to Supabase Vault behind service-role-only SECURITY DEFINER RPCs.
Trade-off
Kept the old HTTP-200-with-success:false error contract so already-shipped clients kept working.
Lives in: supabase/functions/spirex-analyze

2. A geometry guard for numbers people trade on

Problem
The model occasionally inverted stop and target levels or drifted far from the live price. Unacceptable when users act on it.
Approach
Post-generation invariant enforcement: a sanity band of ±25% around live price, directional ordering rules per BUY/SELL, ATR-based reconstruction of broken levels, recomputed risk-reward with a mode-aware floor that downgrades the signal to WAIT, and a confidence cap whenever a repair happened.
Trade-off
A repaired setup can differ from the model's own reasoning text.
Lives in: formatForApp() in spirex-analyze

3. Voice-call cost and abuse control

Problem
Realtime voice costs about $0.126 per minute, and a free trial is trivially farmable with new accounts.
Approach
A one-time trial ledger keyed on the union of device id and email, server-side entitlement checks that mint short-lived OpenAI Realtime client secrets, a hard per-session second budget returned to the client, 30-second usage heartbeats, and consumption decided from real subscription state, never from what the client claims.
Trade-off
iOS vendor id rotates after a full uninstall. Accepted, and compensated by the email leg.
Lives in: spirex-ai · VOICE ACCESS POLICY, src/utils/deviceId.ts

4. WebRTC speech-to-speech with server-side tools

Problem
OpenAI Realtime sessions cannot call the app's own data tools by themselves.
Approach
A React Native WebRTC peer connection to gpt-realtime. Function-call events are relayed by the client to the edge function as run_tool requests, which execute live-data fetches and return results into the session. Android audio routing quirks after route changes are handled with an in-call manager.
Trade-off
The client-relayed tool loop adds one round trip per call.
Lives in: src/screens/SpirexAIScreen.tsx (1,780 lines), spirex-ai

5. Tier migration without breaking paying users

Problem
Sixteen subscription ids accreted across versions. A naive bucket check once gave 58 paying PRO users a zero cap.
Approach
A single mapping layer (bucketForSubscription, isProTier, isVipTier, getHourlyLimit) with explicit legacy-id lists kept in sync between app and edge function. Per-tier hourly analysis limits, daily chat limits and per-message character caps applied to every message in history, which also blocks spoofed-history cost attacks.
Trade-off
Tier lists are duplicated client and server and must be kept in sync by hand.
Lives in: src/utils/coinSystem.ts, src/utils/rateLimiter.ts

6. Force update and remote kill switch

Problem
Shipped clients pointing at retired endpoints need to be movable without waiting for organic updates.
Approach
An app_updates table is checked at launch and drives a blocking update screen to the Play Store link. Each release commits its own SQL toggle to arm or disarm the gate.
Trade-off
Manual SQL toggles, no staged rollout.
Lives in: src/utils/updateChecker.ts, supabase_push_update_*.sql

Business model.

Tiers, coins and a gateway-free payment flow.
Free
$0
  • Welcome-bonus silver coins
  • Free crypto analyser (50+ coins)
  • Free gold trial
  • Text chat on GPT-4o-mini
Spirex Starter
$69
  • More silver coins
  • Wider analysis access
  • Higher hourly limits
Spirex PRO Most popular
$150
  • Unlimited gold coins
  • Gold and silver VIP analysis
  • Crypto VIP strategies, indices
  • GPT-4o chat
Spirex Infinity
$600
  • Everything unlocked, lifetime
  • Spirex AI voice calls
  • Uncapped usage

Two currencies, one wallet

Silver coins are spent on regular analyses and refunded when a run fails. Gold coins gate premium features and are unlimited from PRO up. Rate limits are enforced per tier on both client and server.

Payments without a gateway

Users pay by bank or mobile transfer, upload the receipt in the app, and see a countdown for the review window. An admin approves from the dashboard and the entitlement is written server-side. Nothing in the client can grant itself a tier.

Results.

What the code and the store show.
Traction

Live, rated 4.8, paying users

Published on Google Play with 56 releases through v8.3.0, more than 28,900 registered accounts in the admin dashboard, a Telegram community, and a paying subscriber base across the Starter, PRO and Infinity tiers.

Cost and safety

Server-side metering on every AI feature

Hourly analysis limits, daily chat limits, per-message caps, voice second budgets and device-bound trials keep OpenAI spend predictable and make free-tier farming uneconomic.

Operations

Zero servers to babysit

After the n8n port there is no VPS. Two edge functions, a Postgres and Vault handle everything, and a force-update gate can move every installed client in minutes.