A Next.js web app that generates mean crypto fortune cookies for X/Twitter users. Enter a handle and get roasted by randomly selected fortune cookie images.
- 🍪 Random fortune cookie generation with pre-made images
- 🐦 Twitter/X sharing with custom OpenGraph cards
- 📊 Basic analytics tracking
- 🎨 Beautiful gradient UI with TailwindCSS
- ⚡ Fast performance with Next.js 14 App Router
- 🔒 Secure with Supabase Row Level Security
- Frontend: Next.js 14 (App Router) + React + TailwindCSS
- Runtime: Vercel (Edge for static/SSR; Node serverless for API)
- Database: Supabase (Postgres)
- Asset hosting: /public/assets (Vercel)
- Deploy: Vercel
git clone <your-repo>
cd Fortune-cookie
npm install- Create a new Supabase project at supabase.com
- Go to SQL Editor and run the contents of
supabase-schema.sql - Get your project URL and anon key from Settings > API
Create a .env.local file:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
NEXT_PUBLIC_APP_URL=http://localhost:3000npm run devVisit http://localhost:3000 to see the app.
- Push your code to GitHub
- Connect your repo to Vercel
- Add environment variables in Vercel dashboard
- Update
NEXT_PUBLIC_APP_URLto your production domain
- Enter a Twitter/X handle (without @)
- Click "Tell me" to generate a fortune
- Share the result on X with the custom OpenGraph card
- The shared link shows the selected fortune cookie image
POST /api/fortune- Generate a new fortuneGET /api/variants- Get available image variantsGET /f/[slug]- View/share a specific fortune
image_catalog- Pre-made fortune cookie imagesfortunes- Generated fortune recordsevents- Analytics events (generate, view, share_click)
- Add SVG/PNG files to
public/assets/cookies/ - Insert new records into
image_catalogtable:
INSERT INTO public.image_catalog (id, url, weight, theme) VALUES
('your_image_id', '/assets/cookies/your_image.svg', 1, 'your_theme');Edit the SVG files in public/assets/cookies/ to change the fortune messages.
MIT License - see LICENSE file for details.