Inspiration

The retail industry is experiencing explosive growth in digital advertising, with the retail media market projected to reach $110+ billion globally, growing at 30%+ annually. However, we noticed a critical bottleneck: advertisement creation simply cannot scale to meet this demand.

We spoke with marketing teams at retail organizations who shared their struggles:

  • 4-6 hours to create a single advertisement
  • 100% dependency on overloaded design teams
  • 30% compliance failure rate requiring multiple revisions
  • ₹2,000-5,000 cost per advertisement
  • 10x shortage during peak campaign periods (festivals, flash sales)

The math didn't add up. Modern retail businesses manage tens of thousands of SKUs across multiple channels, requiring hundreds of ads per week. Traditional design workflows couldn't possibly keep pace.

We asked ourselves: What if creating professional advertisements was as simple as having a conversation?

That question led to RetailSync AI.

What it does

RetailSync AI is an AI-powered retail media creative studio that transforms advertisement creation from a hours-long design process into a sub-5-minute conversation.

Core Features:

1. Natural Language AI Agent

  • Execute 70+ design commands through simple conversation
  • Powered by Groq LLaMA 3.3 70B for sub-500ms response times
  • Examples: "add red background", "add text SALE in white bold", "remove background from selected image", "add blue circle with shadow"

2. Professional Canvas Editor

  • Built on Fabric.js (same technology powering Canva)
  • Multi-layer composition support
  • Precision tools: grid, snap-to-grid, alignment guides
  • Standard retail ad format presets (728x90 leaderboard, 300x250 medium rectangle, etc.)

3. One-Click AI Background Removal

  • Instant product isolation using Remove.bg API
  • Saves 15-20 minutes per image vs manual editing
  • Professional-quality results

4. Integrated Stock Image Library

  • Millions of royalty-free images via Pexels API
  • Direct canvas insertion
  • Search-powered discovery

5. Multi-Format Export

  • PNG, JPEG, WebP support
  • Production-ready quality optimization
  • Instant download

The User Experience:

  1. Login with Google OAuth
  2. Upload product image
  3. Remove background with one click
  4. Chat with AI to design: "add gradient background blue to purple", "add text 50% OFF in yellow"
  5. Add stock images if needed
  6. Export in preferred format

Result: Professional advertisement in under 5 minutes instead of 4-6 hours.

How we built it

Architecture

We built RetailSync AI as a full-stack Next.js application with external AI services integration:

Client Layer (Browser)

  • Next.js 16 + React 19 + TypeScript
  • Tailwind CSS 4 + Fabric.js

API Routes (Next.js Backend)

  • /api/ai-copilot - AI Command Processing
  • /api/remove-bg - Background Removal
  • /api/auth - Google OAuth

External Services

  • Groq LLaMA 3.3 - AI Processing
  • Remove.bg - Background Removal
  • Pexels - Stock Images
  • MongoDB Atlas - Database
  • Google OAuth - Authentication

Tech Stack

Component Technology Purpose
Framework Next.js 16.1.1 Full-stack React framework with API routes
UI Library React 19.2.3 Component-based architecture
Language TypeScript 5.x Type safety and developer experience
Styling Tailwind CSS 4.x Utility-first CSS framework
Canvas Fabric.js 7.1.0 Professional canvas manipulation
AI Model Groq LLaMA 3.3 70B Ultra-fast natural language processing
Auth NextAuth.js + Google OAuth Secure authentication
Database MongoDB Atlas User data persistence
Deployment Vercel Production hosting with edge network

AI Agent Implementation

The conversational AI agent processes commands through a structured pipeline:

Step 1: Input Parsing User command received: "add red background"

Step 2: Intent Classification Groq LLaMA 3.3 identifies the action type and parameters

Step 3: Command Mapping Intent mapped to specific Fabric.js canvas operation

Step 4: Execution Canvas API called with extracted parameters

Step 5: Feedback Confirmation message returned to user

Supported Command Categories:

  • Shape Creation (circle, rectangle, star, triangle, line)
  • Text Operations (add, style, curve, gradient)
  • Background Manipulation (color, gradient, blur, image)
  • Object Transforms (flip, rotate, scale, align)
  • Visual Effects (shadow, glow, border, filter)
  • Layer Management (bring forward, send back, group)
  • Export Operations (PNG, JPEG, WebP)

