Work/01Intouch/Cortex

A unified retail operations platform powered by AI and real-time data.

Full-stack retail operations platform for a UK luxury jewellery business — replacing fragmented spreadsheets, disconnected tools, and manual processes with a single intelligent system.

<2s

plain-English questions answered from live data

weareintouch.app ↗
Intouch retail operations platform screenshot
Business
Intouch (Luxury Jewellery Retailer)
Industry
Luxury Retail / Jewellery & Watches
Region
United Kingdom
Stack
Next.jsReactTypeScriptSupabaseUpstash RedisReact FlowResendGemini AIAnthropic ClaudeShopifySimpleRFIDVercel

The Challenge

Luxury jewellery retail runs on relationships, precision, and trust. But behind the counter, operations at Intouch were held together by disconnected systems — Shopify for e-commerce, spreadsheets for inventory tracking, manual notebooks for repairs, and no unified view of who their customers were or what they'd bought.

Staff couldn't answer basic questions without switching between three tools. Marketing campaigns meant exporting CSVs to third-party platforms. Physical inventory counts took entire days with no way to reconcile against digital records. And when a customer called about a repair, the answer was “let me check and call you back.”

The platform needed to:

  • Unify product management, customer relationships, orders, repairs, and consignments in a single system
  • Provide AI-powered business intelligence that non-technical retail staff could use naturally
  • Integrate RFID hardware for real-time physical inventory tracking and reconciliation
  • Automate customer communications across purchases, repairs, and marketing campaigns

Off-the-shelf retail platforms couldn't deliver. Generic CRMs lack the domain-specific features — repair lifecycle management, consignment tracking, buying-in slips. Jewellery-specific solutions are dated, inflexible, and don't support AI or RFID. Intouch needed a purpose-built platform built around their specific operations.

The Solution

01

Conversational Business Intelligence

The most common question from staff was some variation of “Who is our best customer?” or “What's our most popular product type?” Traditional dashboards require knowing where to click. We built something better — a conversational interface where staff ask questions in plain English and get answers instantly.

The AI query pipeline works in stages:

  1. 01

    Natural language to SQL

    The user's question is sent to Google Gemini 2.0 Flash along with a complete schema description. Gemini generates a valid PostgreSQL query — SELECT only, never write operations. The query is validated server-side before execution.

  2. 02

    SQL results to natural language

    The raw query results are passed through a second Gemini call with formatting instructions tuned to the query type. Customer spending queries get one format. Product recommendations get another. Gift suggestions trigger a clarifying question flow.

  3. 03

    Conversation persistence

    Every exchange is stored with full metadata — the generated SQL, raw results, and formatted response. Follow-up questions have context. Ask “Who's our top spender?” then “Show me their purchase history” — the system knows who “their” refers to.

  4. 04

    Fallback intelligence

    When Gemini generates invalid SQL, the system falls back to hand-crafted queries for common patterns — loyalty analysis, product searches, spending breakdowns — rather than returning an error.

  5. 05

    Dynamic data visualisation

    When the data warrants it, the pipeline generates a visualisation config that specifies chart type, axis mappings, and value formatting. The frontend renders interactive charts inline in the chat. Ask “Show me sales by product type” and you get a pie chart, not a paragraph.

No dashboards to learn — just ask a question.

AI query pipeline
PipelineAnswer
Input
Staff asks a question
“Who is our most loyal customer?”
Stage 01
SQL Generation
Schema-aware query building
Stage 02
Execute
Validated read-only query
Stage 03
Format + Visualise
Context-aware response
Output
Formatted answer + interactive chart
“Sarah Chen, with £12,400 across 23 orders”
Full conversation persistence — follow-up questions have context.
02

Visual Workflow Automation

Retail operations are full of repetitive sequences — send a follow-up email 3 days after a repair is completed, notify the manager when a high-value item needs approval, trigger a marketing campaign when inventory drops. Rather than hard-coding these, we built a drag-and-drop workflow builder.

