A Next.js web application that uses AI to analyze memes and explain their pop culture references. Upload a meme, and discover the movie, TV show, or cultural reference behind it, complete with detailed explanations, clips, and cultural context.
- AI-Powered Meme Analysis: Upload any meme and get instant explanations using Perplexity's vision-capable AI
- Pop Culture Database: Automatic matching with TMDB to fetch movie/TV show details, trailers, and clips
- Cultural Lore: Dive deep into awards, cultural impact, trivia, and critical reception
- Similar Movies: Discover similar movies and shows
- Explore Page: Browse through a curated collection of analyzed memes
- Framework: Next.js 15 with App Router
- Styling: Tailwind CSS 4
- AI: Perplexity AI (vision + grounded search)
- Movie Data: TMDB (The Movie Database) API
- Storage: Vercel Blob (images) + Vercel KV (metadata)
- Deployment: Vercel
Before you begin, ensure you have:
- Node.js 18.17+ and npm (or yarn/pnpm)
- Git for version control
- API keys from:
- (Optional) Vercel account for deploying and using Blob/KV storage in production
git clone <repository-url>
cd perplexity-hacknpm install-
Copy the example environment file:
cp .env.example .env.local
-
Open
.env.localand add your API keys:# Required: Perplexity API Key PERPLEXITY_API_KEY=your_perplexity_api_key_here # Required: TMDB API Key TMDB_API_KEY=your_tmdb_api_key_here # Required: App URL NEXT_PUBLIC_APP_URL=http://localhost:3000 # Optional: Vercel Blob Storage (for production) BLOB_READ_WRITE_TOKEN=your_blob_token_here # Optional: Vercel KV Storage (for production) KV_URL=your_kv_url_here KV_REST_API_URL=your_kv_rest_api_url_here KV_REST_API_TOKEN=your_kv_rest_api_token_here KV_REST_API_READ_ONLY_TOKEN=your_kv_rest_api_read_only_token_here
For production deployment and cloud storage:
npm i -g vercel
vercel link
vercel env pullnpm run devOpen http://localhost:3000 in your browser.
src/
├── app/
│ ├── api/ # API routes
│ │ ├── analyze-meme/ # Upload and analyze memes
│ │ ├── explore/ # Browse memes
│ │ ├── meme/[id]/ # Get meme by ID
│ │ └── movie/[id]/ # Movie details, lore, similar movies
│ ├── explore/ # Explore page
│ ├── meme/[id]/ # Meme analysis result page
│ ├── movie/[id]/ # Movie detail pages
│ │ ├── lore/ # Cultural context and awards
│ │ └── similar/ # Similar Movies page
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page with upload
├── components/ # Reusable React components
│ ├── MemeCard.tsx # Meme grid item
│ ├── MemeUpload.tsx # Drag-drop upload component
│ ├── MovieCard.tsx # Movie information card
│ └── VideoPlayer.tsx # YouTube embed player
├── lib/ # Utility functions
│ ├── perplexity.ts # Perplexity AI integration
│ └── tmdb.ts # TMDB API integration
└── types/ # TypeScript types
└── index.ts # Shared type definitions
- Upload: User uploads a meme image via drag-drop or file picker
- Analysis: Image is stored in Vercel Blob and sent to Perplexity's vision model
- Extraction: AI identifies the movie/TV show reference and explains the joke
- Enrichment: App fetches detailed info from TMDB (posters, trailers, metadata)
- Storage: Analysis is cached in Vercel KV for fast retrieval
- Lore: Perplexity provides cultural context, awards, and trivia on demand
- Discovery: Users can find similar Movies or explore the full collection
| Package | Version | Purpose |
|---|---|---|
next |
15.5.6 | React framework with App Router support |
react |
19.1.0 | UI library |
react-dom |
19.1.0 | React DOM rendering |
@perplexity-ai/perplexity_ai |
^0.12.0 | AI-powered meme analysis using vision models |
@vercel/blob |
^2.0.0 | Cloud storage for uploaded meme images |
@vercel/kv |
^3.0.0 | Redis-backed cache for analysis results |
lucide-react |
^0.546.0 | Icon components for the UI |
tsx |
^4.20.6 | TypeScript executor for Node.js |
| Package | Version | Purpose |
|---|---|---|
typescript |
^5 | TypeScript language support |
@types/react |
^19 | React TypeScript type definitions |
@types/react-dom |
^19 | React DOM TypeScript type definitions |
@types/node |
^20 | Node.js TypeScript type definitions |
tailwindcss |
^4 | Utility-first CSS framework |
@tailwindcss/postcss |
^4 | PostCSS plugin for Tailwind CSS |
eslint |
^9 | JavaScript linter for code quality |
eslint-config-next |
15.5.6 | ESLint configuration optimized for Next.js |
@eslint/eslintrc |
^3 | ESLint RC configuration support |
npm run dev- Start development server with Turbopack (faster builds)npm run build- Build for production with Turbopack optimizationnpm start- Start production servernpm run lint- Run ESLint to check code quality
POST /api/analyze-meme- Upload and analyze a memeGET /api/meme/[id]- Get meme analysis by IDGET /api/movie/[id]- Get movie/TV show detailsGET /api/movie/[id]/lore- Get cultural context and awardsGET /api/movie/[id]/similar-memes- Find similar moviesGET /api/explore- Browse all analyzed memes
"API Key not found" error
- Ensure
.env.localexists in the project root - Verify API keys are set correctly (no quotes or extra spaces)
- Restart the development server after changing environment variables
Port 3000 already in use
npm run dev -- -p 3001Module not found errors
- Clear node_modules and reinstall:
rm -rf node_modules package-lock.json npm install
Build fails with TypeScript errors
- Check that all environment variables are set
- Run
npm run lintto identify code issues
Deploy to Vercel:
- Push your code to GitHub
- Import the project in Vercel
- Add environment variables in Vercel dashboard
- Enable Vercel Blob storage
- Enable Vercel KV storage
- Deploy!
MIT