Overview
Grmpt is a credit-based SaaS for AI-powered fashion design, live at grmpt.com. Users generate garment designs from text, sketches, or reference images; create custom AI fashion models with controllable age, build, skin tone, and nationality; composite virtual try-ons with CV-placed accessories; and animate results into cinematic 1080p video.
I own every layer: a fully async FastAPI backend (SQLAlchemy 2.0 + asyncpg on PostgreSQL), a Next.js 16 static frontend, Stripe subscription billing with mid-cycle proration, and a push-to-deploy AWS CodePipeline that runs the test suite as a hard gate before shipping containers to EC2.
Full stack
- Next.js 16 (App Router, static export)
- React 19 · TypeScript · Tailwind CSS v4
- TanStack Query · Zustand · Framer Motion
- FastAPI · Python 3.11 · Pydantic v2
- SQLAlchemy 2.0 async + asyncpg · PostgreSQL (RDS)
- Stripe Checkout + Billing Portal + webhooks
- Gemini · OpenAI gpt-image · Kling 3.0 · Tripo3D
- MediaPipe · rembg/U2NET · OpenCV · ffmpeg
- AWS CodePipeline/CodeBuild/CodeDeploy · ECR · EC2 · S3
- nginx · Sentry · SlowAPI rate limiting · pytest



Engineering highlights
The parts a code review would find interesting.
01Race-free credit ledger
Credits are deducted with a conditional atomic UPDATE … WHERE credits >= cost RETURNING, backed by an immutable transaction audit table recording balance_after for every movement, a DB-level CHECK constraint, and a partial unique index on the Stripe reference that makes webhook credit grants idempotent under retries. When a 5× video-overcharge bug appeared, the ledger made it possible to quantify and refund every affected user precisely.
02Every failure path refunds
Provider safety-filter rejections, task failures, watermarking errors, and S3 upload errors each trigger an automatic credit refund with a typed transaction — backed by a distinct exception taxonomy (content-filtered vs. task-failed) mapped to correct HTTP codes.
03Multi-provider AI routing
Each feature routes to the model that does it best — Gemini image models for design generation, OpenAI gpt-image for model and try-on rendering, Gemini vision for garment analysis, Kling 3.0 for video — switchable per feature with a one-line change. Kling auth runs on per-request HS256 JWTs with monotonic-clock polling deadlines.
04CV pipeline for accessory placement
Earrings, necklaces, and bracelets are composited via MediaPipe face/pose landmarks with px-per-cm size estimation, plus rembg/U2NET background removal — a ~470 MB model stack lazy-loaded on first use.
05Billing correctness as engineering
Signature-verified Stripe webhooks routed by billing_reason, prorated credit grants on mid-cycle upgrades, and a documented audit that eliminated duplicate-webhook double-grants. Defense in depth elsewhere: Firebase token middleware, per-user S3 key prefixes, tiered rate limits, presigned URLs.
06CI/CD with a real quality gate
Push-to-deploy AWS CodePipeline builds the static frontend and a non-root multi-stage Docker image, runs 42 pytest tests as a build gate, and deploys via CodeDeploy — with a separate basic-auth dev environment running its own pipeline off the dev branch.