
Vectr is an AI-powered image search application template that automatically generates descriptions for uploaded images and indexes them for semantic search.
When you upload an image, Vectr automatically:
Each step in the image processing workflow is isolated and runs on a separate serverless function with automatic retries:
Step 1: Upload Image (upload-image.ts)
Step 2: Generate Description (generate-description.ts)
Step 3: Index Image (index-image.ts)
Vectr uses sophisticated error handling to ensure reliable processing:
The easiest way to deploy Vectr is using the Vercel Marketplace:
During deployment, you'll be prompted to set up:
Both services have generous free tiers and will be automatically configured. No database needed!
git clone https://github.com/your-username/vectr.gitcd vectr
pnpm install
Create a .env.local file with:
# Upstash SearchUPSTASH_SEARCH_URL="https://..."UPSTASH_SEARCH_TOKEN="..."# Vercel BlobBLOB_READ_WRITE_TOKEN="..."# AI Provider (Grok via Vercel AI SDK)XAI_API_KEY="..."
pnpm dev
Open http://localhost:3000 to see your app.
pnpm dev - Start development server with Turbopackpnpm build - Build for productionpnpm check - Run linting checkspnpm format - Format code with Biomevectr/βββ app/β βββ actions/β β βββ search.ts # Server action for searchβ βββ api/β β βββ upload/β β βββ route.ts # Workflow route handlerβ β βββ upload-image.ts # Step 1: Upload to Blobβ β βββ generate-description.ts # Step 2: AI descriptionβ β βββ index-image.ts # Step 3: Index with metadataβ βββ layout.tsxβ βββ page.tsxβββ components/β βββ header.tsxβ βββ results.tsxβ βββ upload-button.tsxβ βββ uploaded-images-provider.tsxβββ lib/β βββ utils.tsβββ package.json
| Variable | Description | Required |
|---|---|---|
UPSTASH_SEARCH_URL | Upstash Vector Search endpoint | Yes |
UPSTASH_SEARCH_TOKEN | Upstash authentication token | Yes |
BLOB_READ_WRITE_TOKEN | Vercel Blob Storage token | Yes |
XAI_API_KEY | xAI API key for Grok Vision | Yes |
Vectr includes comprehensive logging for monitoring and debugging:
[WORKFLOW] - Workflow-level events and timing[stepId] - Step-level events with unique identifiers[API] - HTTP request/response loggingAll logs include timestamps, attempt counts, and duration metrics.
Contributions are welcome! Please feel free to submit a Pull Request. Our Contributing Guide has more information on how to get started.
MIT