diff --git a/.gitignore b/.gitignore index 92cc096..ad03605 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,7 @@ -# Logs -logs -*.log -npm-debug.log* +# Vault is symlinked, not owned by this workspace +vault/ node_modules/ -.env -.env.development.local -.env.test.local -.env.production.local -.env.local -.next -out -dist -coverage +.DS_Store *.sqlite *.db -.DS_Store Thumbs.db -vault/ -.openclaw/ -memory/ diff --git a/README.md b/README.md deleted file mode 100644 index 76f4e59..0000000 --- a/README.md +++ /dev/null @@ -1,165 +0,0 @@ -# WardrobeAI - -> Clothes from real designers. Picked for you. On your budget. - -WardrobeAI is a curated clothing subscription service that sources from small businesses and boutique brands. We learn your personal style through a real conversation (not a multiple-choice quiz), match pieces within your monthly budget, and get better with every box based on your feedback. - -## The Problem We're Solving - -**For customers:** -- Shopping is overwhelming — thousands of options, no curation -- Small designers are hard to find (buried on Etsy, hard to discover on Instagram) -- Mass-market subscriptions feel generic — same brands everyone else wears -- "Style quizzes" don't capture the nuances of your body and life -- The feedback you give doesn't seem to change what you get - -**For small designers:** -- Hard to reach customers without massive ad budgets -- Wholesale buyers require large minimum orders -- No direct feedback on why items don't sell - -## Our Approach - -| What Others Do | What We Do | -|---|---| -| Source from mass-market brands (Stitch Fix, Nordstrom) | Source from small businesses and boutique designers first | -| Per-item pricing ($40-80 per piece) | Monthly budget you choose ($100 or $250) | -| Multiple-choice style quiz | Real conversation — style interview with a human feel | -| "Style Shuffle" that never learns | Structured feedback loop that actually improves | -| One-size-fits-all | "Invariants" — your hard lines, honored (no florals, no synthetics, etc.) | -| Off-the-rack only | AI design-on-demand: "I want this shape in that fabric" — custom made | - -## Product Tiers - -### Essential — $100/mo -- 3-5 clothing items per month -- From small businesses and boutique brands -- Style interview and feedback loop included -- Shoes, bags, jewelry available as add-ons - -### Signature — $250/mo -- 4-8 clothing items per month -- Higher-end boutique brands -- Early access to new designers -- Concierge-level style interview - -### Custom — Variable -- You set the budget -- You choose the components (clothing only, or full wardrobe) -- Custom frequency (monthly, quarterly, etc.) -- Priority access to AI design-on-demand - -## Market Opportunity - -- **$7 billion** global fashion subscription market -- Growing at **6.1% CAGR** (2025-2034) -- No incumbent dominates the "small business boutique" niche -- Stitch Fix is mass market; Rent the Runway is rental; no one is budget-capped with boutique curation - -## Competitive Landscape - -| Company | Model | Our Differentiation | -|---|---|---| -| **Stitch Fix** ($1.6B market cap) | AI + human stylist, mass brands | We source from small businesses; we have budget caps | -| **Wantable** | Curated edits, $20 styling fee | We have a real conversation, not a quiz; our feedback loop learns | -| **DailyLook** | Premium styling, $40 styling fee | We start at $100/mo, not premium; we honor hard constraints | -| **Dia & Co** | Plus size niche | We're size-inclusive but not niche-restricted | -| **Rent the Runway** | Rental subscription | We sell, not rent; you keep what you love | - -**The niche we own:** Small business curation with budget caps and real learning. - -## Technology Stack - -- **Frontend:** Next.js (React), Tailwind CSS, mobile-first -- **Backend:** Node.js or Python (FastAPI), PostgreSQL + Redis -- **AI/ML:** Python service for curation; LLM integration for style interview and invariants parsing -- **Payments:** Stripe (subscription billing) -- **Hosting:** Vercel (frontend) + Railway/Fly.io (backend) -- **Analytics:** Umami (self-hosted, already deployed) -- **Infrastructure:** Storj for static assets, potential 3PL for warehousing (Phase 2) - -## Repository Structure - -``` -wardrobe-ai/ -├── brand/ # Brand identity, positioning, customer personas -├── business/ # Pricing, financial model, vendor targets, roadmap -├── engineering/ # Architecture, curation engine, tech docs -├── legal/ # Compliance, terms, policies -├── marketing/ # Social strategy, content calendar, viral playbook -├── operations/ # Return logistics, shipping, warehouse transition -├── product/ # Style interview, feedback system, invariants, landing page -├── research/ # Competitive analysis, market data -└── site/ # Landing page source (Astro SSG) -``` - -## Roadmap - -### Phase 0: Foundation (Months 1-2) -- Brand identity finalized -- 10-20 customer discovery interviews -- 5-10 vendor partners identified -- Landing page + waitlist live -- Legal structure + insurance - -**Goal:** 50+ waitlist signups, 3+ vendor commitments - -### Phase 1: MVP (Months 3-5) -- 20 founding customers (friends, family, early signups) -- Essential tier only ($100/mo) -- Manual curation with AI assistance -- Web app: style interview + feedback -- Manual returns processing - -**Goal:** 60%+ keep rate, NPS 40+ - -### Phase 2: Growth (Months 6-9) -- Signature tier launch ($250/mo) -- AI curation engine v2 -- TikTok + Instagram content machine -- Referral program -- 100 subscribers - -**Goal:** 65%+ keep rate, 10%+ MoM organic growth - -### Phase 3: Scale (Months 10-18) -- 500+ subscribers -- AI design-on-demand pilot -- Warehousing or 3PL transition -- 30+ active vendors -- Mobile app - -**Goal:** 70%+ keep rate, positive unit economics - -### Phase 4: Expansion (Months 18-36) -- 2000+ subscribers -- Men's clothing vertical -- Plus-size specialization -- AI design-on-demand full launch -- Potential Series A or profitable bootstrapping - -## Issues & Project Management - -All work is tracked via [Forgejo Issues](https://os.scoble.me/forgejo/sscoble/wardrobe-ai/issues). - -**Labels:** -- `market` — Market research, competitive analysis, customer personas -- `feature` — Product features and design -- `engineering` — Technical implementation and architecture -- `business` — Pricing, financials, vendor partnerships -- `legal` — Compliance, terms, policies -- `improvement` — Documentation and process improvements - -## Why This Matters - -Fashion is personal. It's how we present ourselves to the world. But the current options are either overwhelming (do-it-yourself shopping) or generic (mass-market subscriptions). - -We believe there's a middle path: curated discovery from real designers, within a budget that makes sense, with a system that actually learns what works for *you*. - -Supporting small businesses while helping people feel like themselves. That's WardrobeAI. - ---- - -*Work in progress. Phase 0 — validating demand and building the foundation.* - -Commit signing enabled: Sat May 2 12:47:38 PM PDT 2026 diff --git a/wardrobe-ai/backend/package-lock.json b/wardrobe-ai/backend/package-lock.json index a1f5090..6ebb80b 100644 --- a/wardrobe-ai/backend/package-lock.json +++ b/wardrobe-ai/backend/package-lock.json @@ -9,7 +9,6 @@ "version": "0.1.0", "dependencies": { "express": "^4.18.2", - "joi": "^18.1.2", "sqlite3": "^5.1.6" } }, @@ -20,54 +19,6 @@ "license": "MIT", "optional": true }, - "node_modules/@hapi/address": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@hapi/address/-/address-5.1.1.tgz", - "integrity": "sha512-A+po2d/dVoY7cYajycYI43ZbYMXukuopIsqCjh5QzsBCipDtdofHntljDlpccMjIfTy6UOkg+5KPriwYch2bXA==", - "license": "BSD-3-Clause", - "dependencies": { - "@hapi/hoek": "^11.0.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@hapi/formula": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-3.0.2.tgz", - "integrity": "sha512-hY5YPNXzw1He7s0iqkRQi+uMGh383CGdyyIGYtB+W5N3KHPXoqychklvHhKCC9M3Xtv0OCs/IHw+r4dcHtBYWw==", - "license": "BSD-3-Clause" - }, - "node_modules/@hapi/hoek": { - "version": "11.0.7", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-11.0.7.tgz", - "integrity": "sha512-HV5undWkKzcB4RZUusqOpcgxOaq6VOAH7zhhIr2g3G8NF/MlFO75SjOr2NfuSx0Mh40+1FqCkagKLJRykUWoFQ==", - "license": "BSD-3-Clause" - }, - "node_modules/@hapi/pinpoint": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.1.tgz", - "integrity": "sha512-EKQmr16tM8s16vTT3cA5L0kZZcTMU5DUOZTuvpnY738m+jyP3JIUj+Mm1xc1rsLkGBQ/gVnfKYPwOmPg1tUR4Q==", - "license": "BSD-3-Clause" - }, - "node_modules/@hapi/tlds": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@hapi/tlds/-/tlds-1.1.6.tgz", - "integrity": "sha512-xdi7A/4NZokvV0ewovme3aUO5kQhW9pQ2YD1hRqZGhhSi5rBv4usHYidVocXSi9eihYsznZxLtAiEYYUL6VBGw==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@hapi/topo": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-6.0.2.tgz", - "integrity": "sha512-KR3rD5inZbGMrHmgPxsJ9dbi6zEK+C3ZwUwTa+eMwWLz7oijWUTWD2pMSNNYJAU6Qq+65NkxXjqHr/7LM2Xkqg==", - "license": "BSD-3-Clause", - "dependencies": { - "@hapi/hoek": "^11.0.2" - } - }, "node_modules/@npmcli/fs": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", @@ -94,12 +45,6 @@ "node": ">=10" } }, - "node_modules/@standard-schema/spec": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", - "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", - "license": "MIT" - }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -1208,24 +1153,6 @@ "license": "ISC", "optional": true }, - "node_modules/joi": { - "version": "18.1.2", - "resolved": "https://registry.npmjs.org/joi/-/joi-18.1.2.tgz", - "integrity": "sha512-rF5MAmps5esSlhCA+N1b6IYHDw9j/btzGaqfgie522jS02Ju/HXBxamlXVlKEHAxoMKQL77HWI8jlqWsFuekZA==", - "license": "BSD-3-Clause", - "dependencies": { - "@hapi/address": "^5.1.1", - "@hapi/formula": "^3.0.2", - "@hapi/hoek": "^11.0.7", - "@hapi/pinpoint": "^2.0.1", - "@hapi/tlds": "^1.1.1", - "@hapi/topo": "^6.0.2", - "@standard-schema/spec": "^1.1.0" - }, - "engines": { - "node": ">= 20" - } - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", diff --git a/wardrobe-ai/backend/package.json b/wardrobe-ai/backend/package.json index f40e44a..cc830e2 100644 --- a/wardrobe-ai/backend/package.json +++ b/wardrobe-ai/backend/package.json @@ -10,7 +10,6 @@ }, "dependencies": { "express": "^4.18.2", - "joi": "^18.1.2", "sqlite3": "^5.1.6" } } diff --git a/wardrobe-ai/backend/server.js b/wardrobe-ai/backend/server.js index e86cc9a..4f790d4 100644 --- a/wardrobe-ai/backend/server.js +++ b/wardrobe-ai/backend/server.js @@ -1,17 +1,15 @@ const express = require('express'); const sqlite3 = require('sqlite3').verbose(); const path = require('path'); -const crypto = require('crypto'); -const { sanitizeBody, validate } = require('./src/middleware/validation'); // Amazon Affiliate Configuration const AFFILIATE_ID = process.env.AMAZON_ASSOCIATE_ID || 'greybeardhold-20'; const app = express(); +const PORT = process.env.PORT || 3001; // Middleware app.use(express.json()); -app.use(sanitizeBody); app.use(express.static(path.join(__dirname, '../frontend/public'))); app.use((req, res, next) => { const allowedOrigins = ['http://localhost:3000', 'https://wardrobe.scoble.me']; @@ -45,8 +43,6 @@ db.serialize(() => { CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT UNIQUE NOT NULL, - password_hash TEXT, - password_salt TEXT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP ) `); @@ -101,89 +97,15 @@ db.serialize(() => { FOREIGN KEY (product_id) REFERENCES products(id) ) `); - // Auth tokens table - db.run(` - CREATE TABLE IF NOT EXISTS auth_tokens ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - user_id INTEGER NOT NULL, - token TEXT UNIQUE NOT NULL, - created_at DATETIME DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (user_id) REFERENCES users(id) - ) - `); }); -// ─── Auth helpers ─── -const generateToken = () => crypto.randomBytes(32).toString('hex'); - -const authenticate = (req, res, next) => { - const token = req.headers.authorization?.replace('Bearer ', ''); - if (!token) return res.status(401).json({ error: 'Authentication required' }); - - db.get('SELECT user_id FROM auth_tokens WHERE token = ?', [token], (err, row) => { - if (err || !row) return res.status(401).json({ error: 'Invalid or expired token' }); - req.userId = row.user_id; - next(); - }); -}; - -// ─── Routes ─── +// Routes // Health check app.get('/api/health', (req, res) => { res.json({ status: 'ok', timestamp: new Date().toISOString() }); }); -// Signup -app.post('/api/auth/signup', (req, res) => { - const { email, password } = req.body; - if (!email || !password) return res.status(400).json({ error: 'Email and password required' }); - if (password.length < 8) return res.status(400).json({ error: 'Password must be at least 8 characters' }); - - const salt = crypto.randomBytes(16).toString('hex'); - const hash = crypto.pbkdf2Sync(password, salt, 100000, 64, 'sha512').toString('hex'); - - db.run('INSERT INTO users (email, password_hash, password_salt) VALUES (?, ?, ?)', [email, hash, salt], function(err) { - if (err) { - if (err.message?.includes('UNIQUE')) return res.status(409).json({ error: 'Email already registered' }); - return res.status(500).json({ error: 'Database error' }); - } - const token = generateToken(); - db.run('INSERT INTO auth_tokens (user_id, token) VALUES (?, ?)', [this.lastID, token], (err) => { - if (err) return res.status(500).json({ error: 'Database error' }); - res.status(201).json({ userId: this.lastID, token }); - }); - }); -}); - -// Login -app.post('/api/auth/login', (req, res) => { - const { email, password } = req.body; - if (!email || !password) return res.status(400).json({ error: 'Email and password required' }); - - db.get('SELECT * FROM users WHERE email = ?', [email], (err, user) => { - if (err || !user) return res.status(401).json({ error: 'Invalid email or password' }); - - const hash = crypto.pbkdf2Sync(password, user.password_salt, 100000, 64, 'sha512').toString('hex'); - if (hash !== user.password_hash) return res.status(401).json({ error: 'Invalid email or password' }); - - const token = generateToken(); - db.run('INSERT INTO auth_tokens (user_id, token) VALUES (?, ?)', [user.id, token], (err) => { - if (err) return res.status(500).json({ error: 'Database error' }); - res.json({ userId: user.id, token }); - }); - }); -}); - -// Logout -app.post('/api/auth/logout', authenticate, (req, res) => { - const token = req.headers.authorization?.replace('Bearer ', ''); - db.run('DELETE FROM auth_tokens WHERE token = ?', [token], (err) => { - if (err) return res.status(500).json({ error: 'Database error' }); - res.json({ success: true }); - }); -}); - // Get all products app.get('/api/products', (req, res) => { db.all('SELECT * FROM products', [], (err, rows) => { @@ -207,7 +129,7 @@ app.get('/api/products/category/:category', (req, res) => { }); // Create user -app.post('/api/users', validate(require('./src/middleware/validation').schemas.user), (req, res) => { +app.post('/api/users', (req, res) => { const { email } = req.body; db.run('INSERT INTO users (email) VALUES (?)', [email], function(err) { @@ -220,7 +142,7 @@ app.post('/api/users', validate(require('./src/middleware/validation').schemas.u }); // Create style profile -app.post('/api/profiles', validate(require('./src/middleware/validation').schemas.profile), (req, res) => { +app.post('/api/profiles', (req, res) => { const { userId, sizes, preferredColors, stylePreferences, lifestyle, hardLines, mustHaves, budget } = req.body; db.run( @@ -236,12 +158,8 @@ app.post('/api/profiles', validate(require('./src/middleware/validation').schema ); }); -// Get style profile by user ID (auth required) -app.get('/api/profile/:userId', authenticate, (req, res) => { - // Only allow fetching your own profile - if (parseInt(req.params.userId) !== req.userId) { - return res.status(403).json({ error: 'Access denied' }); - } +// Get style profile by user ID +app.get('/api/profile/:userId', (req, res) => { db.get( 'SELECT * FROM style_profiles WHERE user_id = ? ORDER BY created_at DESC LIMIT 1', [req.params.userId], @@ -266,8 +184,8 @@ app.get('/api/profile/:userId', authenticate, (req, res) => { ); }); -// Generate curated box (auth required) -app.post('/api/box', authenticate, validate(require('./src/middleware/validation').schemas.box), (req, res) => { +// Generate curated box +app.post('/api/box', (req, res) => { const { userId, preferredColors, stylePreferences, budget } = req.body; // Validate and default stylePreferences to empty array @@ -285,122 +203,72 @@ app.post('/api/box', authenticate, validate(require('./src/middleware/validation const hardLines = JSON.parse(profile?.hard_lines || '[]'); - // Get feedback to tune weights - db.all( - 'SELECT * FROM feedback WHERE user_id = ?', - [userId], - (err, feedbackRows) => { - if (err) { - console.error('Error fetching feedback:', err); - return res.status(500).json({ error: 'Database error' }); - } - - // Default v1 weights - const defaultWeights = { colorMatch: 25, styleMatch: 35, sizeFit: 20, priceFit: 20 }; - - // If enough feedback, tune weights based on what predicts "would keep" - let weights = defaultWeights; - if (feedbackRows.length >= 10) { - const kept = feedbackRows.filter(f => f.would_keep === 1); - const notKept = feedbackRows.filter(f => f.would_keep === 0 || f.would_keep === null); - - if (kept.length > 0 && notKept.length > 0) { - const avgRating = (rows, field) => rows.reduce((sum, r) => sum + (r[field] || 3), 0) / rows.length; - - const keptColor = avgRating(kept, 'color_rating'); - const notKeptColor = avgRating(notKept, 'color_rating'); - const keptStyle = avgRating(kept, 'style_rating'); - const notKeptStyle = avgRating(notKept, 'style_rating'); - const keptFit = avgRating(kept, 'fit_rating'); - const notKeptFit = avgRating(notKept, 'fit_rating'); - - // Positive delta = this factor predicts keeping - const deltas = { - color: Math.max(0, keptColor - notKeptColor), - style: Math.max(0, keptStyle - notKeptStyle), - fit: Math.max(0, keptFit - notKeptFit) - }; - - const totalDelta = deltas.color + deltas.style + deltas.fit || 0.01; - const learningRate = Math.min(0.5, feedbackRows.length / 50); - - // Blend: retain 80% of defaults, shift 20% toward feedback signals (max 50% shift) - const blend = (def, signal) => Math.round(def * (1 - learningRate) + (signal / totalDelta) * 80 * learningRate); - - weights = { - colorMatch: blend(defaultWeights.colorMatch, deltas.color), - styleMatch: blend(defaultWeights.styleMatch, deltas.style), - sizeFit: blend(defaultWeights.sizeFit, deltas.fit), - priceFit: Math.round(defaultWeights.priceFit * (1 - learningRate) + 20 * learningRate) - }; - } - } - - // Get all products - db.all('SELECT * FROM products', [], (err, products) => { - if (err) { - console.error('Error fetching products:', err); - return res.status(500).json({ error: 'Database error' }); - } - - // Score and filter products using tuned weights - const scoredProducts = products - .map(product => { - let score = 0; - - // Color match - if (preferredColors.includes(product.color)) { - score += weights.colorMatch; - } - - // Style match - if (styles.length > 0) { - let productStyleTags = JSON.parse(product.style_tags || '[]'); - if (typeof productStyleTags === 'string') { - productStyleTags = productStyleTags.split(',').map(s => s.trim()); - } - const matchingStyles = styles.filter(style => - productStyleTags.some(tag => tag.toLowerCase().includes(style.toLowerCase())) - ); - if (matchingStyles.length > 0) { - score += weights.styleMatch; - } - } - - // Price fit - if (product.price <= budget) { - score += weights.priceFit; - } - - return { ...product, score, weights }; - }) - .filter(product => { - // Filter out hard lines - const productStyleTags = JSON.parse(product.style_tags || '[]'); - return !hardLines.some(hardLine => - productStyleTags.some(tag => tag.toLowerCase().includes(hardLine.toLowerCase())) || - product.title.toLowerCase().includes(hardLine.toLowerCase()) || - product.brand.toLowerCase().includes(hardLine.toLowerCase()) - ); - }) - .filter(product => product.price <= budget) - .sort((a, b) => b.score - a.score) - .slice(0, 6); - - res.json({ - products: scoredProducts, - totalMatches: scoredProducts.length, - tunedWeights: feedbackRows.length >= 10 ? weights : null - }); - }); + // Get all products + db.all('SELECT * FROM products', [], (err, products) => { + if (err) { + console.error('Error fetching products:', err); + return res.status(500).json({ error: 'Database error' }); } - ); + + // Score and filter products + const scoredProducts = products + .map(product => { + let score = 0; + + // Color match: +25 points + if (preferredColors.includes(product.color)) { + score += 25; + } + + // Style match: +35 points + if (styles.length > 0) { + let productStyleTags = JSON.parse(product.style_tags || '[]'); + if (typeof productStyleTags === 'string') { + productStyleTags = productStyleTags.split(',').map(s => s.trim()); + } + const matchingStyles = styles.filter(style => + productStyleTags.some(tag => tag.toLowerCase().includes(style.toLowerCase())) + ); + if (matchingStyles.length > 0) { + score += 35; + } + } + + // Price fit: +20 points + if (product.price <= budget) { + score += 20; + } + + return { ...product, score, matchingStyles: styles.filter(style => { + let tagList = JSON.parse(product.style_tags || '[]'); + if (typeof tagList === 'string') tagList = tagList.split(',').map(s => s.trim()); + return tagList.some(tag => tag.toLowerCase().includes(style.toLowerCase())); + }) }; + }) + .filter(product => { + // Filter out hard lines + const productStyleTags = JSON.parse(product.style_tags || '[]'); + return !hardLines.some(hardLine => + productStyleTags.some(tag => tag.toLowerCase().includes(hardLine.toLowerCase())) || + product.title.toLowerCase().includes(hardLine.toLowerCase()) || + product.brand.toLowerCase().includes(hardLine.toLowerCase()) + ); + }) + .filter(product => product.price <= budget) + .sort((a, b) => b.score - a.score) + .slice(0, 6); // Top 4-6 items + + res.json({ + products: scoredProducts, + totalMatches: scoredProducts.length + }); + }); } ); }); -// Submit feedback (auth required) -app.post('/api/feedback', authenticate, validate(require('./src/middleware/validation').schemas.feedback), (req, res) => { +// Submit feedback +app.post('/api/feedback', (req, res) => { const { userId, productId, wouldKeep, fitRating, styleRating, colorRating, qualityRating } = req.body; db.run( @@ -444,32 +312,7 @@ const loadSeedProducts = () => { { asin: 'B08T7X9K1L', title: 'Bamboo Silk Scarf', brand: 'Etsy', category: 'Accessories', color: 'Multicolor', style_tags: 'boho,feminine,elegant', price: 24.99, image_url: 'https://m.media-amazon.com/images/I/71X7Y7Z7X6L.jpg', affiliate_link: `https://www.amazon.com/dp/B08T7X9K1L?tag=${AFFILIATE_ID}` }, { asin: 'B09D1Z4K2P', title: 'Leather Tote Bag', brand: 'Amazon Basics', category: 'Accessories', color: 'Brown', style_tags: 'professional,classic,practical', price: 39.99, image_url: 'https://m.media-amazon.com/images/I/81X8Z8Z8X7L.jpg', affiliate_link: `https://www.amazon.com/dp/B09D1Z4K2P?tag=${AFFILIATE_ID}` }, { asin: 'B08W3K7L1N', title: 'Sunglasses - Oversized', brand: 'Amazon Basics', category: 'Accessories', color: 'Black', style_tags: 'feminine,edgy,casual', price: 14.99, image_url: 'https://m.media-amazon.com/images/I/91X9Z9Z9X4L.jpg', affiliate_link: `https://www.amazon.com/dp/B08W3K7L1N?tag=${AFFILIATE_ID}` }, - { asin: 'B09H5X2K3L', title: 'Beaded Necklace Set', brand: 'Etsy', category: 'Accessories', color: 'Multicolor', style_tags: 'boho,feminine,elegant', price: 29.99, image_url: 'https://m.media-amazon.com/images/I/61Z6J7X7X9L.jpg', affiliate_link: `https://www.amazon.com/dp/B09H5X2K3L?tag=${AFFILIATE_ID}` }, - // ── Phase 2 products (24 new, total 50) ── - { asin: 'B07RYH2X4L', title: 'AUTOMET Women\'s Oversized Sweater', brand: 'AUTOMET', category: 'Tops', color: 'Brown', style_tags: 'casual,cozy,comfortable', price: 32.99, image_url: 'https://m.media-amazon.com/images/I/71Z8Y8Z8Y1L.jpg', affiliate_link: `https://www.amazon.com/dp/B07RYH2X4L?tag=${AFFILIATE_ID}` }, - { asin: 'B0B2KXQ7PJ', title: 'ZESICA Women\'s Boho Floral Maxi Dress', brand: 'ZESICA', category: 'Dresses', color: 'Red', style_tags: 'boho,feminine,elegant', price: 45.99, image_url: 'https://m.media-amazon.com/images/I/81Y9Z9Z9Y2L.jpg', affiliate_link: `https://www.amazon.com/dp/B0B2KXQ7PJ?tag=${AFFILIATE_ID}` }, - { asin: 'B07G4DLY5V', title: 'GRACE KARIN Women\'s Pencil Skirt', brand: 'GRACE KARIN', category: 'Bottoms', color: 'Black', style_tags: 'professional,elegant,classic', price: 34.99, image_url: 'https://m.media-amazon.com/images/I/61A8B8C8D8L.jpg', affiliate_link: `https://www.amazon.com/dp/B07G4DLY5V?tag=${AFFILIATE_ID}` }, - { asin: 'B0BJ7P8X2M', title: 'ANRABESS Women\'s Two-Piece Lounge Set', brand: 'ANRABESS', category: 'Tops', color: 'Green', style_tags: 'casual,comfortable,active', price: 39.99, image_url: 'https://m.media-amazon.com/images/I/71Z8Y8Z8Y3L.jpg', affiliate_link: `https://www.amazon.com/dp/B0BJ7P8X2M?tag=${AFFILIATE_ID}` }, - { asin: 'B0B6GKCN8K', title: 'PRETTYGARDEN Women\'s Blazer Jacket', brand: 'PRETTYGARDEN', category: 'Outerwear', color: 'Purple', style_tags: 'professional,elegant,feminine', price: 52.99, image_url: 'https://m.media-amazon.com/images/I/81Y9Z9Z9Y4L.jpg', affiliate_link: `https://www.amazon.com/dp/B0B6GKCN8K?tag=${AFFILIATE_ID}` }, - { asin: 'B0BXKQ3P8N', title: 'Dokotoo Women\'s Linen Shorts', brand: 'Dokotoo', category: 'Bottoms', color: 'Yellow', style_tags: 'casual,comfortable,practical', price: 24.99, image_url: 'https://m.media-amazon.com/images/I/71Z8Y8Z8Y5L.jpg', affiliate_link: `https://www.amazon.com/dp/B0BXKQ3P8N?tag=${AFFILIATE_ID}` }, - { asin: 'B08G1LX7P2', title: 'Columbia Women\'s Benton Springs Fleece', brand: 'Columbia', category: 'Outerwear', color: 'Red', style_tags: 'casual,outdoor,active', price: 44.99, image_url: 'https://m.media-amazon.com/images/I/81Y9Z9Z9Y6L.jpg', affiliate_link: `https://www.amazon.com/dp/B08G1LX7P2?tag=${AFFILIATE_ID}` }, - { asin: 'B08H2M5Q7K', title: 'HUE Women\'s Ultra Leggings', brand: 'HUE', category: 'Bottoms', color: 'Green', style_tags: 'casual,active,comfortable', price: 28.00, image_url: 'https://m.media-amazon.com/images/I/71Z8Y8Z8Y7L.jpg', affiliate_link: `https://www.amazon.com/dp/B08H2M5Q7K?tag=${AFFILIATE_ID}` }, - { asin: 'B09MVJ3X8P', title: 'Allegra K Women\'s Peplum Top', brand: 'Allegra K', category: 'Tops', color: 'Orange', style_tags: 'feminine,elegant,professional', price: 36.99, image_url: 'https://m.media-amazon.com/images/I/81Y9Z9Z9Y8L.jpg', affiliate_link: `https://www.amazon.com/dp/B09MVJ3X8P?tag=${AFFILIATE_ID}` }, - { asin: 'B0BL3XQ7PJ', title: 'Wrangler Women\'s Retro High Rise Jean', brand: 'Wrangler', category: 'Bottoms', color: 'Brown', style_tags: 'classic,casual,edgy', price: 54.99, image_url: 'https://m.media-amazon.com/images/I/71Z8Y8Z8Y9L.jpg', affiliate_link: `https://www.amazon.com/dp/B0BL3XQ7PJ?tag=${AFFILIATE_ID}` }, - { asin: 'B07QK3X6L2', title: 'V28 Women\'s V-Neck Racerback Tank', brand: 'V28', category: 'Tops', color: 'Purple', style_tags: 'active,casual,practical', price: 16.99, image_url: 'https://m.media-amazon.com/images/I/71A9B9C9D1L.jpg', affiliate_link: `https://www.amazon.com/dp/B07QK3X6L2?tag=${AFFILIATE_ID}` }, - { asin: 'B0C2HPX8KJ', title: 'BTFBM Women\'s Satin Cami Dress', brand: 'BTFBM', category: 'Dresses', color: 'Yellow', style_tags: 'feminine,elegant,casual', price: 42.99, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D2L.jpg', affiliate_link: `https://www.amazon.com/dp/B0C2HPX8KJ?tag=${AFFILIATE_ID}` }, - { asin: 'B0B14KQ3MN', title: 'LILLUSORY Women\'s Knit Cardigan', brand: 'LILLUSORY', category: 'Outerwear', color: 'Brown', style_tags: 'cozy,casual,feminine', price: 47.99, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D3L.jpg', affiliate_link: `https://www.amazon.com/dp/B0B14KQ3MN?tag=${AFFILIATE_ID}` }, - { asin: 'B0BHX2M5L8', title: 'New Balance Women\'s 574 Sneaker', brand: 'New Balance', category: 'Shoes', color: 'Grey', style_tags: 'casual,active,classic', price: 74.99, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D4L.jpg', affiliate_link: `https://www.amazon.com/dp/B0BHX2M5L8?tag=${AFFILIATE_ID}` }, - { asin: 'B0CDKQ3X7M', title: 'Soda Women\'s Open Toe Sandal', brand: 'Soda', category: 'Shoes', color: 'Brown', style_tags: 'feminine,casual,boho', price: 29.99, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D5L.jpg', affiliate_link: `https://www.amazon.com/dp/B0CDKQ3X7M?tag=${AFFILIATE_ID}` }, - { asin: 'B0BFWJX2P8', title: 'Dr. Scholl\'s Women\'s Time Off Sneaker', brand: 'Dr. Scholl\'s', category: 'Shoes', color: 'White', style_tags: 'casual,comfortable,classic', price: 59.99, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D6L.jpg', affiliate_link: `https://www.amazon.com/dp/B0BFWJX2P8?tag=${AFFILIATE_ID}` }, - { asin: 'B08L9Q7R3K', title: 'Sam Edelman Women\'s Hazel Pump', brand: 'Sam Edelman', category: 'Shoes', color: 'Red', style_tags: 'elegant,feminine,professional', price: 79.99, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D7L.jpg', affiliate_link: `https://www.amazon.com/dp/B08L9Q7R3K?tag=${AFFILIATE_ID}` }, - { asin: 'B07VK9P7K2', title: 'Fossil Women\'s Leather Crossbody', brand: 'Fossil', category: 'Accessories', color: 'Brown', style_tags: 'professional,classic,practical', price: 69.99, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D8L.jpg', affiliate_link: `https://www.amazon.com/dp/B07VK9P7K2?tag=${AFFILIATE_ID}` }, - { asin: 'B08XJ8M2L7', title: 'Kate Spade New York Stud Earrings', brand: 'Kate Spade', category: 'Accessories', color: 'Gold', style_tags: 'feminine,elegant,classic', price: 34.00, image_url: 'https://m.media-amazon.com/images/I/81A9B9C9D9L.jpg', affiliate_link: `https://www.amazon.com/dp/B08XJ8M2L7?tag=${AFFILIATE_ID}` }, - { asin: 'B09V1X4K8P', title: 'Maidenform Women\'s Comfort Devotion Bra', brand: 'Maidenform', category: 'Undergarments', color: 'Pink', style_tags: 'comfortable,classic,feminine', price: 27.99, image_url: 'https://m.media-amazon.com/images/I/71Z9A9B9C1L.jpg', affiliate_link: `https://www.amazon.com/dp/B09V1X4K8P?tag=${AFFILIATE_ID}` }, - { asin: 'B0B6X8K5L2', title: 'Hanes Women\'s French Terry Jogger', brand: 'Hanes', category: 'Bottoms', color: 'Orange', style_tags: 'comfortable,casual,active', price: 19.99, image_url: 'https://m.media-amazon.com/images/I/71Z9A9B9C2L.jpg', affiliate_link: `https://www.amazon.com/dp/B0B6X8K5L2?tag=${AFFILIATE_ID}` }, - { asin: 'B09KXQ7P3L', title: 'Roxy Women\'s Beach Classics Bikini', brand: 'Roxy', category: 'Tops', color: 'Yellow', style_tags: 'active,casual,feminine', price: 34.99, image_url: 'https://m.media-amazon.com/images/I/71Z9A9B9C3L.jpg', affiliate_link: `https://www.amazon.com/dp/B09KXQ7P3L?tag=${AFFILIATE_ID}` }, - { asin: 'B0C5JX8K2N', title: 'Lacozy Women\'s Wrap Dress', brand: 'Lacozy', category: 'Dresses', color: 'Green', style_tags: 'feminine,casual,boho', price: 39.99, image_url: 'https://m.media-amazon.com/images/I/71Z9A9B9C4L.jpg', affiliate_link: `https://www.amazon.com/dp/B0C5JX8K2N?tag=${AFFILIATE_ID}` }, - { asin: 'B0BK7P3X8Q', title: 'MINTLIMIT Women\'s Hiking Pants', brand: 'MINTLIMIT', category: 'Bottoms', color: 'Purple', style_tags: 'active,outdoor,practical', price: 31.99, image_url: 'https://m.media-amazon.com/images/I/71Z9A9B9C5L.jpg', affiliate_link: `https://www.amazon.com/dp/B0BK7P3X8Q?tag=${AFFILIATE_ID}` } + { asin: 'B09H5X2K3L', title: 'Beaded Necklace Set', brand: 'Etsy', category: 'Accessories', color: 'Multicolor', style_tags: 'boho,feminine,elegant', price: 29.99, image_url: 'https://m.media-amazon.com/images/I/61Z6J7X7X9L.jpg', affiliate_link: `https://www.amazon.com/dp/B09H5X2K3L?tag=${AFFILIATE_ID}` } ]; seedProducts.forEach(product => { diff --git a/wardrobe-ai/backend/src/middleware/validation.js b/wardrobe-ai/backend/src/middleware/validation.js deleted file mode 100644 index 8d772b2..0000000 --- a/wardrobe-ai/backend/src/middleware/validation.js +++ /dev/null @@ -1,194 +0,0 @@ -const Joi = require('joi'); - -// --- Schema Definitions --- - -const emailSchema = Joi.string() - .email() - .required() - .messages({ - 'string.email': 'Invalid email format', - 'any.required': 'Email is required', - }); - -const budgetSchema = Joi.number() - .integer() - .valid(100, 250) - .messages({ - 'number.base': 'Budget must be a number', - 'number.integer': 'Budget must be an integer', - 'any.only': 'Budget must be 100 or 250', - }); - -const ratingSchema = Joi.number() - .integer() - .min(1) - .max(5) - .messages({ - 'number.base': 'Rating must be a number', - 'number.integer': 'Rating must be an integer', - 'number.min': 'Rating must be at least 1', - 'number.max': 'Rating must be at most 5', - }); - -const boxIdSchema = Joi.string() - .min(5) - .required() - .messages({ - 'string.base': 'Box ID must be a string', - 'string.min': 'Box ID must be at least 5 characters', - 'any.required': 'Box ID is required', - }); - -const nonEmptyString = Joi.string() - .min(1) - .required() - .messages({ - 'string.base': 'Value must be a string', - 'string.min': 'Value must not be empty', - 'any.required': 'This field is required', - }); - -const userIdSchema = Joi.string() - .min(1) - .required() - .messages({ - 'string.base': 'User ID must be a string', - 'string.min': 'User ID must not be empty', - 'any.required': 'User ID is required', - }); - -const profileIdSchema = Joi.string() - .min(1) - .required() - .messages({ - 'string.base': 'Profile ID must be a string', - 'string.min': 'Profile ID must not be empty', - 'any.required': 'Profile ID is required', - }); - -// --- Request Schemas --- - -const feedbackSchema = Joi.object({ - userId: userIdSchema, - productId: Joi.number().integer().required(), - boxId: boxIdSchema.optional(), - wouldKeep: Joi.boolean().optional(), - fitRating: ratingSchema.optional(), - styleRating: ratingSchema.optional(), - colorRating: ratingSchema.optional(), - qualityRating: ratingSchema.optional(), - comment: Joi.string().max(500).optional(), -}); - -const boxSchema = Joi.object({ - userId: userIdSchema, - profileId: profileIdSchema.optional(), - preferredColors: Joi.array().items(Joi.string()).optional(), - stylePreferences: Joi.alternatives().try( - Joi.array().items(Joi.string()), - Joi.string() - ).optional(), - budget: budgetSchema.optional(), - totalPrice: budgetSchema.optional(), -}); - -const profileSchema = Joi.object({ - userId: userIdSchema, - sizes: Joi.array().items(Joi.string()).optional(), - preferredColors: Joi.array().items(Joi.string()).optional(), - stylePreferences: Joi.alternatives().try( - Joi.array().items(Joi.string()), - Joi.string() - ).optional(), - lifestyle: Joi.string().max(500).optional(), - hardLines: Joi.array().items(Joi.string()).optional(), - mustHaves: Joi.array().items(Joi.string()).optional(), - budget: budgetSchema.optional(), -}); - -const userSchema = Joi.object({ - email: emailSchema, -}); - -// --- Sanitization --- - -/** - * Recursively sanitize an object: - * - HTML-encodes < and > (XSS prevention) - * - Trims whitespace on strings - */ -function sanitizeValue(value) { - if (typeof value === 'string') { - return value - .replace(//g, '>') - .trim(); - } - if (Array.isArray(value)) { - return value.map(sanitizeValue); - } - if (value !== null && typeof value === 'object') { - const sanitized = {}; - for (const [key, val] of Object.entries(value)) { - sanitized[key] = sanitizeValue(val); - } - return sanitized; - } - return value; -} - -// --- Middleware --- - -/** - * Express middleware that sanitizes req.body recursively - */ -function sanitizeBody(req, res, next) { - if (req.body && typeof req.body === 'object') { - req.body = sanitizeValue(req.body); - } - next(); -} - -/** - * Factory: returns middleware that validates req.body against a Joi schema. - * On failure, responds with 400 + descriptive error messages. - */ -function validate(schema) { - return (req, res, next) => { - const { error, value } = schema.validate(req.body, { - abortEarly: false, - stripUnknown: true, - }); - - if (error) { - const messages = error.details.map((d) => d.message); - return res.status(400).json({ error: 'Validation failed', details: messages }); - } - - req.body = value; - next(); - }; -} - -// --- Exports --- - -module.exports = { - // Middleware - sanitizeBody, - validate, - - // Schemas (for direct use / testing) - schemas: { - feedback: feedbackSchema, - box: boxSchema, - profile: profileSchema, - user: userSchema, - email: emailSchema, - budget: budgetSchema, - rating: ratingSchema, - boxId: boxIdSchema, - }, - - // Utilities - sanitizeValue, -}; diff --git a/wardrobe-ai/frontend/src/components/CuratedBox.js b/wardrobe-ai/frontend/src/components/CuratedBox.js index a799108..18ea6ad 100644 --- a/wardrobe-ai/frontend/src/components/CuratedBox.js +++ b/wardrobe-ai/frontend/src/components/CuratedBox.js @@ -20,15 +20,7 @@ export default function CuratedBox() { const fetchProfile = async (userId) => { try { setLoadingProfile(true); - const token = localStorage.getItem('wardrobe_token'); - const response = await fetch(`/api/profile/${userId}`, { - headers: token ? { 'Authorization': `Bearer ${token}` } : {} - }); - if (response.status === 401) { - // Auth required — store return URL and redirect - window.location.href = `/?login=required&redirect=box&userId=${userId}`; - return; - } + const response = await fetch(`/api/profile/${userId}`); const data = await response.json(); if (response.ok) { // Convert underscore fields to camelCase for consistency @@ -58,10 +50,7 @@ export default function CuratedBox() { const response = await fetch('/api/box', { method: 'POST', - headers: { - 'Content-Type': 'application/json', - ...(localStorage.getItem('wardrobe_token') ? { 'Authorization': `Bearer ${localStorage.getItem('wardrobe_token')}` } : {}) - }, + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ userId, preferredColors, @@ -101,10 +90,7 @@ export default function CuratedBox() { try { await fetch('/api/feedback', { method: 'POST', - headers: { - 'Content-Type': 'application/json', - ...(localStorage.getItem('wardrobe_token') ? { 'Authorization': `Bearer ${localStorage.getItem('wardrobe_token')}` } : {}) - }, + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ userId, productId, diff --git a/wardrobe-ai/site/index.html b/wardrobe-ai/site/index.html deleted file mode 100644 index 84e5b69..0000000 --- a/wardrobe-ai/site/index.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - -Wardrobe AI — Your Personal Stylist, Powered by AI - - - - - -
-
-

Clothes you'll love.
Without the scroll.

-

- Wardrobe AI curates clothing from real designers — picked for your style, - your size, and your budget. No trends. No algorithms optimizing for ad revenue. - Just clothes that feel like you. -

- Get Early Access -
-
- - -
-
-

How It Works

-
-
-
1
-

Tell Us Your Style

-

Share your sizes, favorite colors, style preferences, and what you absolutely won't wear. Takes 2 minutes.

-
-
-
2
-

AI Curates Your Box

-

Our curation engine matches you with pieces from small designers and boutique brands — filtered for fit and budget.

-
-
-
3
-

Love It or Learn

-

Keep what you love. Rate what you don't. Every box gets smarter because the AI learns from your taste.

-
-
-
-
- - -
-
-

Not Another Subscription Box

-
-
-

🏷️ Real Designers, Not Fast Fashion

-

We curate from small businesses and boutique brands — clothes with craftsmanship, not warehouse overstock.

-
-
-

🧠 Learns Your Taste

-

Rate what you receive. Every rating trains the engine. Box #3 is smarter than box #1 — and it keeps improving.

-
-
-

💰 Within Your Budget

-

Set your per-item budget ($50, $100, $150). We never send items above it. Respect for your wallet is built in.

-
-
-

🚫 Your Hard Lines, Respected

-

No synthetics. No florals. No crop tops. Whatever your boundaries are, the engine treats them as rules, not suggestions.

-
-
-
-
- - -
-
-

Simple Pricing

-
-
Free
-
during early access
-
    -
  • Personalized style profile
  • -
  • AI-curated boxes on demand
  • -
  • Feedback-powered learning engine
  • -
  • Products from boutique brands
  • -
  • Budget-respecting curation
  • -
  • No subscription, no commitment
  • -
-

You only pay for what you buy. We earn through brand partnerships — never by selling your data.

-
-
-
- - -
-
-

Be First in Line

-

Wardrobe AI is in early access. Drop your email and we'll let you know when your personal stylist is ready.

-
- - -
- -
-
- - - - - - -