Key Implementation Decisions

Why Groq LLaMA 3.3? We needed sub-second AI responses to make the conversational interface feel natural. Groq's optimized inference infrastructure delivers responses in under 500ms, making the AI feel like a real-time collaborator.

Why Fabric.js? We evaluated multiple canvas libraries. Fabric.js provided the perfect balance of professional capabilities (multi-layer support, precision tools) and developer experience (clean API, extensive documentation).

Why Next.js API Routes? Keeping backend logic in the same codebase as frontend reduced complexity. Next.js API routes gave us serverless functions with zero configuration, perfect for our AI processing and external API integrations.

Challenges we ran into

Challenge 1: AI Command Ambiguity

Problem: Natural language is inherently ambiguous. "add circle" could mean different sizes, colors, positions.

Solution: We implemented a two-tier approach:

  1. Default intelligent assumptions (medium size, black color, center position)
  2. Follow-up clarification prompts when critical parameters missing

Example:

User: "add circle"
AI: "Added black circle at center. Want to change size or color?"
User: "make it blue and bigger"
AI: "Updated to large blue circle"

Challenge 2: Canvas State Management

Problem: Fabric.js canvas objects have complex state. Syncing this with React's state management created rendering issues and performance bottlenecks.

Solution: We separated canvas state from React state:

  • Canvas operations happen directly on Fabric.js instance
  • React state only stores metadata for UI updates
  • Used refs to maintain canvas instance across re-renders

This reduced re-renders by 80% and eliminated visual glitches.

Challenge 3: Background Removal API Limits

Problem: Remove.bg free tier limited to 50 images/month. During testing, we exhausted quota quickly.

Solution:

  1. Implemented client-side image caching
  2. Added manual crop fallback option
  3. For production: subscription tier with 500 images/month

Challenge 4: Real-time AI Response Performance

Problem: Initial implementation using GPT-3.5 had 2-3 second latency, breaking the conversational flow.

Solution: Switched to Groq's LLaMA 3.3 infrastructure:

  • Response time dropped from 2-3s to under 500ms
  • Maintained quality while gaining 6x speed improvement
  • Cost per request reduced by 40%

Challenge 5: Export Quality Optimization

Problem: High-resolution canvas exports created 5-10MB files, too large for web use.

Solution: Implemented smart compression:

// Quality optimization based on format
const qualityMap = {
  'png': 0.95,  // Lossless priority
  'jpeg': 0.85, // Balanced
  'webp': 0.90  // Best compression
}

Result: 70% file size reduction with no visible quality loss.

Accomplishments that we're proud of

1. Sub-500ms AI Response Time

We achieved real-time conversational design. The AI responds faster than most humans can type, making the interface feel natural and fluid.

2. 70+ Executable Commands

Our AI agent understands a comprehensive design vocabulary. From basic shapes to complex gradients, it handles professional design operations through natural language.

3. Production-Ready Architecture

This isn't a hackathon prototype that breaks in production. We built on enterprise-grade technologies:

  • Next.js for scalability
  • MongoDB Atlas for reliability
  • Vercel for global edge deployment
  • TypeScript for maintainability

4. Measurable Business Impact

We didn't just build cool technology. We solved a real problem with quantifiable results:

Metric Before After Improvement
Time per Ad 4-6 hours under 5 minutes 95% reduction
Cost per Ad ₹2,000-5,000 ₹200-500 90% reduction
Designer Required Always Never 100% elimination
Weekly Capacity 50 ads 500+ ads 10x increase

5. Accessible Professional Design

We democratized design. Marketing teams, store managers, campaign coordinators - anyone can now create professional advertisements without design skills or expensive software.

What we learned

Technical Learnings

1. AI Response Speed Matters More Than Accuracy

We initially optimized for AI accuracy, using larger models with extensive prompts. But user testing revealed: people prefer a fast, 90% accurate response over a slow, 95% accurate one. Speed creates the illusion of intelligence.

2. Canvas Libraries Are Complex

Fabric.js documentation looked simple. Reality was different. We spent 40+ hours understanding object hierarchies, event systems, and rendering pipelines. Key learning: always build a proof-of-concept before committing to a library.

3. API Rate Limits Are Real

We learned this the hard way when Remove.bg blocked us mid-demo. Now we always:

  • Check rate limits before integration
  • Implement caching strategies
  • Build fallback options

4. TypeScript Saves Time

Initially, TypeScript felt like overhead. But as the codebase grew, it caught bugs before runtime:

  • 60+ type errors caught during development
  • Refactoring became 3x faster with type safety
  • Onboarding new team members easier with explicit contracts

Product Learnings

1. Users Don't Read Documentation

We built comprehensive command documentation. Users ignored it. They just started typing what they wanted. Learning: make the AI smart enough to handle uninformed users.

2. Defaults Matter

When we added "add circle", users got frustrated with tiny black circles. When we changed defaults to medium-sized, colorful circles, satisfaction improved. People want reasonable defaults, not perfect customization.

3. Visual Feedback Is Critical

Adding loading spinners increased perceived performance by 40% even though actual speed didn't change. Users need to know the system is working.

Team Learnings

1. Divide and Conquer

We split into specialized tracks:

  • AI integration (1 person)
  • Canvas editor (1 person)
  • UI/UX (1 person)
  • Backend/Auth (1 person)

Parallelization let us build in 3 weeks what would've taken 3 months sequentially.

2. Daily Standups Save Time

15-minute daily syncs prevented duplicate work and caught integration issues early. Time saved: ~20 hours over the project.

3. Version Control Discipline

We enforced strict Git practices:

  • Feature branches only
  • Pull request reviews required
  • No direct commits to main

Result: Zero merge conflicts, clean commit history.

What's next for RetailSync AI

Phase 1: Template Marketplace (Next 3 Months)

Goal: Reduce creation time from 5 minutes to 30 seconds for common ad types.

Features:

  • Pre-built templates for seasonal campaigns (Diwali, Christmas, Black Friday)
  • Industry-specific templates (grocery, electronics, fashion)
  • One-click customization with product swap
  • Community template sharing

Impact: Handle 80% of use cases with zero design effort.

Phase 2: Team Collaboration (Months 3-6)

Goal: Enable marketing teams to work together on campaigns.

Features:

  • Real-time collaborative editing (like Figma)
  • Comment and feedback system
  • Version history with rollback
  • Approval workflows for brand compliance
  • Asset libraries shared across team

Impact: Eliminate revision cycles, ensure brand consistency.

Phase 3: Brand Intelligence (Months 6-9)

Goal: Automated brand compliance and style consistency.

Features:

  • Brand guideline upload (colors, fonts, logos)
  • Automatic compliance scoring before export
  • Style transfer from existing ads
  • Competitor analysis and benchmarking

Impact: 98%+ compliance rate, zero manual reviews.

Phase 4: Bulk Generation (Months 9-12)

Goal: Generate hundreds of ad variations automatically.

Features:

  • CSV product data import
  • Automated ad generation for entire catalog
  • A/B variant creation (test 5 versions automatically)
  • Dynamic text and image insertion
  • Batch export in multiple formats

Impact: Create 500 ads in 10 minutes instead of 500 hours.

Phase 5: Performance Analytics (Year 2)

Goal: Close the loop with performance data.

Features:

  • Integration with ad platforms (Google Ads, Facebook Ads)
  • Click-through rate tracking
  • Conversion attribution
  • AI-powered creative optimization suggestions
  • Automated A/B testing with performance feedback

Impact: Not just create ads, but create ads that perform.

Phase 6: Personalization Engine (Year 2+)

Goal: Generate personalized ads at scale.

Features:

  • Customer segment integration
  • Dynamic ad generation based on user preferences
  • Location-based customization
  • Real-time inventory sync
  • Personalized offer generation

Impact: Every customer sees ads tailored to their interests.

Long-term Vision

RetailSync AI becomes the operating system for retail media:

  • From idea to published ad in under 60 seconds
  • Zero design skills required
  • Perfect brand compliance guaranteed
  • Performance-optimized creative automatically
  • Infinite scale at near-zero marginal cost

We're not just building a design tool. We're building the future of retail advertising.


RetailSync AI - Create ads in minutes, not days.

Built With

Share this project:

Updates