Skip to content
Getting Started & Architecture

System Architecture & Serverless Pipeline

High-throughput architecture connecting Next.js 15, Neon PostgreSQL pgvector, and Azure Functions v4.

Architectural Principles

BestShots.AI is engineered to handle shoots of 5,000+ camera RAW frames without introducing client browser stutter or exhausting cloud function timeouts. To achieve this performance, the platform separates user-facing interaction from heavy computer vision workloads using an asynchronous, event-driven topology.


High-Level Topology

The system comprises four primary layers:

  1. Client Tier (Next.js 15 App Router): Delivers 0ms optimistic UI updates via TanStack Query and Zustand. Handles client-side EXIF parsing and communicates directly with cloud storage.
  2. Database Tier (Neon PostgreSQL with pgvector): Houses relational project metadata, audit logs, and 512-dimensional biometric embeddings. Connected via pooled and unpooled connection strings.
  3. Storage Tier (Microsoft Azure Blob Storage): Stores original camera RAW payloads, compressed WebP proxies, and cropped face avatars behind secure Shared Access Signature (SAS) tokens.
  4. Compute Tier (Azure Functions v4): Executes background image processing, ONNX Runtime SCRFD/ArcFace facial detection, perceptual difference hashing, and OpenAI Foundry GPT-5-mini evaluation.

Asynchronous Queue Pipeline

When an analysis job is requested, work items are enqueued to Azure Queue Storage:

Queue NamePrimary ResponsibilitySLA Target
project-clustering-queuePerceptual dHash calculation, 5-second burst sequence grouping, and Hero election.< 15 seconds per 500 photos
photo-analysis-queueMultimodal GPT-5-mini evaluation, eye-blink scoring, and sharpness assessment.Concurrently dispatched

Workers scale horizontally to process batches in parallel, updating the database status from INITIATING to PROCESSING and finally COMPLETED.


0ms Latency Guarantees

Every rating, tag, and culling decision made by a photographer reflects immediately in the browser via TanStack Query optimistic mutations. The user never waits on HTTP round-trip latency to advance to the next frame. If a network interruption occurs, the client automatically rolls back to the verified server snapshot with an informative toast notice.