RizzCode is LeetCode-style practice for dating and grounded social fluency. This GPT comparison build implements the approved MVP contract in docs/RIZZCODE_MASTER_PLAN.md while preserving the Taste visual direction.
RizzCode ships with a repo-native brand package so product work does not recreate visual decisions feature by feature:
- Brand system and usage contract
- Canonical logo assets
- Tokens and components in
src/design-system - Living inventory at
/brand-system - Automated guardrail through
npm run check:brand
Import shared UI from the package boundary:
import { BrandButton, BrandLogo, RizzMeter } from "@/design-system";- Four-question onboarding, skip path, personalized starting module, two skill priorities, Growth Direction, and one optional Side Quest
- Spark and Connection curriculum with all 67 scenarios available immediately
- Exactly 67 playable In Person and Messaging scenarios from the closed catalog
- Three to six user-authored turns, with earlier persona or boundary exits
- Server-side adaptive persona reactions using
gpt-5.4-nanoby default - Messaging draft preparation after five idle seconds, plus Sent, Delivered, Seen, and persona typing states
- Server-only LLM judge using Vercel AI SDK v6,
@ai-sdk/openai, Zod,generateText(), andOutput.object() - Five evidence-backed rubric criteria, deterministic gates and arithmetic, and FUMBLED, COOKED, or ATE verdicts
- Likely simulated outcomes, improved-response coaching, XP, levels, streaks, personal bests, achievements, and recommended next reps
- A 53-week contribution graph of completed judgments, grouped by captured local calendar date with accessible count labels and 0/1/2/3/4+ intensity
- Demo leaderboard choice A using practice XP only
- Private self-reported real-world milestones that add zero public XP
- Versioned local persistence, isolated corrupt-record recovery, storage warnings, judge retry, unknown-route handling, and authored persona fallback
- Responsive and keyboard-usable product views at mobile, tablet, and desktop sizes, with reduced-motion support
- Three completed scenarios for guests before the fourth new scenario asks for an account; completed scenarios remain replayable without signing in
- Supabase Google OAuth and email/password accounts with login, logout, password recovery, protected account management, and self-service deletion
- Direct login access from both the public landing navigation and product navigation
- Guest reps, XP, attempts, profile, and milestones merge into the account on first login, then sync across signed-in devices
- Mythos marketplace launches: a consumer opened from Mythos skips the guest limit and login gate, and every persona turn and judgment is metered to their Mythos wallet (docs/MYTHOS_INTEGRATION.md)
- Guest activity merges by attempt ID without double-counting; signed-in activity remains in a dedicated RLS-protected per-attempt ledger across devices
- Transcript-bound judgment idempotency prevents duplicate provider calls and lets a lost-response retry reuse the validated server result
The historical /control and /compare prototype routes remain available as
visual references. They are not the production product path.
The codex/rizzcode-nextjs-67 branch combines the shipped Next.js build with
the closed catalog supplied in RIZZCODE_67_PROBLEMS_GITHUB_SPEC (1).md.
src/data/scenarios/catalog.ts is an exact mechanical copy of that catalog. A
small adapter makes all 67 canonical RC-001 through RC-067 problems
available to the curriculum, briefing, adaptive persona, fallback, judge, and
progress flow. The list shows the global problem number and tested skills, and
the briefing shows the scenario-specific tips.
This catalog integration does not claim to implement the supplied document's separate signed-session V2 API, per-turn coaching object, or seven server-only interaction-profile prompts. Those are a distinct runtime migration, not part of adding the closed catalog to the current product.
Install dependencies:
npm installCreate a private .env.local in this worktree:
cp .env.example .env.localSet OPENAI_API_KEY inside .env.local. Add the Supabase project URL,
publishable key, server-only secret key, and local site URL:
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
SUPABASE_SECRET_KEY=
NEXT_PUBLIC_SITE_URL=http://127.0.0.1:4173The publishable key is intentionally browser-visible. SUPABASE_SECRET_KEY
must remain server-only and is used only by DELETE /api/account. Never give
it a NEXT_PUBLIC_ prefix.
In Supabase Auth URL Configuration, add the deployed and local recovery destinations:
https://rizzcode-nextjs.vercel.app/auth/callback
https://rizzcode-nextjs.vercel.app/auth/reset
http://127.0.0.1:4173/**
Google login uses Supabase's PKCE OAuth flow. The Google client secret belongs in Supabase Auth, not in Vercel and not in this repository.
- In Google Auth Platform, configure Branding, Audience, and the
openid, email, and profile scopes. - Create an OAuth Client ID with application type Web application.
- Add
https://rizzcode-nextjs.vercel.appas an authorized JavaScript origin. Add the local origin while developing. - Add the callback URL shown on the Supabase Google provider page as the
authorized redirect URI. It has the form
https://<project-ref>.supabase.co/auth/v1/callback. - In Supabase Dashboard, open Authentication, then Sign In / Providers, enable Google, and paste the Google Client ID and Client Secret.
- In Supabase Auth URL Configuration, keep the production Site URL and the
/auth/callbackredirect URLs above allowlisted.
The browser calls signInWithOAuth({ provider: "google" }), Supabase exchanges
the PKCE code, and RizzCode returns the user to the scenario that triggered the
login prompt. On the first authenticated load, the app merges the guest's
local profile, reps, XP, attempts, and milestones with any existing account
state. It saves the merged record to both Supabase and the current browser, so
the account can restore that progress on another device without discarding
newer local work.
Deliver supabase/migrations/20260719012231_account_state_sync.sql through the
main-branch Supabase Migrations CD workflow to the same Supabase project used by
production auth. The migration creates one versioned JSON state row per user,
enables row-level security, grants no anonymous access, and limits authenticated
reads and writes to auth.uid() = user_id. Account deletion removes the state row
through the foreign-key cascade.
Before deploying the judge reliability change, configure the GitHub Supabase
migration pipeline in docs/SUPABASE_MIGRATIONS.md.
The main-branch CD workflow, never a developer machine or agent tool, applies
supabase/migrations/20260720065000_judgment_idempotency.sql. It adds the server-only
judgment claim/result cache, the per-attempt authenticated activity ledger, and the
judge.reused observability event.
The exact rollout and verification sequence is in
docs/JUDGE_RELIABILITY.md.
For production email delivery, configure custom SMTP in Supabase. The built-in mailer is rate-limited and intended for initial testing.
The optional
RIZZCODE_PERSONA_MODEL defaults to gpt-5.4-nano; the separate
RIZZCODE_JUDGE_MODEL defaults to gpt-5.6-luna.
The server writes one-line JSON events for every committed persona turn and
every judge operation. In Vercel Runtime Logs, filter for
rizzcode-conversation or an attemptId. The event names are:
persona.turn.completedpersona.provider.failedjudge.startedjudge.completedjudge.failedjudge.reused
Events include the canonical transcript, scenario, model, persona state, fallback status, parsed model result when available, and bounded validation error details. They intentionally exclude session tokens, authorization headers, API keys, and other request headers. Conversation text is included because these logs are for production debugging, so access to Runtime Logs must remain restricted to trusted operators.
The same committed events are appended to the server-only
public.rizzcode_conversation_events Supabase table. It preserves user
messages, persona replies, judge results and failures, model identity, and the
authenticated user ID when available. RLS is enabled; anon and
authenticated have no table access. Only the backend SUPABASE_SECRET_KEY
writer can insert or inspect these records. Idle, unsent draft preparation is
not persisted.
Then run:
npm run devOpen http://127.0.0.1:4173.
To use the existing ignored environment file in the original checkout without copying it:
set -a
source /Users/edwardtran/side-projects/leetcode-for-dating/.env.local
set +a
npm run devThe shell loads that file for the process only. It never prints or sends the key
to the browser. Without a server-side key, persona turns use labeled authored
fallbacks, while official judgment remains unscored and offers Retry judgment.
npm run test
npm run test:e2e
npm run check
npm run buildThe Playwright suite starts the server with server-boundary mock persona and judge providers. It checks the full first-visit flow, bounded adaptive turns, double-submit prevention, open scenario access, idle draft preparation, Sent/Delivered/Seen states, persistence after refresh, Messaging mode, unknown routes, judge failure, and 375px, 768px, and 1440px layouts.
An opt-in live provider smoke test is available:
RIZZCODE_ENV_FILE=/absolute/path/to/.env.local npm run test:live-judgeIt prints only pass or failure metadata, never the credential or transcript.
- Next.js 16 App Router serves the product through
src/app/[[...slug]]/page.tsx. src/app/api/[...path]/route.tsownsPOST /api/persona/prepare,POST /api/persona, andPOST /api/judgein one Node route module. These practice endpoints accept guests and attach a Supabase access token when a signed-in user has one.src/app/api/account/route.tsverifies the caller's Supabase access token before deleting that exact user with the server-only secret key.src/context/AuthContext.tsxowns browser session restoration, Google OAuth, and email/password auth actions./auth/callbackexchanges OAuth or confirmation codes, preserves a safe local return path, and/auth/resetexchanges recovery codes before accepting a new password.server/persona/owns prompt-safe adaptive generation, draft preparation, idempotency, authored fallback, and the bounded canonical conversation store.server/runtime.tsselects production or non-production test providers without exposing environment variables to the client.server/judge/provider.tsis the only production provider path.server/judge/service.tsrequires the server-owned conversation, invokes the separate judge provider, validates exact evidence, safety consistency, and scenario outcome codes, recalculates scores, applies caps, and derives the verdict. The judge model owns normal-language safety and outcome classification; server code does not reclassify either with phrase lists.src/engine/conversationEngine.tsowns client-visible attempt transitions, action rendering, delivery states, and authored fallback behavior.src/domain/owns pure scoring, XP, onboarding, validation, and next-rep logic.src/storage/stores.tsowns the four versioned local records.
Browser requests contain the scenario ID, attempt ID, contiguous turn, bounded user text, and an opaque signed conversation receipt after the first turn. The receipt lets any Vercel instance verify and restore the canonical transcript without trusting client-authored state. In Messaging mode, a draft is sent for reply preparation only after five seconds without keyboard input; it does not advance the canonical turn. Client-supplied persona replies, scores, XP, gates, outcomes, and leaderboard values are rejected.
The MVP stores no secrets and uses only:
rizzcode.v1.profilerizzcode.v1.progressrizzcode.v1.attemptsrizzcode.v1.milestones
At most 100 attempts are retained. A malformed record resets only itself. If storage is unavailable, practice continues in memory with a visible warning. Canonical active conversation state travels in a six-hour, tamper-resistant server-signed receipt. The process-local cache improves idempotency and draft preparation latency, but it is not required for turn-to-turn correctness across serverless instances.
Guest access is a conversion gate, not an authorization boundary. The client allows one completed scenario and asks for login before another new scenario. Authenticated guided-practice credits and paid access are enforced server-side when the first AI generation starts for a new attempt. Stripe Checkout, webhooks, and setup are documented in docs/STRIPE_BILLING.md. Account deletion remains server-authenticated.
TinyFish, profile scraping, voice, avatars, video, live humans, automated messages, Elo ratings, a real global leaderboard, course infrastructure, attractiveness scoring, therapy, and attachment diagnosis are not included.