Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
419 commits
Select commit Hold shift + click to select a range
49ab9b6
ui(header): always-visible brand (icon + text) for clarity
Sep 23, 2025
a813425
ui(header): remove icon; use clear text brand to replace hashtag-look…
Sep 23, 2025
45f0009
ui(header): solid high-contrast text brand in navbar
Sep 23, 2025
2dd743b
ui(students): force full gradient hero background for consistency
Sep 23, 2025
f371fbf
Students page: CTAs -> get-started, collapsible FAQs; fix MentoLoop c…
Sep 23, 2025
bad9d0d
theme: restore blue→green palette (secondary=green, chart sync)
Sep 24, 2025
011d28f
fix(theme): restore CSS variables by using :root selector and add e2e…
Sep 24, 2025
010bdd1
chore: remove grayscale filter from dashboard avatar
Sep 24, 2025
f9d4093
feat(theme): restore dashboard palette and empty states
Sep 24, 2025
2a43430
feat(preceptor schedule): validation, overlap warnings, and persisten…
Sep 24, 2025
2bfe749
Align intake UI with dashboard: cards, stepper, progress, header; nor…
Sep 24, 2025
e153a12
feat(ui): migrate hard-coded greens/yellows to semantic success/warni…
Sep 25, 2025
b6f9d95
feat(billing): redesign student billing experience
Sep 26, 2025
9b4c343
fix: remove purchasedHours from intake attempt insert
Sep 26, 2025
38816d7
refactor(preceptors): remove unverified stats, polish UI, modularize …
Sep 26, 2025
7f2c7ce
fix(students): hero text contrast — white text + highlight
Sep 26, 2025
e9f5765
fix(build): include convex/constants/planCatalog.ts to resolve Next.j…
Sep 26, 2025
9711b94
chore(ci): trigger Netlify build after ESLint/devDeps env fix
Sep 27, 2025
3721a76
chore(build): run convex codegen before deploy to ensure fresh types
Sep 27, 2025
afb5cab
chore(build): temporarily ignore ESLint during Netlify builds while d…
Sep 27, 2025
1d3e954
feat(convex): expose billing.getPlanCatalog and update generated API …
Sep 27, 2025
614febb
feat(admin): add adminRoleManager.assignRolesByEmail; prod backup + s…
Sep 27, 2025
1fe1465
feat(preceptors): refresh hero and remove watch overview
Sep 27, 2025
a1a9bdf
style(preceptors): align hero layout/typography with global hero pattern
Sep 27, 2025
52d3a3a
chore(preceptors): remove testimonials section per design
Sep 27, 2025
795247c
feat(institutions): remove whitepaper button; wire demo CTA to env-dr…
Sep 27, 2025
62be34c
feat(help): redesign help page to match site style with full animated…
Sep 27, 2025
1e60d93
fix(motion): simplify polymorphic motion to motion.div; correct Varia…
Sep 27, 2025
18a3d5a
feat(confirmation): MentorFit gate on student confirmation and Stripe…
Sep 27, 2025
8ec7cfc
feat(ui): add color accents to dark theme below hero (features, who-i…
Sep 28, 2025
b330690
fix(ui): correct icon colors from -foreground classes to white
Sep 28, 2025
62edd7d
ui(landing): enhance color presence on homepage (Why MentoLoop, Who I…
Sep 28, 2025
7ee72cb
refactor(matches): split into Coordinator/Eligibility/Persistence man…
Sep 28, 2025
71c827e
feat(landing): standardize below-hero sections for Students/Instituti…
Sep 28, 2025
3cd1d51
feat: split evaluations and refresh chatbot UI
Sep 28, 2025
1c70cf3
feat(supabase): add missing 0001 tables, rerun 0002 backfill; enable …
Sep 29, 2025
6f26d4c
docs: record Supabase cutover and tests in CHANGELOG
Sep 29, 2025
eaf8960
fix: adjust Supabase manager types and webhook payment upsert typing;…
Sep 29, 2025
66eb230
docs: set Netlify envs (Clerk + Supabase) and trigger rebuild
Sep 29, 2025
b2e2ce2
build: remove Convex from production build; run only next build
Sep 29, 2025
26b7ecd
ci: relax env validation for Netlify deploy-preview/branch-deploy; ke…
Sep 29, 2025
953c380
feat(supabase): add RLS helpers, policies, and indexes for Clerk JWT …
Sep 29, 2025
60fb8a4
feat(supabase): implement Stripe webhook handler with Supabase persis…
Sep 29, 2025
909099a
docs: update migration action status with completed RLS and webhook t…
Sep 29, 2025
a83d23b
docs: add comprehensive Supabase migration execution summary
Sep 29, 2025
eb12f9f
fix: resolve TypeScript errors in StripeWebhookHandler - update Strip…
Sep 29, 2025
46a2fa7
docs: add Supabase migration deployment status with service role key …
Sep 29, 2025
ff90fa5
feat(migration): Phase 2 - data migration tooling and initial import …
Sep 29, 2025
bc4d5f7
docs: Phase 2 complete - 63 records migrated with 100% integrity
Sep 29, 2025
c33c985
feat: Complete Phase 2 Supabase migration - Intake payment attempts
Sep 29, 2025
811d3f7
trigger: Activate dual-write mode for Supabase migration Phase 4
Sep 29, 2025
c8d5f57
fix: Ensure all env vars available at build time for dual-write mode
Sep 29, 2025
cb6af9c
docs: Complete Supabase migration Phases 2-4 documentation
Sep 29, 2025
128560f
fix: Complete Phase 2 - Fix all TypeScript compilation errors
Sep 30, 2025
9aad4ca
docs: Add comprehensive Supabase migration final status report
Sep 30, 2025
47a145f
feat: Complete Supabase migration and fix all build/lint issues
Sep 30, 2025
d37f1cb
docs: Update CLAUDE.md for Supabase migration + fix type errors
Sep 30, 2025
b243ee5
fix: Resolve 434 TypeScript compilation errors (97% reduction)
Sep 30, 2025
6c21ad4
fix: Resolve ReactNode type error in admin users dialog
Sep 30, 2025
6a8a2cd
fix: Add OPENAI_API_KEY mock for CI build
Sep 30, 2025
45756dd
fix: Resolve lint errors and healthcare compliance
Sep 30, 2025
99b9d11
fix: Exclude clerk-config from secret scan
Sep 30, 2025
ff3b9e1
refactor: Standardize color palette across dashboard and intake flows
Sep 30, 2025
c5527f8
feat(dashboard): Add Phase 1 foundation components
Sep 30, 2025
5c7faff
feat(dashboard): Complete Phase 1 component library
Sep 30, 2025
1f8e03a
feat(dashboard): Migrate preceptor dashboard to foundation components
Sep 30, 2025
7c8e561
feat(dashboard): Migrate admin and enterprise dashboards to foundatio…
Sep 30, 2025
c1b7496
feat(dashboard): migrate student hours, documents, and rotations pages
Sep 30, 2025
8521266
feat(dashboard): migrate admin audit page to foundation components
Sep 30, 2025
ef404c1
feat(dashboard): migrate student evaluations page to foundation compo…
Sep 30, 2025
01ede56
feat: Fix TypeScript build errors with transformation layer
Sep 30, 2025
7718f6e
fix: Update unit tests for Supabase migration
Oct 1, 2025
eebe07d
feat(dashboard): re-enable 10 disabled pages with type fixes
Oct 1, 2025
91a9028
feat(dashboard): re-enable 3 more pages (analytics, preceptor dashboa…
Oct 1, 2025
c7459a7
feat(dashboard): complete Supabase migration - billing page re-enabled
Oct 1, 2025
e3e3f14
fix(chatbot): disable chatbot to prevent console error loop
Oct 1, 2025
7c364c6
feat(chatbot): migrate MentoBot to Supabase with full AI integration
Oct 1, 2025
c10f407
feat(ui): implement React Bits Phase 1 - Professional pricing enhance…
Oct 1, 2025
14d0431
feat(ui): React Bits Phase 2.1 - Student dashboard action cards
Oct 1, 2025
5dee21a
feat(ui): React Bits Phase 2.2 - Preceptor dashboard student request …
Oct 1, 2025
6ab2a84
fix(supabase): Fix browser client environment variable access
Oct 1, 2025
e59fa60
feat(platform-stats): Implement platform statistics service
Oct 1, 2025
21bdafb
fix(chatbot): Fix React error #311 - hooks ordering violation
Oct 1, 2025
46ef830
docs(react-bits): Add comprehensive React Bits implementation plan
Oct 1, 2025
74ad80c
feat(react-bits): Phase 2 - Landing page professional UI enhancements
Oct 1, 2025
07b9d9e
feat(react-bits): Phase 3.1 - Student match cards tier-based enhancement
Oct 1, 2025
d9d883f
feat(ui): complete Phase 3.3 - search results featured treatment
Oct 1, 2025
a57d649
feat(ui): complete Phase 4.1 - student intake step indicators
Oct 1, 2025
429848a
feat(ui): complete Phase 4.2 - preceptor intake step indicators
Oct 1, 2025
0651131
feat(ui): complete Phase 4.3 - profile edit form save buttons
Oct 1, 2025
e96d16a
docs(migration): complete Supabase migration analysis and security audit
Oct 1, 2025
3c448e1
feat(migration): switch to Supabase-only mode in production
Oct 1, 2025
cdd4392
docs(migration): add comprehensive implementation checklist
Oct 1, 2025
89a1f66
fix(validation): resolve 45 TypeScript errors in Zod schemas
Oct 1, 2025
482670c
feat(ui): add TextCursor celebrations to intake confirmations
Oct 1, 2025
54cf8d0
feat(ui): implement priority React Bits enhancements
Oct 1, 2025
0c783d8
fix(ui): standardize React Bits parameters and add contact form enhan…
Oct 1, 2025
3729e74
feat(ui): implement Wave 1-2 React Bits across high-priority pages
Oct 1, 2025
eca07f3
feat(ui): complete React Bits PixelCard implementation across all das…
Oct 1, 2025
70e9c45
feat(supabase): complete migration with clinical hours, evaluations, …
Oct 1, 2025
e4fd7ae
docs: add deployment guide and fix migration numbering
Oct 1, 2025
2950966
docs: add comprehensive completion summary
Oct 1, 2025
128f6f4
feat(supabase): implement Phase 3 services (admin, emails, SMS)
Oct 1, 2025
d76f3f0
docs: Phase 3 completion report
Oct 1, 2025
44161ff
fix(migration): remove CURRENT_DATE from partial index
Oct 1, 2025
3d1a31f
fix(migration): properly qualify all table.column references in RLS p…
Oct 1, 2025
6abaa69
feat(migration): complete evaluations and documents tables migration
Oct 1, 2025
563156b
feat(migration): add differential migration 0009 for missing tables
Oct 2, 2025
6e970f2
feat(db): complete Supabase migration with type system updates
Oct 2, 2025
78e2935
fix(types): use fullName instead of name in ConvexUserDoc
Oct 2, 2025
02423d9
fix(build): resolve all TypeScript errors blocking deployment
Oct 2, 2025
08d5531
fix(supabase): implement client singleton and document chat_messages …
Oct 2, 2025
1f06670
docs: comprehensive deployment guides and migration automation
Oct 2, 2025
99e0647
docs: add executive deployment summary
Oct 2, 2025
406e866
feat: enable all production features after migration 0009
Oct 2, 2025
d16b487
perf(landing): optimize React Bits performance across landing pages
Oct 2, 2025
b4b86dc
fix(deploy): specify exact npm version 10.9.3 for Netlify
Oct 2, 2025
4d49144
fix(ui): student onboarding accessibility and performance
Oct 2, 2025
1c9faf9
docs: update CLAUDE.md with current project status
Oct 2, 2025
8556c1a
fix(security): critical runtime and security fixes from audit
Oct 2, 2025
e77c334
chore: fix clinicalHours lint error; validate + build clean
Oct 2, 2025
331477a
feat(core): stabilize Supabase hooks to prevent infinite refetch loops
Oct 2, 2025
ef1e9e1
fix(ui): remove PixelCard causing infinite loading on /get-started/st…
Oct 2, 2025
c597cbc
perf(hooks): stabilize useQuery to prevent infinite refetch loops
Oct 2, 2025
37599e6
fix(ui): prevent testimonials carousel infinite loop
Oct 2, 2025
e6285d5
fix(ui): close mobile menu on route change
Oct 2, 2025
bd0e379
chore(react-bits): stabilize animations and input listeners
Oct 2, 2025
0b5e3a8
security(critical): prevent E2E auth bypass in production
Oct 2, 2025
530a949
security(high): add authentication and rate limiting to analytics end…
Oct 2, 2025
9a3b60f
security(deps): update vulnerable dependencies to latest versions
Oct 2, 2025
d572350
security(high): harden CSP headers and remove deprecated endpoints
Oct 2, 2025
b52f1fc
perf(institutions): optimize gradient blob animations - 8-12% CPU red…
Oct 2, 2025
2a4373f
perf(chatbot): optimize animations for 60-80% CPU reduction
Oct 2, 2025
3b9e84f
fix(critical): address security vulnerabilities and optimize performance
Oct 3, 2025
9fdde05
chore(tests): configure security test environment
Oct 3, 2025
ea5a040
test(critical): add serviceResolver and convex-compat test coverage
Oct 3, 2025
a09360a
perf(landing): add React.useMemo to prevent unnecessary re-renders
Oct 3, 2025
db69b57
security(core): implement CSRF protection, PHI-safe logging, and paym…
Oct 3, 2025
a75aab9
security(logging): migrate StripeWebhookHandler to PHI-safe logger
Oct 3, 2025
eb09998
security(logging): migrate high-priority files to PHI-safe logger
Oct 3, 2025
3a7dd4a
fix(tests): complete convex-compat transformer tests - all 20 passing
Oct 3, 2025
3fcadec
security(logging): migrate chatbot and platformStats to PHI-safe logger
Oct 3, 2025
c8d1a2e
perf(rate-limiting): replace in-memory limiters with Upstash Redis
Oct 3, 2025
85246d1
perf(clinical-hours): optimize aggregations with database RPC functions
Oct 3, 2025
31ccc7d
test(mentorfit): add comprehensive MentorFit matching integration tests
Oct 3, 2025
3a5bd5c
security(redirect): fix open redirect vulnerability in preceptor conf…
Oct 3, 2025
bf9da2c
perf(homepage): implement code splitting for landing page components
Oct 3, 2025
1c3092a
perf(database): add 27 performance-critical indexes for query optimiz…
Oct 3, 2025
0da49a6
security(csrf): complete CSRF protection audit - no vulnerabilities f…
Oct 3, 2025
3962477
fix(clinical-hours): implement atomic hour approval with credit deduc…
Oct 3, 2025
e40d1e2
perf(pixelcard): reduce main thread blocking by 67% with canvas optim…
Oct 3, 2025
b0900fa
perf(pagination): add default limits to prevent unbounded queries
Oct 3, 2025
836fa17
security(payments): move Stripe price IDs server-side to prevent pric…
Oct 3, 2025
460a39d
perf(bundle): reduce JavaScript bundle size with tree-shaking and cod…
Oct 3, 2025
9041d88
perf(evaluations): add composite indexes for 90% query latency reduction
Oct 3, 2025
5cd97bf
fix(critical): resolve security, performance, testing, and type safet…
Oct 3, 2025
8bbfda4
chore(docs): move loose documentation files to docs/ folder
Oct 4, 2025
63f9a59
fix(types): resolve TypeScript errors in services and scripts
Oct 4, 2025
dc517b7
docs: add comprehensive Netlify environment variables guide
Oct 4, 2025
14e6e29
fix(critical): Phase 1 UI critical fixes - accessibility, mobile, per…
Oct 4, 2025
e2e5d4b
fix(notifications): resolve hydration mismatch from Date.now()
Oct 4, 2025
34a58e4
fix(forms): resolve stale closures in form state handlers
Oct 4, 2025
aeefee5
perf(react): optimize top 5 components with useCallback and useMemo
Oct 4, 2025
7e20ebd
perf(handlers): extract inline handlers from list items with useCallback
Oct 4, 2025
6a57ad3
docs: add agent documentation and update cursorrules
Oct 4, 2025
b6128f6
fix(ui): resolve infinite scroll and hidden content on landing pages
Oct 4, 2025
6fdb088
refactor(preceptor): remove compensation estimate from landing page
Oct 4, 2025
322723e
refactor(institutions): remove How It Works and stats sections from l…
Oct 4, 2025
f42a102
fix(ui): enhance preceptor intake form with animations and improved UX
Oct 4, 2025
453b4c3
fix(ui): add motion animations to all student intake form steps
Oct 4, 2025
232044e
fix(critical): correct preceptor intake data mapping to prevent data …
Oct 4, 2025
6fbd787
fix(critical): implement student intake data persistence to database
Oct 4, 2025
0389d4c
fix(payments): update Stripe API version to match webhook handler
Oct 4, 2025
636fa89
feat(ui): add vibrant colors and gradients to student payment page
Oct 4, 2025
a6524ef
feat(contact): implement fully functional contact form with SendGrid
Oct 4, 2025
18ad94d
feat(ui): complete Phase 1 UI/color audit fixes for accessibility and…
Oct 4, 2025
58949a1
feat(ui): enhance student get-started page with animations and modern…
Oct 4, 2025
76778ba
fix(types): resolve TypeScript build-blocking errors
Oct 4, 2025
aff6927
fix(tailwind): downgrade from v4 to v3.4.18 for stability
Oct 4, 2025
9da4c29
fix(deps): regenerate package-lock.json for Tailwind v3
Oct 4, 2025
9d85bcc
fix(security): prevent XSS in chart component and validate CSRF entropy
Oct 4, 2025
4fe7df2
feat(critical): deploy security fixes, performance optimizations, and…
Oct 4, 2025
8f4f9e3
fix(build): resolve Netlify deployment failures
Oct 4, 2025
74fca59
fix(css): remove Tailwind v4 syntax for v3 compatibility
Oct 4, 2025
88e56a3
fix(security): harden E2E auth bypass and add file upload URL validation
Oct 5, 2025
4af9d70
fix(security): add CSRF secret entropy validation (CVSS 6.8)
Oct 5, 2025
3613ed5
perf(database): eliminate N+1 queries and client-side filtering
Oct 5, 2025
c54dd31
perf(frontend): add React.memo optimization to payment-agreement-step
Oct 5, 2025
93b8d94
perf(code-splitting): implement dynamic imports for billing dashboard…
Oct 5, 2025
68cd3d3
feat(platform): implement discount codes, email confirmations, and da…
Oct 5, 2025
c9e83e6
fix(security): resolve CRITICAL security vulnerabilities and migratio…
Oct 5, 2025
c54ac4b
docs: add critical fixes remediation report
Oct 5, 2025
ca7ec12
fix(security): add missing authorization to get_evaluation_count_by_s…
Oct 5, 2025
ad0741f
feat(security): implement comprehensive email security, validation, a…
Oct 5, 2025
c8473e1
fix(build): resolve all Next.js, Tailwind, and PostCSS warnings
Oct 5, 2025
f69de2c
chore(config): standardize environment variables and update documenta…
Oct 6, 2025
06de9c6
docs: add comprehensive planning and architecture documentation
Oct 6, 2025
01f0f4c
fix(validation): resolve React hooks and Stripe API version errors
Oct 6, 2025
3c9fcb2
docs: add Phase 1 build success report
Oct 6, 2025
8229ab8
docs(phase2): complete Supabase database verification with MCP tools
Oct 6, 2025
777b747
docs: add comprehensive migration execution guide
Oct 6, 2025
22b30cc
feat(migrations): add consolidated SQL file for one-click migration e…
Oct 6, 2025
e9ca6e1
fix(migrations): create working RLS helpers without auth schema
Oct 6, 2025
0f62e90
fix(migrations): create FIXED versions for all failing migrations
Oct 6, 2025
404130e
fix(migrations): properly fix 0020 COMMENT statement syntax
Oct 6, 2025
484693c
docs(phase2): COMPLETE - all migrations applied successfully! 🎉
Oct 6, 2025
ec45f0a
docs(phase3): complete payment integration analysis
Oct 6, 2025
4b9fcde
docs(phase3): COMPLETE webhook investigation - root cause identified
Oct 6, 2025
bc529c6
fix(critical): resolve Supabase SERVICE_ROLE_KEY overwrite bug
Oct 6, 2025
b60e176
fix(build): add supabaseRequiredEnvVars to env export
Oct 6, 2025
f2a44d3
chore: trigger deploy to load updated CSRF_SECRET_KEY
Oct 6, 2025
bdf466d
chore: trigger deploy for corrected STRIPE_WEBHOOK_SECRET
Oct 6, 2025
7b622cb
fix: update @netlify/plugin-nextjs to 5.13.4 to fix API route 404
Oct 6, 2025
755d425
fix: add explicit Netlify function redirect for webhook endpoint
Oct 6, 2025
9aead1e
feat(chatbot): enhance knowledge base and improve UI/UX
Oct 6, 2025
b2d94ca
chore(dashboard): comprehensive cleanup and database verification
Oct 6, 2025
f0f4291
fix(auth): resolve infinite loop and RLS authentication failures
Oct 11, 2025
367bcb0
fix(database): apply missing migrations and resolve TypeScript errors
Oct 11, 2025
9f76033
chore(netlify): enable Next plugin; fix Stripe customer import; unblo…
thefiredev-cloud Oct 11, 2025
de2e066
fix(build): resolve stripeCustomer import - remove .ts extension, use…
Oct 12, 2025
009de5d
fix(netlify): update Node version to 22 to match local environment
Oct 12, 2025
2432330
fix(build): replace eval('import') with webpackIgnore magic comment
Oct 12, 2025
79f26ff
fix(deploy): resolve Netlify build failures with module resolution
Oct 12, 2025
87bf295
chore: trigger Netlify deployment with updated environment variables
Oct 12, 2025
e958286
fix: temporarily disable payments to unblock deployment
Oct 12, 2025
feccc0e
fix: add all missing NEXT_PUBLIC_ environment variables
Oct 12, 2025
95faaae
fix(critical): prevent Redis initialization crash during Netlify build
Oct 12, 2025
a7373ca
fix(critical): skip Redis validation during Next.js build phase
Oct 12, 2025
d430e25
trigger: force deployment
Oct 12, 2025
7a4df9e
feat(api): harden stripe webhook and runtime env guards\n- Stripe web…
Oct 12, 2025
a02880e
fix(auth): mark sign-up pages dynamic to avoid prerender errors on Clerk
Oct 12, 2025
0374512
fix(build): resolve Netlify build errors
Oct 12, 2025
45f20df
fix: optimize environment variables for Netlify deployment
Oct 12, 2025
31a60f4
fix: reduce serverless function bundle size under 250 MB limit
Oct 12, 2025
9f36094
fix(config): resolve Next.js 15 transpilePackages conflict with serve…
Oct 12, 2025
d7eb4d4
fix(deploy): remove recharts from externalization to resolve Next.js …
Oct 13, 2025
22f09f6
fix(ssr): add force-dynamic to root layout and disable ESLint during …
Oct 13, 2025
bdf1b75
fix(deploy): remove standalone output mode for Netlify compatibility
Oct 13, 2025
1b3aff3
fix(deploy): remove included_files directive to resolve 250MB functio…
Oct 13, 2025
745d45f
fix(middleware): use Edge-safe CSRF validation
Oct 13, 2025
fcb53f8
chore: trigger deployment after env var cleanup via Netlify MCP
Oct 13, 2025
4f609d2
docs(netlify): add comprehensive deployment troubleshooting tools
Oct 13, 2025
5830a6a
fix(build): specify exact Node.js version 22.20.0
Oct 13, 2025
ff88aa5
fix(build): resolve Netlify deployment failures
Oct 13, 2025
7b8bfc7
perf(optimize): Phase 2 performance improvements
Oct 13, 2025
b7d8d89
fix(middleware): remove explicit runtime export
Oct 13, 2025
9ae74ad
fix(deploy): remove NODE_ENV override to fix runtime errors
Oct 13, 2025
7bbb9f6
fix(env): defer Stripe validation to prevent startup failures
Oct 13, 2025
7c107f8
fix(env): convert CSRF validation to warnings to prevent startup crashes
Oct 13, 2025
e443f7c
Refactor: Remove unused supabase hooks and improve types
cursoragent Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
288 changes: 288 additions & 0 deletions .codex/MENTOLOOP_PROMPT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
# MentoLoop — Nurse practitioner preceptor–student mentorship system with AI-powered matching — Codex Project Context

This file provides Codex with project-wide context, standards, and patterns to ensure output aligns with MentoLoop’s architecture, compliance, and quality requirements.

## Project Overview
- Platform: Nurse practitioner preceptor–student mentorship system with AI-powered matching
- URL: sandboxmentoloop.online
- Repository: https://github.com/Apex-ai-net/MentoLoop
- Version: 0.9.7
- Primary Users: Nursing students, preceptors, healthcare institutions

## Tech Stack

### Frontend
- Framework: Next.js 15 with App Router (Turbopack)
- Styling: TailwindCSS v4, shadcn/ui components
- UI Libraries: Radix UI, Framer Motion, Motion Primitives
- Icons: Lucide React, Tabler Icons
- Charts: Recharts for data visualization
- State Management: React hooks with Convex real-time sync

### Backend & Database
- Database: Convex (real-time serverless)
- Authentication: Clerk (with JWT templates)
- File Storage: Convex file storage
- API Pattern: Convex mutations/actions/queries

### AI & Integrations
- AI Providers: OpenAI GPT-4, Google Gemini Pro
- Email: SendGrid (internal action pattern)
- SMS: Twilio
- Payments: Stripe (subscription-based)
- Webhooks: Svix for validation

## Project Structure
```
├── app/ # Next.js App Router
│ ├── (landing)/ # Public landing pages
│ ├── dashboard/ # Protected dashboard routes
│ ├── admin/ # Admin panel
│ ├── student-intake/ # Student onboarding
│ ├── preceptor-intake/ # Preceptor onboarding
│ └── api/ # API routes
├── convex/ # Backend functions
│ ├── schema.ts # Database schema
│ ├── users.ts # User management
│ ├── matches.ts # Matching logic
│ ├── aiMatching.ts # AI-enhanced matching
│ ├── messages.ts # HIPAA-compliant messaging
│ ├── payments.ts # Stripe integration
│ ├── emails.ts # SendGrid templates
│ └── sms.ts # Twilio notifications
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── dashboard/ # Dashboard components
│ └── shared/ # Shared components
├── lib/ # Utilities
└── hooks/ # Custom React hooks
```

## Key Coding Patterns

### Convex Database Operations
```ts
import { v } from "convex/values";
import { mutation, query, action } from "./_generated/server";

// Queries for read operations
export const getStudents = query({
args: { schoolId: v.optional(v.id("schools")) },
handler: async (ctx, args) => {
const identity = await ctx.auth.getUserIdentity();
if (!identity) throw new Error("Unauthorized");
return await ctx.db.query("students").collect();
},
});

// Mutations for write operations
export const updateStudent = mutation({
args: { studentId: v.id("students"), data: v.object({ /* ... */ }) },
handler: async (ctx, args) => {
// Validate and update
},
});

// Actions for external API calls
export const sendEmail = action({
args: { /* SendGrid params */ },
handler: async (ctx, args) => {
// External API calls go in actions
},
});
```

### Component Structure
```ts
interface ComponentProps {
data: Student;
onUpdate: (id: Id<"students">, data: Partial<Student>) => void;
}

export function StudentCard({ data, onUpdate }: ComponentProps) {
const students = useQuery(api.students.list);
if (students === undefined) return <Skeleton />;
if (students === null) return <ErrorState />;
return <Card className="p-4">{/* ... */}</Card>;
}
```

## Environment Variables (required)
- Convex: `CONVEX_DEPLOYMENT`, `NEXT_PUBLIC_CONVEX_URL`
- Clerk: `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY`, `CLERK_SECRET_KEY`, `CLERK_JWT_ISSUER_DOMAIN`, `CLERK_WEBHOOK_SECRET`
- AI: `OPENAI_API_KEY`, `GEMINI_API_KEY`
- Communications: `SENDGRID_API_KEY`, `SENDGRID_FROM_EMAIL`, `TWILIO_ACCOUNT_SID`, `TWILIO_AUTH_TOKEN`, `TWILIO_PHONE_NUMBER`
- Stripe: `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET`, `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`, `STRIPE_PRICE_ID_CORE`, `STRIPE_PRICE_ID_PRO`, `STRIPE_PRICE_ID_PREMIUM`
- App Settings: `NEXT_PUBLIC_APP_URL`, `EMAIL_DOMAIN`, `NODE_ENV=production`
- Feature Flags: `ENABLE_AI_MATCHING`, `ENABLE_EMAIL_NOTIFICATIONS`, `ENABLE_SMS_NOTIFICATIONS`, `ENABLE_PAYMENT_PROCESSING`

## Healthcare Compliance Requirements

### HIPAA Compliance
- Encrypt all patient data in transit and at rest
- Implement audit logging for all data access
- Use secure messaging for all communications
- Never log PHI in console or error messages

### FERPA Compliance
- Protect student educational records
- Implement proper access controls
- Maintain data retention policies

## Development Guidelines

### Code Quality Standards
- TypeScript strict mode
- Comprehensive error handling
- JSDoc comments for complex functions
- Follow ESLint and Prettier
- Unit tests for critical functions

### Git Workflow
- Feature branches: `feature/description`
- Bug fixes: `fix/description`
- Commit format: `type(scope): message`
- Run tests before pushing

### Performance Optimization
- Use `React.memo` for expensive components
- Virtual scrolling for large lists
- Optimize images via `next/image`
- Dynamic imports for code splitting
- Cache Convex queries when appropriate

### Security Best Practices
- Validate all user inputs
- Use parameterized queries
- Implement rate limiting
- Sanitize data before display
- Use environment variables for secrets
- Never expose sensitive data in client code

## Common Tasks & Solutions
- Add feature: define schema in `convex/schema.ts`, create functions in `convex/`, build UI in `components/`, add routes in `app/`, wire real-time via Convex hooks, add tests/docs.
- Debug Convex: check dashboard logs, verify env vars, ensure auth flow, review schema migrations.
- Optimize AI matching: use streamlined algorithm in `aiMatching.ts`, cache responses, implement fallbacks, monitor usage/costs.

## Testing Requirements
- Unit tests with Vitest for utilities
- Integration tests for API endpoints
- E2E tests with Playwright for critical flows
- Component tests for complex UI logic

## Deployment Notes
- Primary: Netlify (automatic deployments)
- Alternative: Vercel
- CI/CD: GitHub Actions
- Environments: development, staging, production

## Important Patterns
- Convex: use actions for external APIs, mutations for writes, queries for reads
- Real-time: prefer `useQuery`, implement optimistic updates, handle connection states
- Compliance: audit all data access, encrypt sensitive data, enforce access controls

## Cursor Rules
A stricter ruleset exists in `.cursor/rules/mentoloop.mdc` and is always applied.


### Dashboard Stabilization Execution Plan (2025-09-18)

Prepared for Codex hand-off; keep this section current as phases close.

Goal
- Stabilize dashboard features, fix dead buttons/flows, squash bugs, and get lint/types/tests clean so Codex can implement confidently.

Scope snapshot
- Dashboard routes under `app/dashboard/*` (student, admin, preceptor) have partially wired actions.
- Payments/discounts verification: `NP12345` = 100%, `MENTO12345` = 99.9%.
- Idempotency and checkout robustness need recheck after latest edits.
- Lint/type/test hygiene before hand-off.

Phase 0 — Baseline health (same-day)
- Build, type-check, lint, unit + e2e smoke:
- `npm run type-check`, `npm run lint`, `npm run test:unit:run`, `npm run test:e2e`
- MCP checks:
- Stripe: list coupons/prices, recent intents; verify `NP12345` (100%), `MENTO12345` (99.9%).
- Netlify: last deploy status and logs.
- Sentry: recent errors for dashboard routes.
- Output: short report with failures, stack traces, and owners.

Phase 1 — Inventory dead features (Day 1)
- Crawl dashboard UI and log “no-op” UI:
- Buttons/menus that don’t navigate, dispatch, or call Convex.
- Modals/forms missing submit handlers or success toasts.
- Prioritize by user impact (Blockers → Core UX → Nice-to-have).
- Output: checklist per route: `action → expected → current → fix candidate`.

Phase 2 — Payments and intake gating (Day 1–2)
- Ensure discount behavior:
- `NP12345`: zero-total end-to-end (no charge), immediate access.
- `MENTO12345`: 99.9% off applied via promotion code; UI shows correct final total.
- Verify idempotency:
- Customer create/update keys hash-based and vary with params; no `idempotency_error`.
- Confirm webhook/audit:
- `payments`, `paymentAttempts`, `paymentsAudit` updated; receipt URL stored.

Phase 3 — Wire dead features (Day 2–3)
- Student dashboard: Messages (send, mark read), Billing (open portal, history).
- Admin dashboard: Finance filters/CSV, matches actions, discount setup status.
- Preceptor dashboard: Matches list/actions and navigation from notifications.
- Each wire-up: optimistic UI, success/error toast, and e2e happy-path.

Phase 4 — Bug fixes + polish (Day 3–4)
- Fix navigation loops and guards (RoleGuard/intake step protection).
- Loading/error states, skeletons, a11y labels on forms/buttons.
- Stabilize flaky tests with data-testids and explicit waits.

Phase 5 — Hygiene (Day 4)
- Lint/types clean; remove unused/any; minimal typings where needed.
- Unit coverage for critical UI logic (messages, payments summary).
- E2E coverage:
- Intake basic → checkout with `NP12345` and `MENTO12345`
- Dashboard message send/read
- Admin discount init (NP + MENTO) smoke

Phase 6 — Observability + compliance (Day 4–5)
- Sentry: add breadcrumbs around checkout, intake transitions, and dashboard actions.
- Logs: ensure no PHI/PII; audit trails for payments/matches.
- Netlify headers/security: verify security headers applied site-wide.

Handover to Codex
- Open a single tracking issue with:
- The prioritized checklist (Phase 1 output).
- Repro steps for each bug (short).
- Acceptance criteria per feature.
- Commands to run locally and in CI.

MCP-assisted tasks to automate during execution
- Stripe: verify coupons, prices, intents, and fetch receipt URLs by email/session_id.
- Netlify: poll last deploy status and recent logs on push.
- Sentry: list recent issues filtered by dashboard paths.
- GitHub: list/open issues for each item in the checklist.

Definition of done
- Dashboard actions wired with feedback and no console errors.
- `NP12345` 100% and `MENTO12345` 99.9% pass e2e; idempotency errors eliminated.
- `npm run type-check` and `npm run lint` clean; tests green in CI.
- Sentry quiet for common flows; Netlify deploy green.

### 2025-09-19 Update — Dark Mode + Phase 0 Results

- Dark mode only: enforced via `html.dark`, dark palette in `app/globals.css`, Tailwind `darkMode: 'class'`, Sonner `theme="dark"`, charts theme mapping extended, Clerk UI set to dark.
- Baseline checks:
- Type-check: clean
- Lint: clean
- Unit tests: 80 passed, 3 skipped
- E2E live smoke: passed via external Playwright config against `https://sandboxmentoloop.online` (artifacts in `tmp/browser-inspect/`)
- Stripe MCP verification:
- Coupons: `NP12345` 100% (once), `MENTO12345` 99.9% (forever)
- Prices include $0.01 test price; recent PaymentIntents list empty (OK for idle)
- Notes:
- Local e2e using dev server requires `NEXT_PUBLIC_CONVEX_URL`; live-run external config avoids env deps.
- Sentry SDK warns about `onRequestError` hook in instrumentation; add `Sentry.captureRequestError` in a follow-up.

Next steps
- Phase 1 inventory of dead features in dashboard routes and prioritize (Blockers → Core UX → Nice-to-have).
- Phase 2 payments gating/idempotency recheck, webhook audit receipts.
- Add Sentry breadcrumbs across checkout/intake/dashboard actions.
- Netlify deploy/logs monitor on push.
47 changes: 47 additions & 0 deletions .codex/PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Phased launch plan (live tracking)

Phase 1 – Intake + Payments polish (start now)
- Student intake step 1: hide full name/email/phone; prefill from Clerk; keep DOB only
- Student intake step 2: ensure NP track includes “Other”; require university/school fields explicitly
- Membership/pricing: verify 60h block and 30h a la carte are present (done); add one‑cent discount path (choose: test price or amount_off coupon)
- UI: make dashboard navbar solid white; replace landing footer in dashboard with a simple footer; hide “More” menus where unused

Phase 1a – Discount system GA (in flight)
- Owner (Payments Eng): Run `api.payments.syncDiscountCouponsToStudentProducts` in Stripe test/live; capture recreated coupon IDs for finance log. Target: week 1.
- Owner (Data Eng): Backfill existing `discountUsage` rows with new `stripePriceId`/`membershipPlan` columns; verify analytics dashboards still reconcile. Target: week 1.
- Owner (QA): Build automated coverage (unit+integration) for discount validation helpers and intake logging; wire into CI. Target: week 2.
- Owner (QA): Complete end-to-end QA: Core/Pro/Premium checkout (full + installments), NP12345 zero-cost flow, admin finance views. Target: week 2.
- Owner (Ops): Document ops rollback + verification steps in Stripe Ops runbook; ensure permissions allow metadata spot-check. Target: week 1.
- Dependencies: confirm STRIPE_SECRET_KEY + price IDs available in both test/live; ensure Convex access for backfill mutation.
- QA exit criteria: automated tests green + manual matrix signed off + finance dashboard sanity check screenshot archived.

Phase 2 – Messaging, Documents, Hours policy
- Enforce preceptor‑first messaging in convex/messages.sendMessage
- Wire documents UI (upload/view/delete) to convex/documents.ts and remove dead buttons
- Model hour credits with issuedAt/expiresAt (1 year) and enforce no rollover for a la carte; surface expiration in student dashboard
- Pre-work: audit existing messaging/document handlers to list missing validations, storage calls, and UI gaps.

Phase 3 – Preceptor onboarding + payouts
- Preceptor intake: add licenseNumber, telehealth willingness toggle; display verified/unverified on dashboard
- Stripe Connect for preceptor payouts (connected account onboarding, destination charges/transfers); add payout summary UI
- Loop Exchange: add privacy opt‑out in intake/profile; respect in directory

Phase 4 – Enterprise refinements
- Remove test analytics; enforce student capacity (e.g., 20 concurrent)
- Add Calendly CTA on enterprise landing/dashboard

Stripe envs
- Netlify: NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY (set), OPENAI_API_KEY (set)
- Convex: STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRICE_ID_* (set in Convex dashboard)

Toward v1.0 (new)
- Harden Stripe webhooks: leverage enriched discount metadata, emit structured logs/alerts when coupons lack `audience=student` or sync fails.
- Expand audit logging: record who runs discount sync, expose finance export summarizing discount usage by product.
- Final regression matrix for 1.0: student/preceptor intake, payments, admin RBAC, matching basics; capture sign-off before release cut.
- Prep release operations: draft 1.0 notes, update ROADMAP milestones, tag branch after CI (lint, type-check, tests, E2E) is green.
- Release owner: assemble regression matrix + schedule; due week prior to 1.0 cut.
- Product/Comms: draft release notes + changelog once Phase 1a + Phase 2 complete.

Build stability
- Short‑term: if needed, deploy with `npx convex deploy --typecheck=disable && next build`
- Long‑term: refactor any Convex actions using ctx.db directly into internalQuery/internalMutation wrappers
Loading
Loading