Production-grade Shopify embedded application for AI-powered virtual try-on and outfit recommendations. Built as a clean, scalable monorepo with independent microservices.
DigiCloset helps Shopify merchants increase AOV through:
- AI-Powered Recommendations - CLIP-based semantic product matching
- Virtual Try-On - Image-to-image inference for outfit visualization
- Smart Bundling - Automated outfit generation from product catalog
- Merchant Dashboard - Analytics, configuration, and bundle management
This is a production-ready monorepo with the following architecture:
/apps → Shopify embedded application
/shopify-app → Backend API + OAuth + billing + widget
/services → Microservices
/ai-service → Recommendation engine (CLIP embeddings, vector DB)
/inference-service → Virtual try-on via Replicate API
/queue-worker → Background job processing
/packages → Shared libraries
/database → Prisma ORM schema
/shared → Common config, types, utilities
/storage → S3/local storage adapters
/frontend → Frontend applications
/admin-dashboard → Merchant dashboard
/shopify-widget → Storefront widget UI
/infra → Infrastructure & deployment
/docker → Service Dockerfiles
/k8s → Kubernetes manifests
/ci-cd → CI/CD pipelines
For detailed architecture documentation, see ARCHITECTURE.md.
- Docker & Docker Compose
- Python 3.11+
- Node.js 18+
-
Clone and setup:
git clone <repo-url> cd digicloset cp .env.example .env
-
Start all services:
docker-compose -f docker-compose.dev.yml up
Services available at:
- Shopify App: http://localhost:8000
- AI Service: http://localhost:8001
- Inference Service: http://localhost:8002
- PostgreSQL: localhost:5432
- Redis: localhost:6379
-
Run database migrations:
cd packages/database npx prisma migrate deploy
Shopify App:
cd apps/shopify-app/backend
uvicorn main:app --port 8000 --reloadAI Service:
cd services/ai-service
uvicorn main:app --port 8001 --reloadQueue Worker:
cd services/queue-worker
python worker.pyShopify App (http://localhost:8000)
Product Analysis:
POST /api/v1/analyze- Analyze product and generate recommendationsGET /api/v1/products- List products with recommendationsPOST /api/v1/bundles- Create outfit bundle
Merchant Dashboard:
GET /api/v1/merchant/dashboard- Analytics and metricsGET /api/v1/merchant/settings- ConfigurationPOST /api/v1/merchant/settings- Update settings
Webhooks:
POST /api/v1/webhooks/shopify- Shopify webhook receiver
AI Service (http://localhost:8001)
POST /api/v1/embeddings- Generate product embeddingsPOST /api/v1/search- Semantic product searchPOST /api/v1/recommendations- Get outfit recommendations
Inference Service (http://localhost:8002)
POST /api/v1/tryon- Generate virtual try-on imageGET /api/v1/async-job/{id}- Check async job status
All services use centralized configuration from .env:
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/digicloset
# Redis
REDIS_URL=redis://localhost:6379/0
# Shopify
SHOPIFY_API_KEY=your-key
SHOPIFY_API_SECRET=your-secret
# AI Settings
CLIP_MODEL_NAME=openai/clip-vit-base-patch32
# External APIs
REPLICATE_API_TOKEN=your-tokenSee .env.example for complete configuration options.
Shopify App AI Service Inference Service Queue Worker
↓ ↓ ↓ ↓
[FastAPI] [FastAPI] [FastAPI] [RQ]
↓ ↓ ↓ ↓
±─────────────────────────────────────────────────────────┤
│ PostgreSQL Database │
│ Redis Queue │
└─────────────────────────────────────────────────────────┘
- Merchant uploads product image
- Shopify App validates and queues job
- AI Service generates CLIP embeddings
- Vector DB searches for similar products
- Results cached and returned to merchant
- Frontend displays recommendations
- Customer selects product in storefront
- Widget captures image via device camera
- Inference Service processes via Replicate
- Result cached in S3/local storage
- Widget displays try-on result
- Monorepo: Single repository, multiple independent services
- Shared Code:
/packages/sharedfor common utilities - Configuration: Centralized in
/packages/shared/config.py - Logging: Structured JSON logging via
/packages/shared/logging.py - Database: Prisma ORM with
/packages/database/schema.prisma
Service-specific code:
Add to service directory (e.g., apps/shopify-app/backend/services/)
Shared code:
Add to /packages/shared/
Imports (example):
from packages.shared.config import config
from packages.shared.logging import get_logger
from packages.shared.types import APIResponse
from packages.shared.exceptions import NotFoundError# All tests
pytest
# Service-specific
pytest apps/shopify-app/backend/tests
# With coverage
pytest --cov=apps --cov=services --cov=packages# Shopify App
docker build -f infra/docker/Dockerfile.shopify-app -t digicloset-shopify-app .
# AI Service
docker build -f infra/docker/Dockerfile.ai-service -t digicloset-ai-service .
# Inference Service
docker build -f infra/docker/Dockerfile.inference-service -t digicloset-inference-service .
# Queue Worker
docker build -f infra/docker/Dockerfile.queue-worker -t digicloset-queue-worker .- Update
.envwith production secrets - Configure PostgreSQL (managed DB recommended)
- Configure Redis (managed cache recommended)
- Set up S3 for image storage
- Configure Shopify API credentials
- Update
ALLOWED_ORIGINSfor CORS - Run database migrations
- Build and push Docker images
- Deploy to Kubernetes or container service
Manifests in /infra/k8s/:
kubectl apply -f infra/k8s/postgres-statefulset.yaml
kubectl apply -f infra/k8s/redis-deployment.yaml
kubectl apply -f infra/k8s/shopify-app-deployment.yaml
kubectl apply -f infra/k8s/ai-service-deployment.yaml
kubectl apply -f infra/k8s/inference-service-deployment.yaml
kubectl apply -f infra/k8s/queue-worker-deployment.yaml
kubectl apply -f infra/k8s/ingress.yamlSet ENVIRONMENT variable:
development- Debug mode, verbose loggingstaging- Production-like, detailed errorsproduction- Performance mode, minimal logging
All services expose:
- Health checks:
GET /health - Metrics: Prometheus format at
GET /metrics - Structured logs: JSON format with request IDs
- Error tracking: Full exception context in logs
- ARCHITECTURE.md - Detailed architecture documentation
- REFACTORING_GUIDE.md - Monorepo refactoring details
- docs/API.md - API documentation
- Follow monorepo conventions
- Add shared code to
/packages/shared - Write tests for new features
- Document API changes in
/docs/API.md - Use type hints throughout
For architecture questions, see ARCHITECTURE.md. For refactoring details, see REFACTORING_GUIDE.md.
See LICENSE
- In Shopify Partner Dashboard, create a public app and configure the app URL + redirection URL:
https://<your-domain>/api/auth/callback. - Configure required env vars (
SHOPIFY_API_KEY,SHOPIFY_API_SECRET,DATABASE_URL,REDIS_URL,REPLICATE_API_TOKEN) using.env.exampleas a template. - Deploy with Docker (
docker compose -f docker-compose.dev.yml up --build) and expose HTTPS (required by Shopify OAuth/webhooks). - Install from
/api/auth/install?shop=<shop>.myshopify.comand verify webhooks under/api/webhooks/*. - Confirm merchant dashboard endpoint
/api/merchant/dashboardand widget toggle/api/merchant/settings.
See docs/shopify-architecture.md, docs/shopify-webhooks.md, and docs/billing.md for detailed production topology.