The global cosmetics industry is worth over $500 billion, but most independent beauty brands and small founders have no real way into the formulation process. If you wanted to create a face serum from scratch, you either hired a cosmetic chemist (expensive) or copied a competitor's ingredient list and hoped for the best. We kept thinking: what if a founder could just describe what they wanted, and an AI would actually engineer the formula for them? What made this more interesting to us was that cosmetic formulation is not just a "prompt an AI" kind of problem. It is a constrained optimization problem. Every formula has to sum to exactly 100%, stay within regulatory concentration limits, avoid ingredient conflicts, and balance cost against performance. That is a math problem as much as it is a chemistry problem, and that combination is what pushed us to build something more than a chatbot. FormulaForge is a full-stack AI-powered cosmetic formulation platform. The core of it is a self-improving agentic pipeline that mirrors what a senior cosmetic chemist would actually do, step by step: Idea → Parse → Optimize → Explain → Evaluate → Re-Optimize → Compare → Present. Amazon Nova Pro reads the user's natural language goal, or an uploaded product label image, and extracts structured ingredient data including names, concentration ranges, cost per gram, efficacy scores, and category classifications. A custom linear programming solver built with PuLP then maximizes the formula's weighted efficacy score subject to hard constraints: concentrations must sum to exactly 100%, every ingredient must stay within its allowed min/max range, and total cost must stay within budget. Nova Pro writes a scientific breakdown of why each ingredient was selected, then critiques its own formula and suggests constraint adjustments. The solver runs again with updated bounds to produce a stronger v2 formula, and a side-by-side delta analysis shows exactly what changed and why. Finally, a branded deck is generated via Node.js, with an AI-generated product image from Amazon Nova Canvas and a 360-degree turntable video from Amazon Nova Reel. The feature we are most proud of is a real-time WebSocket video call with "Dr. Veda," an AI aesthetic consultant built on Amazon Nova Lite's multimodal vision. The user streams webcam frames to the server, Nova analyzes distinct facial zones in real time, and responds with voice through Amazon Polly. The scan results then auto-populate the formulation prompt so the final formula is personalized to what was actually detected on the user's skin. The platform also includes a Competitive Teardown module where uploading a competitor's product label lets Nova extract their ingredient list and write a comparative analysis. A Campaign Studio generates Instagram captions, TikTok scripts, and product slogans in a Vogue editorial tone. A Clinical Analysis module has Nova Pro act as a dual expert combining the perspective of a dermatotoxicologist and an IP lawyer to evaluate safety and patentability. A Manufacturing Outreach module drafts professional B2B emails to cosmetic labs, and a Product Recommendations module personalizes skincare results based on the skin scan. The entire stack uses zero OpenAI dependencies, with every AI capability running on Amazon Nova across Bedrock, Polly, and S3. The hardest problem we faced was LP infeasibility. The solver kept returning "Infeasible" whenever Nova set contradictory constraints, like overlapping min/max bounds or a budget tighter than the minimum possible formula cost. We built a five-strategy self-healing repair system that progressively relaxes constraints until a feasible solution can be found. Nova's safety filter was another challenge, as it would sometimes interpret a cosmetic question like "how do I fix my acne?" as a self-harm signal and refuse to respond. We fixed this by wrapping all user prompts with explicit skincare context and adding a CRITICAL CONTEXT block to the system prompt. The real-time video pipeline also required careful async architecture using run_in_executor to avoid blocking FastAPI's event loop. And since Nova Reel works asynchronously with processing times up to five minutes, we implemented a polling loop with exponential backoff and a graceful fallback to Nova Canvas frame-stitching when Reel is unavailable. Nova's multimodal capabilities genuinely surprised us. Analyzing facial skin conditions from a live webcam frame with clinically relevant detail was better than we expected. We learned that agentic loops need exit conditions, because without a convergence check the evaluate and re-optimize loop would cycle forever. Prompt engineering for structured JSON output, including fallbacks for when the model returns prose, turned out to be just as important as anything the model itself does. The biggest architectural lesson was that linear programming and large language models are a genuinely powerful combination: the LLM handles ambiguity and domain knowledge, while the solver guarantees mathematical correctness. Neither one alone would have been enough.

Built With

  • amazon-bedrock
  • amazon-nova-canvas-(amazon.nova-canvas-v1:0)
  • amazon-nova-lite-(amazon.nova-lite-v1:0)
  • amazon-nova-reel-(amazon.nova-reel-v1:0)
  • amazon-polly
  • amazon-web-services
  • aws-boto3-pulp-(linear-programming-solver)
  • css3
  • docker-amazon-nova-pro-(amazon.nova-pro-v1:0)
  • fastapi
  • html5
  • imageio
  • javascript
  • node.js
  • numpy
  • pillow
  • pptxgenjs
  • python
  • rich-render-(cloud-deployment)
  • server-sent-events-(sse)
  • speech
  • uvicorn
  • web
  • websockets
Share this project:

Updates