Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fashion Discovery Platform

Next.js TypeScript PostgreSQL Tailwind License

India's fashion discovery engine for Instagram-native D2C brands

A production-ready platform that aggregates 250+ digital-first fashion brands, enables advanced filtering, and redirects traffic to original brand websites.

🚫 NOT a marketplace - Discovery + Filtering + Redirection only


Features

Core Platform

  • Advanced Filtering - Filter by category, price band, aesthetic, fit, fabric, and more
  • Smart Ranking - Algorithm-based brand scoring using signals (IG native, Meta ads, drops, etc.)
  • Redirect Tracking - Analytics on clicks, referrers, and UTM parameters
  • Responsive Design - Beautiful, modern UI built with Next.js and Tailwind CSS

Discovery Automation

  • 🤖 Meta Ads Discovery - Find brands advertising on Meta platforms
  • 🛍️ Shopify Detection - Identify D2C Shopify stores
  • 📱 Instagram Integration - Discover Instagram-native brands
  • 🏪 Marketplace Mining - Extract brands from Furrl, LBB, Shiprocket Discover
  • Auto-Approval - Brands with score ≥7 auto-approved weekly

Tech Stack

  • Frontend: Next.js 14 (App Router), React, TypeScript, Tailwind CSS
  • Backend: Next.js API Routes
  • Database: PostgreSQL 15 (via Homebrew)
  • Icons: Lucide React
  • Deployment: Vercel (recommended)

Quick Start

1. Install PostgreSQL

brew install postgresql@15
brew services start postgresql@15

2. Create Database

/opt/homebrew/opt/postgresql@15/bin/createdb fashion_discovery

3. Clone & Install

cd /path/to/clothing
npm install

4. Environment Variables

Create .env.local (optional - defaults work for local PostgreSQL):

DB_HOST=localhost
DB_PORT=5432
DB_NAME=fashion_discovery
DB_USER=  # Leave empty to use current user
DB_PASSWORD=

5. Run Database Migrations

/opt/homebrew/opt/postgresql@15/bin/psql -d fashion_discovery -f supabase/migrations/001_initial_schema.sql
/opt/homebrew/opt/postgresql@15/bin/psql -d fashion_discovery -f supabase/migrations/002_seed_data.sql
/opt/homebrew/opt/postgresql@15/bin/psql -d fashion_discovery -f supabase/migrations/003_increment_function.sql

6. Seed Sample Brands

npm run db:seed

This will add 10 sample brands with tags.

7. Start Development Server

npm run dev

Open http://localhost:3000


Project Structure

clothing/
├── src/
│   ├── app/
│   │   ├── api/
│   │   │   ├── brands/route.ts       # Brand search & filter API
│   │   │   └── r/[slug]/route.ts     # Redirect tracking API
│   │   ├── page.tsx                  # Main page
│   │   └── layout.tsx
│   ├── components/
│   │   ├── BrandCard.tsx             # Brand display card
│   │   └── FilterPanel.tsx           # Filter sidebar
│   ├── lib/
│   │   ├── db.ts                     # PostgreSQL client
│   │   └── utils.ts                  # Ranking & utilities
│   └── types/
│       └── database.ts               # TypeScript types
├── scripts/
│   ├── seed-brands.ts                # Brand seeding script
│   └── weekly-discovery.ts           # Discovery automation
├── supabase/
│   └── migrations/                   # Database migrations
└── package.json

Database Schema

Tables

  • brands - Main brand data with signals and metadata
  • categories - Brand categories (Streetwear, Formals, etc.)
  • tags - Filterable tags (fit, aesthetic, fabric, etc.)
  • brand_tags - Many-to-many relationship
  • redirects - Click tracking and analytics
  • discovery_queue - Automated brand discovery queue

Key Indexes

  • Category, price band, slug, active status
  • Tag categories and applicability
  • Redirect timestamps for analytics

API Endpoints

GET /api/brands

Search and filter brands.

Query Parameters:

  • category - Comma-separated category slugs
  • price - Comma-separated price bands (₹, ₹₹, ₹₹₹, ₹₹₹₹)
  • tags - Comma-separated tag slugs
  • search - Brand name search
  • sort - relevance | popular | new
  • limit - Results per page (default: 50)
  • offset - Pagination offset

Response:

{
  "brands": [...],
  "total": 250,
  "filters": {
    "categories": [...],
    "priceBands": [...],
    "availableTags": [...]
  }
}

GET /api/r/[slug]

Redirect to brand website with tracking.

Query Parameters (optional):

  • utm_source, utm_medium, utm_campaign

Response: 302 redirect to brand website


Brand Discovery System

Running Discovery

npm run discovery:run

This will:

  1. Search Meta Ads Library for fashion brands
  2. Crawl Shopify stores
  3. Mine marketplaces (Furrl, LBB, etc.)
  4. Score and add brands to discovery queue
  5. Auto-approve brands with score ≥7

Discovery Scoring

Signal Points
Meta Ads Active +3
Shopify-backed +2
Limited Drop Language +2
Instagram Native +2
No Offline Stores +1

Auto-approval threshold: 7+ points


NPM Scripts

# Development
npm run dev              # Start dev server (port 3000)

# Database
npm run db:seed          # Seed sample brands

# Discovery
npm run discovery:run    # Run brand discovery

# Production
npm run build            # Build for production
npm start                # Start production server

PostgreSQL Management

Start/Stop PostgreSQL

# Start
brew services start postgresql@15

# Stop
brew services stop postgresql@15

# Restart
brew services restart postgresql@15

Connect to Database

/opt/homebrew/opt/postgresql@15/bin/psql -d fashion_discovery

Useful SQL Queries

-- Count brands
SELECT COUNT(*) FROM brands;

-- View all categories
SELECT * FROM categories ORDER BY display_order;

-- Top brands by clicks
SELECT name, total_clicks FROM brands ORDER BY total_clicks DESC LIMIT 10;

-- Discovery queue status
SELECT status, COUNT(*) FROM discovery_queue GROUP BY status;

Deployment

Vercel with Remote PostgreSQL

  1. Set up a PostgreSQL database (Railway, Supabase, Neon, etc.)
  2. Push to GitHub
  3. Import project in Vercel
  4. Add environment variables:
    • DB_HOST
    • DB_PORT
    • DB_NAME
    • DB_USER
    • DB_PASSWORD
  5. Run migrations on remote database
  6. Deploy

Scaling to 2,500+ Brands

The system is designed to scale:

  1. Database Indexes - Optimized for fast filtering
  2. Connection Pooling - 20 max connections
  3. Pagination - Built-in limit/offset
  4. Discovery Automation - Weekly brand ingestion
  5. CDN - Vercel Edge for static assets

Performance Targets

  • Search/filter queries: <200ms
  • Redirect tracking: <100ms
  • Discovery run: <5 minutes

Troubleshooting

PostgreSQL Not Starting

brew services restart postgresql@15

Database Connection Errors

Check if PostgreSQL is running:

brew services list | grep postgresql

Reset Database

/opt/homebrew/opt/postgresql@15/bin/dropdb fashion_discovery
/opt/homebrew/opt/postgresql@15/bin/createdb fashion_discovery
# Then re-run migrations

Contributing

Adding Brands Manually

  1. Add brand data to scripts/seed-brands.ts
  2. Run npm run db:seed

Adding New Tags

  1. Add to supabase/migrations/002_seed_data.sql
  2. Re-run migration
  3. Update FilterPanel.tsx if needed

License

MIT


Support

For issues or questions, open a GitHub issue.

Built with ❤️ for India's fashion ecosystem

About

India's fashion discovery engine for Instagram-native D2C brands — filtering + redirection, not a marketplace.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages