Skip to content

mikelninh/lucklab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

96 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Luck Lab πŸͺ¬

A psychologist found lucky people see things unlucky people miss. We built a tool that tests which one you are.

Live: lucklab.app

Luck Lab is a research platform that maps your "luck profile" across six trainable mechanisms β€” based on Richard Wiseman's 10-year empirical study and 12 wisdom traditions that independently arrived at the same conclusion: luck is not random. It's a trainable disposition.

An AI oracle named Tyche (Greek goddess of fortune) reads your quiz answers, finds contradictions you didn't see, and writes you a personalised Reading that people describe as "surprisingly specific."

Try it: Take the Reading β€” 3 minutes, free, no account.

The product

Three tiers, each answering a different question:

Tier Price What it answers
The Reading Free Who am I? β€” archetype + one tradition tease
Archetype Primer €9 Show me more. β€” full six-lever scores, tradition essay with real primary source, 7-day practice
Tyche's Reading €29 What's my plan? β€” personalised 30-day Reading, addressed by name, three tradition deep-dives, daily ritual, + 90-day Return (auto-recalibrated follow-up), + lifetime Synchronicity Journal, + one Gift Reading to send a friend

Free companion: The Luck Convergence Index β€” a 12,400-word research essay (36 citations) delivered by email.

Plus 7 long-form research essays (~29,000 words total) unlocking weekly at /research/*.

Stack

  • Next.js 16 (App Router, React 19, Turbopack)
  • TypeScript (strict, Zod validation at API boundaries)
  • Tailwind CSS v4 (inline theme, custom design tokens)
  • OpenAI β€” gpt-4o-mini for free tier, gpt-4o for paid Reading
  • Stripe Checkout (hosted β€” no PCI scope) + webhook for abandoned-cart recovery
  • Resend β€” email delivery, scheduled drip funnel
  • Plausible β€” privacy-first analytics (optional)
  • Vercel β€” hosting, Cron, edge OG images
  • No database yet β€” Stripe session metadata serves as persistence for MVP. Supabase schema prepared in /supabase/schema.sql for when we add Journal + Return + Gift persistence.

Quickstart

cd /Users/mikel/kairos
npm install
cp .env.example .env.local     # fill in real keys
npm run dev                     # http://localhost:3000

Without keys the app still runs β€” Tyche returns deterministic fallback copy and checkout explains what's missing.

With keys configured:

  • Tyche narrates Readings with specific reference to the user's inputs + personal context
  • Stripe Checkout collects the payment and redirects to /reading/full?session_id=…
  • Full AI Reading is generated on that page load (~20–40s)
  • Resend fires a 5-step welcome drip on email capture
  • Stripe webhook triggers €5-off recovery on abandoned checkouts
  • Vercel Cron posts weekly social drafts + monthly stats + seasonal campaigns

Architecture

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ page.tsx                        # landing (5 sections + pricing rail)
β”‚   β”œβ”€β”€ reading/page.tsx                # the quiz β€” intake + 10 inputs (client)
β”‚   β”œβ”€β”€ reading/preview/page.tsx        # free result + unlock CTAs (client)
β”‚   β”œβ”€β”€ reading/primer/page.tsx         # €9 Primer page (server, Stripe-gated)
β”‚   β”œβ”€β”€ reading/full/page.tsx           # €29 full Reading (server, Stripe-gated)
β”‚   β”œβ”€β”€ research/page.tsx               # article index (publish-date gated)
β”‚   β”œβ”€β”€ research/[slug]/page.tsx        # article page (SSG, JSON-LD, OG)
β”‚   β”œβ”€β”€ research/[slug]/opengraph-image.tsx   # per-article OG image
β”‚   β”œβ”€β”€ convergence-index/page.tsx      # the 12,400-word lead magnet (readable + print-to-PDF)
β”‚   β”œβ”€β”€ about/page.tsx                  # builder-mystic positioning
β”‚   β”œβ”€β”€ privacy/page.tsx                # GDPR-compliant privacy policy
β”‚   β”œβ”€β”€ terms/page.tsx                  # ToS (EU digital-goods consent, 90-day Return)
β”‚   β”œβ”€β”€ opengraph-image.tsx             # root OG image (dynamic, edge)
β”‚   β”œβ”€β”€ sitemap.ts                      # auto-includes published articles
β”‚   β”œβ”€β”€ robots.ts                       # allows AI crawlers
β”‚   β”œβ”€β”€ not-found.tsx                   # on-brand 404
β”‚   β”œβ”€β”€ error.tsx                       # error boundary
β”‚   └── api/
β”‚       β”œβ”€β”€ tyche/read/route.ts         # free preview (gpt-4o-mini) + rate-limited
β”‚       β”œβ”€β”€ checkout/route.ts           # Stripe Checkout Session (tier: primer | full)
β”‚       β”œβ”€β”€ subscribe/route.ts          # email capture + 5-step Resend drip
β”‚       β”œβ”€β”€ stripe/webhook/route.ts     # abandoned-cart recovery with €5-off promo codes
β”‚       └── cron/
β”‚           β”œβ”€β”€ weekly-social/route.ts  # drafts X + LinkedIn posts (Wed 09:00)
β”‚           β”œβ”€β”€ weekly-digest/route.ts  # emails subscribers the new essay (Fri 10:00)
β”‚           β”œβ”€β”€ seasonal/route.ts       # solstices/equinoxes/NY campaigns
β”‚           └── monthly-stats/route.ts  # Stripe revenue report (1st of month)
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Nav.tsx Β· Footer.tsx            # layout chrome
β”‚   β”œβ”€β”€ TycheSigil.tsx                  # brand mark (SVG, iconographic)
β”‚   β”œβ”€β”€ EmailCapture.tsx                # Convergence Index opt-in form
β”‚   └── DownloadPdfButton.tsx           # print-to-PDF via @media print
└── lib/
    β”œβ”€β”€ traditions.ts                   # the 12 traditions + 6 mechanisms (data)
    β”œβ”€β”€ diagnostic.ts                   # 10 questions, scoring, archetype assignment, birth context
    β”œβ”€β”€ tyche-prompt.ts                 # Tyche's character + 3 prompt templates (teaser/primer/full)
    β”œβ”€β”€ articles.ts                     # markdown loader + publish-date gating
    β”œβ”€β”€ answer-codec.ts                 # compact encode for Stripe metadata
    β”œβ”€β”€ email-templates.ts              # 6 styled HTML email templates
    β”œβ”€β”€ rate-limit.ts                   # in-memory IP bucket limiter
    β”œβ”€β”€ cron-auth.ts                    # CRON_SECRET verifier
    β”œβ”€β”€ jsonld.ts                       # Schema.org helpers (Org/Article/Product/FAQ)
    β”œβ”€β”€ analytics.ts                    # Plausible track() helper, 9 conversion events
    └── supabase.ts                     # client stubs (enable when schema is applied)

content/
β”œβ”€β”€ luck-convergence-index.md           # 12,400-word lead magnet, 36 citations
└── articles/                            # 7 blog articles, ~29,000 words, YAML frontmatter
    β”œβ”€β”€ how-to-be-luckier.md             [pillar, 4,064w]
    β”œβ”€β”€ jung-synchronicity.md            [2,801w]
    β”œβ”€β”€ luck-factor-wiseman.md           [3,498w]
    β”œβ”€β”€ wu-wei.md                        [2,872w]
    β”œβ”€β”€ am-i-lucky.md                    [1,789w β€” quiz driver]
    β”œβ”€β”€ kairos-meaning.md                [2,806w]
    └── amor-fati.md                     [2,977w]

supabase/
└── schema.sql                           # subscribers, readings, journal_entries, gift_codes (when ready)

docs/
└── PDF-SERVER.md                        # server-side PDF sketch (Puppeteer on Vercel) for later

MARKETING.md                             # 8,000-word go-to-market plan with templates
LEARN.md                                 # pedagogical walkthrough of every pattern in the repo

Data flow β€” free Reading to paid purchase

user β†’ /reading                       β†’ 10 inputs + name (required) + optional birthdate/question
                                       β†’ POST /api/tyche/read (gpt-4o-mini)
                                       β†’ free teaser JSON {archetype, tradition-tease, unlock-prompt}
     β†’ /reading/preview               β†’ renders teaser + LOCKED visual for scores
                                       β†’ "Unlock €9" or "Unlock €29"
                                       β†’ POST /api/checkout {tier}
                                       β†’ Stripe hosted checkout
Stripe β†’ pays β†’ redirect              β†’ /reading/primer?session_id=X
                                   OR β†’ /reading/full?session_id=X
                                       β†’ server verifies session.payment_status === 'paid'
                                       β†’ decodes answers + personal context from metadata
                                       β†’ calls OpenAI (gpt-4o-mini for Primer, gpt-4o for Full)
                                       β†’ renders the typeset Reading
                                       β†’ "Download as PDF" β†’ @media print β†’ save PDF

Why this works without a database

Diagnostic answers compact to ~60 bytes and fit comfortably in Stripe's 500-char metadata limit. Personal context fits in another ~120 bytes. We fetch the session back from Stripe on the return URL and regenerate the Reading. This trades a little OpenAI cost (~€0.10 per Reading) for zero infrastructure.

Graduation path: the Supabase schema in /supabase/schema.sql adds persistence, journal, 90-day Return automation, and Gift Reading redemption when we want them.

Deploying to Vercel

vercel --prod

Production deploy was made April 15 2026 from the main branch β€” see top of file for URL. Custom domain is the next step: buy kairos.lab (or similar), add to Vercel β†’ Project β†’ Settings β†’ Domains.

Required env vars for a fully live production:

OPENAI_API_KEY=sk-proj-…
STRIPE_SECRET_KEY=sk_live_…
STRIPE_WEBHOOK_SECRET=whsec_…
RESEND_API_KEY=re_…
RESEND_AUDIENCE_ID=aud_…              # for weekly-digest cron
EMAIL_FROM="Tyche Β· Luck Lab <tyche@kairos.lab>"
NEXT_PUBLIC_APP_URL=https://kairos.lab
NEXT_PUBLIC_PLAUSIBLE_DOMAIN=kairos.lab
CRON_SECRET=<long-random-string>
ADMIN_EMAIL=you@wherever.com

Optional (enables Journal/Return/Gift when ready):

NEXT_PUBLIC_SUPABASE_URL=…
NEXT_PUBLIC_SUPABASE_ANON_KEY=…
SUPABASE_SERVICE_ROLE_KEY=…

Stripe webhook setup

In Stripe Dashboard β†’ Developers β†’ Webhooks, add endpoint https://<your-domain>/api/stripe/webhook, select event checkout.session.expired, copy the signing secret into STRIPE_WEBHOOK_SECRET.

Brand

  • Platform: Luck Lab
  • AI character: Tyche (Greek goddess of fortune)
  • Palette: midnight #0a0a0d Β· antique gold #c9a961 Β· scholar purple #a78bfa
  • Fonts: Fraunces (display serif), Geist (sans), Geist Mono (accents)
  • Voice: calm-scholarly-warm, British English, no woo, no flattery

See /about for the positioning statement β€” honest mysticism, built carefully.

What's shipped (April 15 2026)

  • Landing page with 4 anchor sections + pricing rail
  • Reading flow β€” 10 inputs + optional personal context (name/birthdate/question)
  • Free Tyche teaser + €9 Primer + €29 full Reading with 90-day Return + Journal + Gift
  • 7 weekly-unlocking research articles (~29,000 words)
  • Convergence Index lead magnet (~12,400 words, 36 citations, readable + print-to-PDF)
  • /about builder-mystic page, /privacy, /terms, on-brand 404 + error pages
  • Email drip funnel (5-step) + abandoned-checkout recovery
  • Rate limiting, JSON-LD structured data, dynamic OG images, sitemap, robots
  • 4 automation cron routes (weekly social + weekly digest + seasonal + monthly stats)
  • Plausible-ready analytics with 9 conversion events
  • Deployed to Vercel production

Roadmap

  • Custom domain (lucklab.app)
  • Claude Sonnet AI + two-pass pipeline
  • Premium share cards (6 archetype backgrounds)
  • Convergence Index PDF (typeset, 22 pages)
  • Supabase β†’ Reading persistence + Journal + 90-day Return
  • Server-side PDF rendering (Puppeteer on Vercel)
  • Affiliate program (Stripe promo codes)
  • Video Reveal cards (Remotion)

Docs

docs/
β”œβ”€β”€ strategy/
β”‚   β”œβ”€β”€ LAUNCH.md              β€” 14-day launch script
β”‚   β”œβ”€β”€ LAUNCH-POSTS.md        β€” copy-paste ready posts (X, Reddit, LinkedIn, HN)
β”‚   β”œβ”€β”€ MARKETING.md           β€” full go-to-market plan (launch β†’ year 1)
β”‚   β”œβ”€β”€ PLAYBOOK.md            β€” reusable blueprint for AI digital products
β”‚   β”œβ”€β”€ SPRINT-10K.md          β€” $10K month-1 revenue plan
β”‚   └── TODAY.md               β€” today's action items
β”œβ”€β”€ PDF-SERVER.md              β€” server-side PDF rendering sketch
β”œβ”€β”€ SHARE-CARDS-ROADMAP.md     β€” 4-phase share card upgrade plan
β”œβ”€β”€ exemplar-yielder-full.md   β€” hand-written 12/10 Reading for prompt calibration
β”œβ”€β”€ convergence-index.typ      β€” Typst template for PDF generation
└── convergence-template.typ   β€” Typst cover page template

LEARN.md                       β€” pedagogical walkthrough (737 lines, 14 sections)
supabase/schema.sql            β€” DB schema for next phase

Tags

luck synchronicity AI-oracle personality-quiz wisdom-traditions Jung Taoism Stoicism Wiseman Kabbalah Buddhism Sufism luck-factor trainable-luck kairotic-profile archetype Claude-Sonnet Next.js Stripe Vercel Tailwind Resend Plausible digital-product SaaS email-funnel conversion-optimization SEO share-cards


Β© 2026 Luck Lab. Built by Mikel Ninh, Berlin. Code: MIT license. Content: all rights reserved.

About

A psychologist found lucky people see things unlucky people miss. We built a tool that tests which one you are. πŸͺ¬ lucklab.app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors