Meme management and sharing platform with video support, premium subscriptions, and a TikTok-style reels experience. Built as a full-stack React 19 application with server-side rendering.
Available in French and English.
- Video meme library with HLS streaming and reels navigation
- User authentication (email/password, Twitter OAuth)
- Bookmarking and favorites system
- Premium subscriptions via Stripe
- Full-text search powered by Algolia
- Admin dashboard for content management (upload, moderation, analytics)
- Meme import directly from Twitter/X URLs
- SEO-optimized with structured data and dynamic Open Graph images
- Transactional emails (verification, password reset)
| Category | Technology |
|---|---|
| Framework | TanStack Start (React 19, SSR, Nitro) |
| Routing | TanStack Router (file-based) |
| Data Fetching | TanStack Query |
| Forms | TanStack Form |
| Database | Prisma ORM + PostgreSQL |
| Auth | Better Auth |
| Payments | Stripe |
| Video | Bunny CDN + HLS.js |
| Search | Algolia |
| Resend + React Email | |
| Styling | Tailwind CSS 4 + shadcn/ui |
| Validation | Zod |
| State | Zustand |
| Analytics | Algolia Analytics |
| Service | Purpose |
|---|---|
| Vercel | Hosting (serverless, auto-deploy from main) |
| Neon | PostgreSQL database |
| Bunny CDN | Video storage and HLS delivery |
| Stripe | Payment processing and subscriptions |
| Algolia | Search indexing and analytics |
| Resend | Transactional emails |
- Node.js 24
- pnpm 12
- A PostgreSQL database
- Stripe account (test or live)
- Bunny CDN account with a video library
- Algolia account with a search index
- Resend account
git clone https://github.com/viclafouch/petit-meme
cd petit-meme
pnpm installCopy the example file and fill in your values:
cp .env.example .env.developmentsrc/env holds the schemas. pnpm run env:check compares their keys with .env.example, .env.development, .env.e2e, .env.preview and Vercel Production and Preview, and names each missing or extra key. CI runs it on .env.example only.
Vercel stores every credential as a Secret, write-only after saving, on Production and Preview. Local development reads .env.development, never vercel env pull.
Apply the migrations to your database:
pnpm exec dotenv run -f .env.development -- pnpm exec prisma migrate devpnpm run devPrisma Migrate is used to manage schema changes safely across environments.
After modifying prisma/schema.prisma:
pnpm exec dotenv run -f .env.development -- pnpm exec prisma migrate dev --name descriptive_nameThis creates a migration file, applies it to the local database, and regenerates the Prisma Client.
Vercel auto-deploys on push to main. After a deploy that includes new migrations:
pnpm run prisma:migrate:prodThis uses .env.production, which holds only the production DATABASE_URL. Copy that connection string from the Neon console: Vercel stores it as a Secret, so vercel env pull returns it empty. The command applies only pending migrations and is safe and idempotent.
- Migrations must be additive only: new optional fields, new indexes, new tables
- Never drop or rename columns, tables, or enums on production
- New required fields must have a
@default()value - Never use
prisma db pushon production - Always review the generated SQL before committing
Stripe webhooks handle subscription lifecycle events (creation, renewal, cancellation).
Use the Stripe CLI to forward events to your local server:
stripe listen --forward-to localhost:3000/api/auth/stripe/webhookThe CLI outputs a webhook signing secret (whsec_...). Add it to your .env.development as STRIPE_WEBHOOK_SECRET.
- Go to Stripe Dashboard > Webhooks
- Add endpoint:
https://yourdomain.com/api/auth/stripe/webhook - Select the relevant subscription and checkout events
- Copy the signing secret to your production environment
| Command | Description |
|---|---|
pnpm run dev |
Start development server |
pnpm run build |
Build for production |
pnpm start |
Start production server |
pnpm run check |
Typecheck, lint, Knip, unit tests and format check, cached by Turbo |
pnpm run typecheck |
TypeScript check |
pnpm run lint |
oxlint |
pnpm run lint:fix |
Auto-fix lint issues |
pnpm run knip |
Find unused files, exports and dependencies |
pnpm run env:check |
Compare the env schemas with every env file and Vercel |
pnpm run prisma:migrate:dev |
Apply pending migrations (via .env.development) |
pnpm run prisma:migrate:prod |
Apply pending migrations (via .env.production) |
pnpm run prisma:seed:dev |
Reseed dev with real Memes (via .env.development) |
pnpm run prisma:seed:preview |
Reseed the Preview stack with real Memes (via .env.preview) |
pnpm run email:dev |
Preview email templates on port 3001 |
src/
├── routes/ # Pages (TanStack Router file-based routing)
├── server/ # Server functions (auth, memes, admin, payments)
├── components/ # React components organized by domain
├── lib/ # Library integrations (auth, algolia, stripe, bunny)
├── constants/ # App constants and types
├── env/ # Env validation: client.ts for the browser, *.server.ts for the server
├── helpers/ # Pure utility functions
├── utils/ # Business logic utilities
├── hooks/ # Custom React hooks
├── stores/ # Zustand stores
├── db/ # Prisma client and generated types
└── i18n/ # Internationalization
prisma/ # Schema and migrations
emails/ # React Email templates
crons/ # Scheduled jobs (Algolia sync, Bunny updates)
The app is deployed on Vercel with automatic deploys from the main branch.
Vercel automatically installs dependencies, builds the app, and deploys serverless functions. Database migrations must be applied separately after each deploy that includes schema changes.
Every branch other than main deploys to Vercel Preview, which runs on its own stack and never reaches a production resource.
| Resource | Preview | Production |
|---|---|---|
| Database | Neon branch preview, child of dev |
Neon branch production |
| Payments | Stripe sandbox petit-meme-preview |
Stripe live mode |
| Search | Algolia indices preview_*, through keys scoped to them |
Algolia indices backup_* |
| Video | Bunny Stream library memes-preview on cdn-preview.petit-meme.io |
Bunny Stream library on cdn.petit-meme.io |
| Exports | Bunny Storage zone petit-meme-watermarked-preview, no pull zone, read by the server only |
petit-meme-watermarked-prod, same setup |
| Images | Bunny Storage zone petit-meme-images-preview on images-preview.petit-meme.io |
petit-meme-images-prod on images.petit-meme.io |
| Uploads | Vercel Blob store petit-meme-preview-files |
petit-meme-files |
| Emails | Resend, every recipient replaced by EMAIL_OVERRIDE_TO |
Real recipients |
Previews share the rest with production, since none of it holds data: the Sentry project (events tagged preview), the Twitter and Discord apps, the Gemini and Anthropic keys, and the Resend account.
- A preview serves on its branch URL: the build derives
VITE_SITE_URLfromVERCEL_BRANCH_URL, and Better Auth trusts both the branch URL and the deployment URL. Sign in with an email and a password: Twitter and Discord only know the production callback. - The preview build applies pending migrations to the
previewbranch before it builds, throughvercel.sh. - Stripe and Bunny send their webhooks to one fixed URL, so none reaches a preview. A test checkout still turns the account Premium on its return URL, but a cancellation or a renewal never syncs back, and a new upload waits for its first frame.
- Vercel keeps the schedules of a preview inactive, so nothing wakes the
previewbranch. - A preview sits behind Vercel Authentication, and the firewall's "Challenge suspicious bots" rule answers
429tocurlandvercel curl, bypass included. To test a preview from a script, open a share link in a real browser such as Playwright's Chromium, then call the app from the page.
.env.preview, kept out of Git, holds every Preview value, since Vercel keeps the Secrets write-only. pnpm run env:check compares it with Vercel Preview.
The seed rebuilds Preview, or dev, from real Memes:
pnpm run prisma:seed:preview
pnpm run prisma:seed:dev- It reads production, read only: the categories and the Memes listed in
prisma/seed-memes.json, with their record, translations and counters, and each original video. The production values come from.env.production, kept out of Git:DATABASE_URL,VITE_BUNNY_ORIGIN,BUNNY_TOKEN_AUTH_KEYandBUNNY_ORIGINAL_ACCESS_KEY. Read the last two from the Bunny API: the production pull zone'sZoneSecurityKeyand the original access key of its "Server only files" Edge Rule. - It refuses a target that shares the production database or Bunny origin, holds a live Stripe key, or sends emails to real recipients.
- It deletes the Stripe customers of its own accounts, never those of another environment sharing the Stripe account, then empties the target database, Bunny videos and their stored files, and copies the Memes. The listed
pendingandarchivedMemes take that status, and every date shifts so the newest Meme went out yesterday. - It creates one account per audience,
admin@,user@,premium@(Stripe monthly),ending@(Stripe yearly, cancelled) andoffered@petit-meme.dev, plus figurants. No account comes from production. They all share one password:SEED_PASSWORDfrom the shell, or a random one the seed prints. - It synthesizes the last 30 days of views, exports, bookmarks, Studio generations, AI searches and proposals, indexes Algolia, waits for Bunny to encode, then builds the first frames, watermarked videos and sounds.
The page holds 30 Memes, so the list keeps the French site past two pages, and the English site and one Category past one. A Meme that leaves production stops the seed: replace its id in the list.
A migration from a branch that never merges stays on preview. Reset the branch to its parent, then reseed:
neonctl branches reset preview --parentThe e2e suite runs offline, on its own machine, with no account anywhere. Playwright starts a throwaway Postgres 17 and one local emulator per outside service it reaches, all in memory for the length of one run (e2e/emulators). .env.e2e is committed: its keys are placeholders the emulators check.
| Resource | e2e |
|---|---|
| Database | embedded-postgres, created empty for each run |
| Payments | Stripe emulator, with the two prices of the catalog |
| Search | Algolia emulator, filled by the seed |
| Video, exports, images | Bunny emulator: one Stream library holding one 3 second video, its pull zones and its two Storage zones |
| Emails | Resend emulator |
| AI search | Anthropic emulator, answering the words of the prompt |
Each environment has its own Stripe: the development test account, the sandbox petit-meme-preview, live mode in production, and the emulator for e2e.
Any other request that leaves the machine fails the test that made it, in the app server, the Playwright workers and the browser alike.
Private - All rights reserved