Back to Projects
Case Study 02Computer Vision · Full Stack · MLOpsRole: Frontend & DevOps Contributor

RetailIQ

Smart Retail Video Analytics

Retail video analytics monorepo turning store camera feeds into footfall, dwell-time, and shelf-stock insights via YOLO11n, ByteTrack, hybrid RAG, and async PostgreSQL.

01 · Project Overview

What RetailIQ Does

RetailIQ is an AI-powered retail analytics monorepo built to turn store images and video streams into structured operational analytics. It brings together a Next.js frontend, FastAPI backend, YOLO11n object detection, ByteTrack customer tracking, async PostgreSQL persistence, Redis rate limiting, and a hybrid RAG assistant—orchestrated with Docker Compose and GitHub Actions.

02 · Motivation

Why I Chose This Project

I contributed to RetailIQ as a Frontend & DevOps Contributor to gain hands-on experience integrating a Next.js + TypeScript frontend with an AI-backed FastAPI/PostgreSQL backend, standardizing multi-service environments with Docker Compose, and automating CI/CD workflows via GitHub Actions.

03 · Real-World Problem

Physical retail stores generate continuous visual data from cameras, yet store teams often lack structured visibility into customer footfall, dwell time, and shelf stock levels without manual auditing.

04 · Problem Statement

Build an end-to-end retail analytics system that processes images and videos to track customer movement and shelf inventory, persists time-series analytics reliably, protects API endpoints from abuse, and lets operators query insights safely using natural language.

06 · Proposed Solution

A unified monorepo separating the Next.js analytics interface from the FastAPI inference and API service. Visual inputs pass through YOLO11n and ByteTrack to extract footfall, dwell time, and shelf stock metrics into async PostgreSQL, while the query layer combines vector search and BM25 retrieval with guarded Groq LLM synthesis.

05 · Project Objectives

Core Engineering Goals

  • Detect objects on retail images and videos using YOLO11n.
  • Track individual customer trajectories across frames with ByteTrack for footfall and dwell-time analytics.
  • Monitor shelf stock status from visual inputs.
  • Persist structured analytics asynchronously in PostgreSQL using SQLAlchemy and Alembic.
  • Enforce API fairness with Redis sliding-window rate limiting.
  • Provide a hybrid RAG AI assistant (vector search + BM25) with Groq LLM fallback and prompt-injection guardrails.
  • Automate validation and delivery with a 170-test Pytest suite, Docker Compose, GitHub Actions CI/CD, and MLOps checks.
System Architecture

RetailIQ Component Topology

6 Components · 4 Flows
Client / Input

Next.js Dashboard

Analytics UI & Query Interface

API & Security

FastAPI + Redis

REST API & Sliding-Window Rate Limiter

Intelligence / Logic

YOLO11n + ByteTrack

Object Detection, Tracking & Shelf Stock

Intelligence / Logic

Hybrid RAG + Groq

Vector Search + BM25 + Guardrails

Persistence

PostgreSQL

Async SQLAlchemy + Alembic Migrations

DevOps & CI/CD

Docker & MLOps

Compose, GitHub Actions, 170 Pytest Tests

Request & Data Flows

  1. Next.js DashboardFastAPI + Redis
    Rate-limited API requests
  2. FastAPI + RedisYOLO11n + ByteTrack
    Image & video inference
  3. YOLO11n + ByteTrackPostgreSQL
    Async footfall, dwell & stock writes
  4. FastAPI + RedisHybrid RAG + Groq
    Guarded NL queries
Client requests from Next.js hit FastAPI protected by Redis sliding-window rate limiting. Computer vision tasks run YOLO11n + ByteTrack and write structured records via async SQLAlchemy + Alembic to PostgreSQL. The AI assistant executes hybrid vector + BM25 retrieval with prompt-injection guardrails and Groq LLM fallback, all orchestrated with Docker Compose and validated by GitHub Actions and MLOps drift/registry checks.
08 · Technology Stack

Tools & Frameworks

  • Next.js
  • TypeScript
  • Docker
  • Docker Compose
  • GitHub Actions
  • FastAPI
  • PostgreSQL
  • YOLO11n
  • ByteTrack
  • Redis
  • Groq
  • Pytest
09 · Implementation & Contributions

What I Built

  • Role: Frontend & DevOps Contributor (YOLO model development was handled separately).
  • Frontend Engineering: Developed the Next.js and TypeScript frontend application and integrated user-facing analytics features with backend APIs.
  • Containerization: Implemented Docker-based containerization and Docker Compose orchestration for the multi-service application.
  • CI/CD Engineering: Worked on automated development and deployment pipelines using GitHub Actions.
  • Application Integration: Connected frontend components with FastAPI and PostgreSQL backend services and supported the end-to-end application workflow.
10 · Important Features

Key Capabilities

  • Customer footfall and dwell-time analytics
  • YOLO11n object detection across images and videos
  • Multi-frame customer tracking using ByteTrack
  • Shelf stock monitoring
  • Async PostgreSQL persistence with SQLAlchemy and Alembic
  • Redis sliding-window rate limiting
  • Hybrid RAG assistant (vector search + BM25) with Groq LLM fallback
  • Prompt-injection guardrails
  • MLOps workflow (dataset validation, model registry, drift monitoring)
11 · Development Workflow

Engineering & Delivery Process

  1. 01Monorepo service composition managed locally with Docker Compose.
  2. 02Database schema evolution tracked through Alembic migrations.
  3. 03Automated verification via a 170-test Pytest suite.
  4. 04Continuous integration and deployment automated with GitHub Actions.
  5. 05MLOps lifecycle checks covering dataset validation, model registry, and drift monitoring.
12 · Technical Challenges

Hard Problems Encountered

  • Maintaining consistent customer identity across video frames to compute accurate dwell time without double-counting.
  • Preventing database bottlenecks under async inference writes while keeping schema changes reproducible.
  • Protecting the RAG assistant from prompt-injection attempts and single-retrieval blind spots.
  • Coordinating multiple services (API, database, cache, frontend) reliably across local and CI environments.
13 · Solutions

How I Solved Those Challenges

  • Paired YOLO11n detections with ByteTrack to maintain persistent tracking IDs across video frames for footfall and dwell-time calculation.
  • Used async SQLAlchemy paired with Alembic migrations for non-blocking PostgreSQL persistence and controlled schema updates.
  • Combined vector search with BM25 in a hybrid RAG pipeline, added prompt-injection guardrails, and configured Groq LLM fallback.
  • Standardized service orchestration with Docker Compose, enforced Redis sliding-window rate limiting, and backed the codebase with 170 Pytest tests in GitHub Actions.
14 · Screenshots & Visuals

System Visual Preview

Architecture and pipeline preview shown above. Live dashboard and detection frame screenshots require confirmation / asset upload.

15 · What I Learned

Engineering Takeaways

  • How to cleanly integrate a Next.js + TypeScript frontend with FastAPI and PostgreSQL services inside a multi-service monorepo.
  • Packaging multi-container applications with Docker and Docker Compose so local development and CI environments behave consistently.
  • Setting up automated GitHub Actions CI/CD pipelines to keep integration and deployment reliable across contributors.
Details Requiring Confirmation
  • • Production/staging screenshots of the Next.js analytics dashboard and annotated detection frames.
  • • Measured inference latency or dataset size metrics if you want quantitative benchmarks displayed.
Next Case Study

CinTic — Intelligent Cinema Ticket Booking System

Read Next