Auth-Gated Preview
Password cookie gate unlocks draft/preview content while public view stays published-only.
Run this experiment yourself
Demos are not embedded on this site. Deploy a standalone copy on Vercel or run the experiment app locally.
Local development
cd apps/experiments/auth-gated-preview pnpm install pnpm dev
Then open http://localhost:3010.
This is an experimental demo. Use it as a starting point for your own projects.
Auth-Gated Preview is a Wave 3 Batch H composition lab. Pure helpers live in logic.ts; missing providers or stores degrade honestly (never fabricate AI output).
Features
- Password unlock sets preview cookie
- Draft vs published content
- Lock clears cookie
API Reference
POST /api/unlock · GET /api/content · POST /api/lock
{ "password": "preview" }| Status | Cause |
|---|---|
200 | Success |
401 | Bad password |
Implementation Details
Validate
Inputs are length-capped in logic.ts; APIs return 400 for missing fields.
Run
Route Handlers compose AI SDK, Redis/Neon, or ImageResponse as documented. Fallbacks include honest notes.
Limitations
- Single shared password.
- No user accounts.
- Educational gate only.
Use in your project
Copy the Route Handler(s) and logic.ts from apps/experiments/auth-gated-preview/.
Deployment
Local Development
cd apps/experiments/auth-gated-preview
pnpm install
pnpm devConfiguration
| Variable | Required | Purpose |
|---|---|---|
PREVIEW_PASSWORD | No | Gate password (default preview) |