Skip to content

EpicCodeWizard/FYF-v2-public

Repository files navigation

Funding Your Futures

A financial literacy simulation platform for high school gym events. Students are assigned AI-generated character profiles and walk between physical stations making purchase decisions on school-issued tablets. Admins manage sessions, monitor progress in real time, and trigger life events. At the end, students receive an AI-graded report.

Tech Stack

  • Framework: Next.js 16 (App Router, Turbopack)
  • UI: Tailwind CSS, Radix UI, shadcn/ui
  • Auth: Kinde (Google OAuth)
  • AI: Amazon Bedrock (Claude) for profile generation and grading
  • PDF: jsPDF for downloadable reports
  • Charts: Recharts for spending visualization
  • Data: JSON file-backed in-memory store (data/db.json)
  • Real-time: Server-Sent Events (SSE)

Getting Started

Prerequisites

  • Node.js 20+
  • pnpm

Install

pnpm install

Environment Variables

Copy .env.local.example to .env.local and fill in:

KINDE_CLIENT_ID=...
KINDE_CLIENT_SECRET=...
KINDE_ISSUER_URL=https://your-app.kinde.com
KINDE_SITE_URL=https://fundingyourfutures.org
KINDE_POST_LOGOUT_REDIRECT_URL=https://fundingyourfutures.org
KINDE_POST_LOGIN_REDIRECT_URL=https://fundingyourfutures.org/initializing

BEDROCK_API_KEY=...          # Amazon Bedrock API key (us-east-1)
# BEDROCK_MODEL_ID=...       # Optional, defaults to Claude Sonnet

Kinde dashboard setup: Add https://fundingyourfutures.org/api/auth/callback as an allowed callback URL.

Without Bedrock: The app works fully without an API key -- it falls back to a pool of 8 pre-built character profiles and heuristic-based grading.

Run

pnpm dev

Admin access is controlled by email allowlist in lib/auth/adminAllowlist.ts.

Build

pnpm build
pnpm start

How It Works

Student Flow

  1. Join -- Enter a 6-character session code on the landing page (OTP-style input)
  2. Authenticate -- Google OAuth via Kinde
  3. Wait -- Waiting room until the admin starts the session
  4. Onboard -- 7-step guided tour explaining the dashboard, stations, and how to get help
  5. Character Profile -- Shown automatically after onboarding; viewable anytime via the Profile button
  6. Visit Stations -- Navigate through 7-8 stations (randomized order per student), entering product codes at each physical booth to make purchases
  7. Complete -- After all stations, wait for the admin to end the session
  8. Results -- AI-graded letter grade (A-F), analysis paragraph, purchase history, and downloadable PDF report

Station Types

Station Multiple Purchases Conditional
Clothing No --
Grocery No --
Insurance No --
Retail Yes --
Transport No --
Housing No --
Bank No --
Personal Care Yes --
Childcare No Only if profile has children

Admin Flow

  1. Create Session -- Name it, get a 6-char join code
  2. Share Code -- Full-screen code display with live student count
  3. Start Simulation -- Moves all waiting students to onboarding
  4. Monitor -- Real-time student table showing current station, purchases, balance
  5. Manage Students -- Click any student to open a detail drawer (view/remove purchases, add money)
  6. Trigger Life Events -- Select students via checkboxes, apply a specific or random life event to all at once
  7. Export -- CSV export of all student data
  8. End Simulation -- Moves all students to the results screen

Real-Time Updates

All state changes propagate instantly via SSE to both admin and student views:

  • Student joins, makes a purchase, advances stations
  • Admin removes a purchase (student is sent back to that station), adds money, triggers life events
  • Session starts/ends

Purchase Removal

When an admin removes a purchase from an earlier station, only that station becomes "uncleared." The student must revisit it, but all other completed stations remain intact. The student sees the affected station highlighted with a "Tap to revisit" prompt.

Life Events

Admins can trigger life events (from data/life-events.json) that add or subtract from student balances. Events can be applied to multiple students at once, with the option to assign random events. Students see a full-screen popup when a life event hits.

Tablet Lockdown

The student experience enforces fullscreen mode on any user interaction (click/touch). Pinch-to-zoom and text selection are disabled. Admin routes are excluded from fullscreen enforcement.

Project Structure

app/
  page.tsx                          # Session code entry (OTP input)
  initializing/page.tsx             # Waiting room
  onboarding/page.tsx               # Guided tour
  dashboard/page.tsx                # Station list + budget chart
  station/[stationId]/page.tsx      # Purchase screen
  complete/page.tsx                 # Post-stations waiting
  summary/page.tsx                  # AI-graded results
  admin/page.tsx                    # Session management
  admin/session/[sessionId]/page.tsx # Live session view
  api/
    auth/[kindeAuth]/route.ts       # Kinde OAuth
    session/route.ts                # CRUD sessions
    student/route.ts                # Student state
    purchase/route.ts               # Product code validation + purchase
    admin/route.ts                  # Admin actions
    events/route.ts                 # SSE endpoint
    summary/route.ts                # AI grading
    report/route.ts                 # PDF generation

components/
  student/                          # Student-facing components
  admin/                            # Admin-facing components
  ui/                               # shadcn/ui primitives
  FullscreenEnforcer.tsx            # Tablet lockdown

lib/
  ai/
    bedrock.ts                      # Bedrock Converse API client
    generateProfile.ts              # AI character generation
    generateSummary.ts              # AI grading
  reports/generateReport.ts         # PDF generation (jsPDF)
  auth/adminAllowlist.ts            # Admin email gate
  store.ts                          # JSON-file-backed session store
  types.ts                          # TypeScript interfaces
  hooks/
    useSSE.ts                       # SSE client hook
    useActiveSession.ts             # Active session tracking

data/
  products.json                     # All purchasable products by station
  stations.json                     # Station definitions
  life-events.json                  # Life event definitions
  db.json                           # Runtime session data (gitignored)

Data Persistence

Session data is stored in data/db.json -- an in-memory Map synced to disk on every write. Data survives server restarts but not redeployments to fresh environments. This is intentional for the single-event, gym-based use case.

AI Features

Feature Model Fallback
Character profiles Claude via Bedrock 8 pre-built profiles (round-robin)
Summary grading Claude via Bedrock Heuristic scoring (housing ratio, insurance, savings, balance)
PDF reports jsPDF (no AI) --

Profiles are generated with high temperature and random seeding to ensure diversity across students within the same session.

About

A financial literacy simulation platform for high school gym events.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors