{"id":32555117,"url":"https://github.com/vercel/vectr","last_synced_at":"2025-11-03T22:03:38.647Z","repository":{"id":320685547,"uuid":"1073953296","full_name":"vercel/vectr","owner":"vercel","description":"A free, open-source template for building natural language image search on the AI Cloud.","archived":false,"fork":false,"pushed_at":"2025-10-25T08:01:45.000Z","size":1440,"stargazers_count":27,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-25T09:14:40.380Z","etag":null,"topics":["ai","blob","search","vector","vercel"],"latest_commit_sha":null,"homepage":"https://vectr.store/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vercel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-10T22:16:10.000Z","updated_at":"2025-10-25T08:01:49.000Z","dependencies_parsed_at":"2025-10-25T09:15:47.062Z","dependency_job_id":"6af2d0fe-1b38-4e22-9c19-048eee04931b","html_url":"https://github.com/vercel/vectr","commit_stats":null,"previous_names":["vercel/vectr"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/vercel/vectr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fvectr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fvectr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fvectr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fvectr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vercel","download_url":"https://codeload.github.com/vercel/vectr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fvectr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282536467,"owners_count":26685728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-03T02:00:05.676Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","blob","search","vector","vercel"],"created_at":"2025-10-28T22:00:46.346Z","updated_at":"2025-11-03T22:03:38.634Z","avatar_url":"https://github.com/vercel.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Vectr\n\n**Vectr** is an AI-powered image search application template that automatically generates descriptions for uploaded images and indexes them for semantic search.\n\n## ✨ Features\n\n- 📤 **Drag-and-drop image uploads** with Vercel Blob Storage\n- 🤖 **AI-powered image descriptions** using Grok 2 Vision\n- 🔍 **Semantic search** with Upstash Vector Search (stores metadata too!)\n- 🔄 **Resilient processing** with Vercel Workflow automatic retries\n- 🎨 **Beautiful UI** built with shadcn/ui and Tailwind CSS\n- 💰 **Incredibly cheap** - No database needed!\n\n## 🚀 How It Works\n\nWhen you upload an image, Vectr automatically:\n\n1. 💾 Stores the image in Vercel Blob Storage\n2. 🧠 Generates a detailed description using Grok 2 Vision AI\n3. 🔎 Indexes the description AND metadata in Upstash for semantic search\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant App as Next.js App\n    participant Workflow as Vercel Workflow\n    participant Blob as Vercel Blob\n    participant AI as Grok Vision AI\n    participant Search as Upstash Search\n\n    User-\u003e\u003eApp: Upload Image (FormData)\n    App-\u003e\u003eWorkflow: POST /api/upload\n\n    Note over Workflow: Start Workflow\n\n    Workflow-\u003e\u003eBlob: Upload to Storage (Step 1)\n    Note over Blob: Max 3 retries\u003cbr/\u003eRate limit handling\n    Blob--\u003e\u003eWorkflow: Blob URL + Metadata\n\n    Workflow-\u003e\u003eAI: Generate Description (Step 2)\n    Note over AI: Max 5 retries\u003cbr/\u003eRate limit handling\n    AI--\u003e\u003eWorkflow: Image Description\n\n    Workflow-\u003e\u003eSearch: Index with Metadata (Step 3)\n    Note over Search: Max 5 retries\u003cbr/\u003eStores description + blob metadata\n    Search--\u003e\u003eWorkflow: Success\n\n    Workflow--\u003e\u003eApp: 200 OK\n\n    User-\u003e\u003eApp: Search Images\n    App-\u003e\u003eSearch: Semantic Query\n    Search--\u003e\u003eApp: Results with Metadata\n    App--\u003e\u003eUser: Display Results\n```\n\n## 🏗️ Architecture\n\n### Workflow Steps\n\nEach step in the image processing workflow is isolated and runs on a separate serverless function with automatic retries:\n\n**Step 1: Upload Image** (`upload-image.ts`)\n- 💾 Uploads to Vercel Blob Storage\n- ⏱️ Handles rate limiting with 1-minute retry delays\n- 🔄 Maximum 3 retry attempts\n- ❌ Fatal error on quota exceeded or invalid files\n\n**Step 2: Generate Description** (`generate-description.ts`)\n- 🤖 Uses Grok 2 Vision AI to analyze the image\n- ⏱️ Handles rate limiting with 5-minute retry delays\n- 🔄 Maximum 5 retry attempts\n- ❌ Fatal error on invalid/unsupported images\n\n**Step 3: Index Image** (`index-image.ts`)\n- 🔎 Indexes description AND blob metadata in Upstash\n- 💾 Stores all image data (url, size, contentType, etc.) as metadata\n- ⏱️ Handles rate limiting with 1-minute retry delays\n- 🔄 Maximum 5 retry attempts\n- ❌ Fatal error on invalid data\n\n### Error Handling\n\nVectr uses sophisticated error handling to ensure reliable processing:\n\n- 🔄 **RetryableError**: Temporary failures (rate limits, network issues, timeouts)\n- ❌ **FatalError**: Permanent failures (invalid data, constraint violations)\n- 📊 **Context-aware retries**: Each step tracks attempt count and timestamps\n- 🎯 **Smart HTTP responses**: 400 for fatal errors, 500 for retryable errors\n\n## 🛠️ Tech Stack\n\n- ⚡ **Framework**: Next.js 15 with App Router and React 19\n- 🔄 **Workflow**: Vercel Workflow (alpha)\n- 🤖 **AI**: Grok 2 Vision via Vercel AI SDK\n- 🔍 **Search \u0026 Storage**: Upstash Vector Search (stores metadata too!)\n- 💾 **Blob Storage**: Vercel Blob Storage\n- 🎨 **UI**: shadcn/ui + Tailwind CSS 4\n- 🔒 **Type Safety**: TypeScript + Zod\n\n## 🚀 Deploy to Vercel\n\nThe easiest way to deploy Vectr is using the Vercel Marketplace:\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?demo-description=A+free%2C+open-source+template+for+building+natural+language+image+search+on+the+AI+Cloud.\u0026demo-image=https%3A%2F%2Fvectr.store%2Fopengraph-image.png\u0026demo-title=vectr.store\u0026demo-url=https%3A%2F%2Fvectr.store%2F\u0026from=templates\u0026project-name=Vectr\u0026repository-name=vectr\u0026repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fvectr\u0026products=%5B%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22storage%22%2C%22productSlug%22%3A%22upstash-search%22%2C%22integrationSlug%22%3A%22upstash%22%7D%2C%7B%22type%22%3A%22blob%22%7D%5D\u0026skippable-integrations=0)\n\nDuring deployment, you'll be prompted to set up:\n\n1. 🔍 **Upstash Vector Search** - Semantic search + metadata storage\n2. 💾 **Vercel Blob Storage** - Image storage\n\nBoth services have generous free tiers and will be automatically configured. No database needed!\n\n## 💻 Local Development\n\n### Prerequisites\n\n- 🟢 Node.js 18+\n- 📦 pnpm (recommended)\n\n### Setup\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/your-username/vectr.git\ncd vectr\n```\n\n2. Install dependencies:\n\n```bash\npnpm install\n```\n\n3. Set up environment variables:\n\nCreate a `.env.local` file with:\n\n```bash\n# Upstash Search\nUPSTASH_SEARCH_URL=\"https://...\"\nUPSTASH_SEARCH_TOKEN=\"...\"\n\n# Vercel Blob\nBLOB_READ_WRITE_TOKEN=\"...\"\n\n# AI Gateway Key (only needed locally)\nAI_GATEWAY_API_KEY=\"...\"\n```\n\n4. Run the development server:\n\n```bash\npnpm dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) to see your app.\n\n## 📜 Scripts\n\n- 🚀 `pnpm dev` - Start development server with Turbopack\n- 🏗️ `pnpm build` - Build for production\n- ✅ `pnpm check` - Run linting checks\n- ✨ `pnpm format` - Format code with Biome\n\n## 📁 Project Structure\n\n```\nvectr/\n├── app/\n│   ├── actions/\n│   │   └── search.ts                 # Server action for search\n│   ├── api/\n│   │   └── upload/\n│   │       ├── route.ts              # Workflow route handler\n│   │       ├── upload-image.ts       # Step 1: Upload to Blob\n│   │       ├── generate-description.ts  # Step 2: AI description\n│   │       └── index-image.ts        # Step 3: Index with metadata\n│   ├── layout.tsx\n│   └── page.tsx\n├── components/\n│   ├── header.tsx\n│   ├── results.tsx\n│   ├── upload-button.tsx\n│   └── uploaded-images-provider.tsx\n├── lib/\n│   └── utils.ts\n└── package.json\n```\n\n## 🔐 Environment Variables\n\n| Variable | Description | Required |\n|----------|-------------|----------|\n| `UPSTASH_SEARCH_URL` | Upstash Vector Search endpoint | Yes |\n| `UPSTASH_SEARCH_TOKEN` | Upstash authentication token | Yes |\n| `BLOB_READ_WRITE_TOKEN` | Vercel Blob Storage token | Yes |\n| `XAI_API_KEY` | xAI API key for Grok Vision | Yes |\n\n## 📊 Observability\n\nVectr includes comprehensive logging for monitoring and debugging:\n\n- 🔄 `[WORKFLOW]` - Workflow-level events and timing\n- 🔧 `[stepId]` - Step-level events with unique identifiers\n- 🌐 `[API]` - HTTP request/response logging\n\nAll logs include timestamps, attempt counts, and duration metrics.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. Our [Contributing Guide](.github/CONTRIBUTING.md) has more information on how to get started.\n\n## 📄 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fvectr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvercel%2Fvectr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fvectr/lists"}