The builder is powered by React Flow, giving users a canvas to compose automation visually:

Trigger nodes

Define what starts the workflow (e.g. “repair status changes to complete”)

Condition nodes

Add branching logic (e.g. “if repair cost > £500”)

Action nodes

Define what happens (e.g. “send email via Resend”, “wait 3 days”, “notify manager”)

AI copilot

Describe what you want in plain English, and Anthropic Claude generates the workflow configuration

The workflow execution engine handles the runtime. An event trigger map covers 20+ domain events. When any API endpoint creates or updates an entity, the engine finds all active workflows with a matching trigger and fires them asynchronously. Steps execute sequentially with context chaining — each step's output feeds into the next via template variables that resolve at execution time.

20+ action handlers cover the full operational surface — send email, create customer, update repair status, add tags, send webhooks, and more. Workflow runs are fire-and-forget — the originating API call returns immediately.

Describe the automation in English — Claude builds the workflow.

Workflow engine
Visual builder
Triggers Conditions Actions Delays
design
Assist
AI Copilot
async run
Execution engine
Event matching Step execution Context chaining 20+ handlers
Drag-and-drop design with fire-and-forget async execution.
03

Resilient Caching with Graceful Degradation

A retail platform can't go down during peak hours. The caching layer was designed with a hard constraint: Redis being unavailable must never cause an error visible to users.

Upstash Redis provides the caching and rate-limiting infrastructure, but every cache operation is wrapped in a graceful degradation pattern:

  1. 01

    Cache-aside reads

    Check Redis first. On a hit, return cached data. On a miss, query Supabase, return the result, and backfill the cache asynchronously — the user doesn't wait for the cache write.

  2. 02

    Tiered TTLs

    Volatile data like active orders caches for 60 seconds. Semi-static data like product catalogues caches for 30 minutes. Reference data caches for 24 hours. Each domain has a tuned expiry.

  3. 03

    Sliding-window rate limiting

    Login attempts, API calls, and sensitive operations are rate-limited using Redis sorted sets. If Redis is down, rate limiting is bypassed — availability over protection.

  4. 04

    Pattern-based invalidation

    When a product is updated, all product-related cache keys are cleared by prefix. No stale data, no manual key tracking.

Graceful cache degradation
HitDegraded
Incoming request
Cache layer
Redis cache check
Availability verified before every operation
hit
Cache hit
Return cached data instantly
60s orders30m products24h reference
miss / down
Miss or unavailable
Fall through to database
Backfill cache async
Users experience slower responses, never errors — availability over strict enforcement.
04

Audience Segmentation and Outreach

Marketing in luxury retail is personal. Blast emails don't work when your customers expect to be known. The outreach system implements a segment-then-campaign pattern that lets the team target precisely.

Audiences are dynamic customer segments defined by 26+ filter types stored as JSONB — spending thresholds, purchase recency, product preferences, loyalty status, location, tags, and more. Filters are composable: combine any number of criteria to build a segment. Member counts are cached and refreshed on filter changes.

Campaigns target an audience with email content that can be AI-generated. The outreach pipeline covers campaign creation, audience selection, optional AI content generation based on audience characteristics, sending via Resend with per-recipient tracking, and real-time analytics for opens, clicks, and unsubscribes.

05

RFID Inventory Reconciliation

Physical inventory counts in a jewellery store are high-stakes — every item is valuable, and discrepancies matter. Manual counts took the team an entire day and were prone to human error. RFID scanning reduces this to minutes.

The platform integrates with SimpleRFID through a purpose-built sync layer:

  1. 01

    Product sync queue

    When a product is created or updated, it's added to a sync queue with a “pending” status. Product creation never blocks on sync success — the queue decouples the two systems.

  2. 02

    Cron-based processing

    A Vercel Cron job runs every 5 minutes, picks up pending items, and pushes them to the SimpleRFID API. Failed syncs are retried up to 5 times with the failure reason logged.

  3. 03

    Token management

    SimpleRFID uses OAuth with expiring tokens. A dedicated token manager handles authentication, automatic refresh, and token caching — the sync layer never deals with auth directly.

  4. 04

    Scan comparison

    The RFID page lets staff trigger a scan, then compares what was physically scanned against what the database says should be present. Discrepancies are surfaced immediately — missing items, unexpected items, items in the wrong location.

The key architectural decision was making the sync queue resilient to failures. A SimpleRFID outage doesn't affect product creation. The queue drains when the service recovers. Product data is the source of truth; RFID is a downstream consumer.

RFID sync queue
SyncedRetry
Product Created
Never blocks on sync
Sync Queue
Pending status
Vercel Cron
Every 5 minutes
SimpleRFID API
Push to RFID system
outcome
Outcome
Synced
Pushed to SimpleRFID
Retry
Up to 5 attempts with logged errors
Products queue on create; the cron pushes them every 5 minutes and failures retry up to 5 times with logged errors.
06

PDF Generation and Thermal Printing

A luxury jewellery store needs polished documents — repair tickets, invoices, buying-in slips, cash receipts. And the till needs to print receipts without a desktop printer driver.

Server-side PDF generation uses @react-pdf/renderer to produce repair tickets with item details and cost breakdowns, sales invoices with line items and totals, jewellery and watch buying-in slips with valuation details, and cash slips for safe transactions.

Thermal receipt printing runs on a dedicated Node.js print server that speaks the ESC/POS protocol directly. The web app sends print jobs via HTTP; the print server translates them to thermal printer commands. This bridges the gap between a cloud-hosted PWA and physical retail hardware on the local network.

Technical Architecture

Frontend
Next.js 16 / React 18 / TypeScript / Tailwind CSS / Radix UI
Backend
Next.js API Routes + webhook ingestion layer
Database
Supabase (PostgreSQL + Realtime)
Caching
Upstash Redis (cache-aside + rate limiting)
Auth
Custom JWT (jose) with cookie-based sessions + PIN login
AI
Google Gemini 2.0 Flash + Anthropic Claude + OpenAI
E-commerce
Shopify (bidirectional sync)
Inventory
SimpleRFID (queue-based sync + scan comparison)
Email
Resend API + React Email templates
Workflow Engine
React Flow (visual builder) + Supabase (execution)
PDF & Print
@react-pdf/renderer + ESC/POS print server
Hosting
Vercel (Edge Network)

Key Architecture Decisions

Rather than building static dashboards that answer predetermined questions, the AI pipeline lets staff ask anything about their data in natural language. Gemini generates SQL, executes it, and formats the response — all in under 2 seconds. No feature requests for "add this metric to the dashboard." The data is already accessible.

Key Features

Conversational BI

Ask business questions in plain English — AI generates SQL, executes it, and returns formatted answers with charts

RFID inventory tracking

Scan physical inventory with RFID hardware and reconcile against database records in minutes

Visual workflow builder

Drag-and-drop automation with AI copilot that generates workflows from natural language

Customer CRM

Full profiles with purchase history, interaction timelines, preferences, tags, and wishlists

Audience segmentation

26+ filter types for dynamic customer segments with cached member counts

Email campaigns

AI-generated content, per-recipient tracking, open/click analytics, automated unsubscribe

Repair lifecycle

End-to-end tracking from intake to completion with automated customer notifications

Shopify sync

Bidirectional product and customer sync with webhook-driven updates

PDF generation

Repair tickets, invoices, buying-in slips, and cash receipts rendered server-side

Thermal receipt printing

ESC/POS print server bridges the cloud PWA to local receipt printers

Redis caching

Cache-aside pattern with tiered TTLs, pattern invalidation, and graceful degradation

PWA installable

Full Progressive Web App — installable on tablets, desktops, and phones with instant updates

Looking for a platform that understands your operations?

Whether you need AI-powered business intelligence, real-time inventory management, or a system that replaces five tools with one — we'd love to talk.

Start a project
Next project
PM Competitions
Automotive · Prize competitions
→