Lunaar Vision
.NET 9

Lunaar Vision

AI Visual-Commerce Engine and Public API

Overview

Lunaar Vision is the production .NET 9 backend behind the Lunaar visual-commerce AI platform. Built as two independent Clean Architecture surfaces on a shared core, it powers both the consumer product and a developer-facing Public API that resells the same AI engine over API keys, a credit balance and an MCP tool surface. All heavy AI work runs asynchronously through a RabbitMQ pipeline with dedicated worker processes.

What It Does

It exposes ten distinct AI visual services and runs each request as an async, credit-metered job: the caller is charged, the job is queued to RabbitMQ, a worker calls the AI model and stores the result to S3, and the client is updated live over Server-Sent Events. Beyond generation, it handles authentication, subscriptions and payments, an affiliate program, rate limiting and reliable delivery, so front-ends and external developers consume finished capabilities rather than raw ML plumbing.

Tech Stack

.NET 9C#Clean ArchitectureMongoDBRedisRabbitMQAWS S3DockerAI Integrationiyzico

Key Features

Ten AI services: sketch-to-render, apparel/studio try-on and poses, jewelry and glasses try-on, product shots and variants, food visuals, image-to-3D, 3D-to-AR (GLB to USDZ) and image upscaling

Public API product that resells the engine to external developers via X-Api-Key auth, per-call credit costs and audit logging

MCP integration: a manifest-driven surface exposing 13 MCP tools that map to REST endpoints, gated by API key and credits

Credit economy with an atomic, ledgered wallet and idempotent refunds that are automatically restored when a provider call fails

Subscriptions and payments through iyzico, including saved cards, renewals, coupons/promotions and an in-house tiered-commission affiliate program

Multi-provider auth: JWT bearer plus Google OAuth on the consumer API, and a dual API-key + developer-JWT scheme on the Public API

Async generation over a RabbitMQ topic exchange with per-service consumers and live status streamed via Server-Sent Events

Per-user, multi-period rate limiting on the consumer API and per-API-key fixed-window limiting on the Public API

Technical Highlights

Clean Architecture across 19 projects on .NET 9, with API, Application, Core and Infrastructure layers for both the consumer App and the Public API on shared libraries
Dedicated worker processes (RabbitMQ messaging consumers and Hangfire scheduled jobs) deployed separately on Kubernetes
Transactional Outbox pattern with an outbox relay so committed operations are never lost when the broker is unreachable
MongoDB as the primary datastore (separate databases per surface), Redis for caching and DataProtection key persistence, S3 for generated assets
AI integration with Azure-hosted image-generation models behind a per-process concurrency gate, plus GPU inference Spaces for 3D with a keep-alive job
Hangfire recovery jobs (credit refund recovery, stuck-operation recovery, monthly credit reset, coupon sweeps) for self-healing reliability
Meta Conversions API for server-side purchase events; Serilog to Grafana Loki with correlation IDs and dependency-exercising health checks
Scalar and Swagger API documentation, MailKit email, ClosedXML XLSX exports and Polly-based resilience

Key Achievements

01

Turned a single AI engine into two products - a consumer backend and a monetized, API-key + MCP developer platform - from one shared codebase

02

Guaranteed no credit is lost on failure through idempotent refunds plus outbox delivery and scheduled refund-recovery jobs

03

Scaled long-running AI generation with an event-driven queue, per-service worker consumers and live SSE status updates

04

Shipped a full commerce layer: iyzico subscriptions and saved cards, coupons/promotions, and a tiered-commission affiliate program with payout exports

05

Operationalized the platform with separate worker processes, Kubernetes deployments, Loki logging and real readiness health checks

Impact & Results

Lunaar Vision is the engine the entire Lunaar ecosystem runs on, and the layer that makes the AI itself a sellable product through the Public API, API keys and MCP. It demonstrates end-to-end command of Clean Architecture, event-driven distributed systems, the outbox pattern, NoSQL data design and production-grade payment, auth and observability concerns.