Skip to content

sseela1-stack/hackathon

Repository files navigation

DONE:

A full-stack web application that gamifies financial literacy education through interactive scenarios and AI-powered financial agents.

๐Ÿ—๏ธ Project Structure

technica_hackathon/
โ”œโ”€โ”€ backend/                    # Node.js/TypeScript/Express backend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ config/            # Environment configuration
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ env.ts
โ”‚   โ”‚   โ”œโ”€โ”€ models/            # TypeScript interfaces
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ GameState.ts
โ”‚   โ”‚   โ”œโ”€โ”€ services/          # Business logic layer
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ nessieService.ts    # Capital One Nessie API integration
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ aiService.ts        # AI/LLM integration
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ gameLogic.ts        # Game state management
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/       # Route handlers
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ gameController.ts
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ agentController.ts
โ”‚   โ”‚   โ”œโ”€โ”€ routes/            # API routes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ gameRoutes.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ agentRoutes.ts
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ healthRoutes.ts
โ”‚   โ”‚   โ””โ”€โ”€ index.ts           # Express app entry point
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ”œโ”€โ”€ tsconfig.json
โ”‚   โ””โ”€โ”€ .env.example
โ”‚
โ””โ”€โ”€ frontend/                   # React/TypeScript/Vite frontend
    โ”œโ”€โ”€ src/
    โ”‚   โ”œโ”€โ”€ api/               # Backend API clients
    โ”‚   โ”‚   โ”œโ”€โ”€ gameApi.ts
    โ”‚   โ”‚   โ””โ”€โ”€ agentApi.ts
    โ”‚   โ”œโ”€โ”€ types/             # TypeScript type definitions
    โ”‚   โ”‚   โ””โ”€โ”€ game.ts
    โ”‚   โ”œโ”€โ”€ components/        # Reusable UI components
    โ”‚   โ”‚   โ”œโ”€โ”€ HUDPanel.tsx
    โ”‚   โ”‚   โ”œโ”€โ”€ DialoguePanel.tsx
    โ”‚   โ”‚   โ”œโ”€โ”€ ChoicePanel.tsx
    โ”‚   โ”‚   โ”œโ”€โ”€ MoodSelector.tsx
    โ”‚   โ”‚   โ”œโ”€โ”€ SettingsPanel.tsx
    โ”‚   โ”‚   โ””โ”€โ”€ MoneyPlaybookView.tsx
    โ”‚   โ”œโ”€โ”€ pages/             # Main application pages
    โ”‚   โ”‚   โ”œโ”€โ”€ GameScreen.tsx
    โ”‚   โ”‚   โ””โ”€โ”€ InvestingDistrict.tsx
    โ”‚   โ”œโ”€โ”€ styles/            # Global styles
    โ”‚   โ”‚   โ””โ”€โ”€ global.css
    โ”‚   โ”œโ”€โ”€ App.tsx            # Main app component
    โ”‚   โ””โ”€โ”€ main.tsx           # Application entry point
    โ”œโ”€โ”€ package.json
    โ”œโ”€โ”€ tsconfig.json
    โ”œโ”€โ”€ vite.config.ts
    โ””โ”€โ”€ index.html

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm (comes with Node.js)

Backend Setup

  1. Navigate to the backend directory:
cd backend
  1. Install dependencies:
npm install
  1. Create environment file:
cp .env.example .env
  1. Edit .env file and add your API keys:
PORT=4000
NODE_ENV=development
NESSIE_API_KEY=your_nessie_api_key_here
AI_API_KEY=your_ai_api_key_here
FRONTEND_URL=http://localhost:5173
  1. Start the development server:
npm run dev

The backend will be running at http://localhost:4000

Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev

The frontend will be running at http://localhost:5173

๐Ÿ“ก API Endpoints

Game Endpoints

  • GET /api/game/state - Get current game state
  • POST /api/game/choice - Submit a player choice
  • GET /api/game/playbook - Get money playbook summary

Agent Endpoints

  • POST /api/agent/:agentName - Get message from specific AI agent
    • Available agents: mentor, spenderSam, saverSiya, crisis, futureYou, translator
  • POST /api/agent/mentor/advice - Get personalized financial advice

Health Check

  • GET /api/health - Server health check

๐ŸŽฎ Features

Current Features

  • Interactive Game Screen: Main gameplay interface with event scenarios
  • Financial Dashboard (HUD): Real-time display of checking, savings, investment balances, and health score
  • AI Agent Dialogue: Messages from various financial personality agents
  • Choice System: Multiple-choice decision making with consequences
  • Mood Tracking: Player emotional state affects gameplay
  • Accessibility Settings: High contrast mode and adjustable font sizes
  • Investing District: Placeholder page for future investing module

AI Agents

  1. Mentor - Provides balanced financial guidance
  2. Spender Sam - Encourages spending and enjoyment
  3. Saver Siya - Promotes saving and frugality
  4. Crisis Alert - Warns about urgent financial situations
  5. Future You - Provides long-term perspective
  6. Translator - Explains financial jargon in simple terms

๐Ÿ› ๏ธ Technology Stack

Backend

  • Runtime: Node.js
  • Language: TypeScript
  • Framework: Express.js
  • CORS: Enabled for frontend communication
  • Package Manager: npm

Frontend

  • Library: React 18
  • Language: TypeScript
  • Build Tool: Vite
  • Router: React Router DOM (ready to integrate)
  • Styling: Inline styles (can be replaced with Tailwind CSS or styled-components)

๐Ÿ“ Development Workflow

Running Both Servers

Terminal 1 (Backend):

cd backend
npm run dev

Terminal 2 (Frontend):

cd frontend
npm run dev

Building for Production

Backend:

cd backend
npm run build
npm start

Frontend:

cd frontend
npm run build
npm run preview

๐Ÿ”ง TODO: Future Implementation

Backend TODOs

  1. Nessie API Integration (nessieService.ts)

    • Implement actual Capital One Nessie API calls
    • Handle customer creation
    • Manage accounts and transactions
    • Track real balances
  2. AI/LLM Integration (aiService.ts)

    • Connect to OpenAI, Anthropic, or other LLM provider
    • Implement agent-specific prompts
    • Add mood-aware response generation
    • Generate personalized financial advice
  3. Game Logic (gameLogic.ts)

    • Implement sophisticated event generation
    • Add difficulty curve
    • Create more diverse scenarios
    • Implement state persistence (database)
    • Add multiplayer support
  4. Authentication

    • Add user authentication system
    • Implement JWT tokens
    • Create user profiles

Frontend TODOs

  1. Investing District

    • Build investment education module
    • Add stock market simulation
    • Create portfolio management interface
    • Implement investing challenges
  2. Enhanced UI/UX

    • Add animations and transitions
    • Implement sound effects
    • Add loading skeletons
    • Improve mobile responsiveness
  3. Additional Features

    • Add achievement/badge system
    • Implement leaderboards
    • Create tutorial/onboarding flow
    • Add data visualization for financial progress

๐ŸŽฏ Game Mechanics

Health Score

  • Ranges from 0-100
  • Affected by financial decisions
  • Reflects overall financial wellness

Balance Types

  • Checking: Day-to-day spending money
  • Savings: Emergency fund and short-term savings
  • Investment: Long-term wealth building

Mood System

  • Anxious ๐Ÿ˜ฐ: Affects risk tolerance
  • Okay ๐Ÿ˜: Neutral state
  • Confident ๐Ÿ˜Š: More willing to take calculated risks

๐Ÿ“š Learning Resources

The game teaches:

  • Budgeting basics
  • Emergency fund importance
  • Investment fundamentals
  • Risk vs. reward
  • Long-term financial planning
  • Understanding financial terminology

๐Ÿค Parallel Development

This project is structured to allow two developers to work simultaneously:

Developer 1 (Backend): Can focus on implementing API integrations, game logic, and database operations without touching frontend code.

Developer 2 (Frontend): Can work on UI/UX improvements, new components, and pages using the mock API responses already in place.

๐Ÿ“„ License

MIT License - Feel free to use this project for educational purposes.

๐Ÿ“ฑ Mobile QA

Acceptance Criteria

iPhone 15 Pro (iOS)

Layout & Safe Areas

  • โœ… viewport-fit=cover respected; no content obscured under Dynamic Island or home indicator
  • โœ… Status bar area (top) and home indicator area (bottom) have appropriate safe-area padding
  • โœ… All interactive elements respect env(safe-area-inset-*) variables

Touch Targets

  • โœ… All buttons and interactive elements โ‰ฅ 44pt minimum height
  • โœ… Tap targets have 8-12px internal padding
  • โœ… No accidental taps due to elements being too small or too close together

PWA Installation

  • โœ… When installed to Home Screen:
    • App launches in standalone mode (no Safari UI)
    • apple-mobile-web-app-status-bar-style is black-translucent
    • Theme color (#0B132B) applied to status bar
    • App icon displays correctly (192x192, 512x512)
  • โœ… "Add to Home Screen" prompt shows instructions via Share button

Offline & Updates

  • โœ… Offline app shell loads when network is unavailable
  • โœ… Update banner appears on new deploy with "Reload" button
  • โœ… Service worker caches static assets and API responses (GET only)
  • โœ… Navigation fallback to /index.html works offline

Accessibility

  • โœ… Focus indicators are WCAG AA compliant (3px outline with accent color)
  • โœ… Text contrast meets WCAG AA standards (4.5:1 minimum)
  • โœ… Font sizes scale with iOS Dynamic Type settings

Samsung Galaxy S23 Ultra (Android)

Layout & Touch

  • โœ… All buttons and interactive elements โ‰ฅ 48dp minimum height
  • โœ… Large screen width (~412-480 CSS px) handled with responsive layout
  • โœ… Tap targets use clamp() for fluid scaling based on viewport

Edge Gesture Safety

  • โœ… No interactive elements within 8px of left/right screen edges
  • โœ… --edge-safe CSS variable (min 8px) applied to containers
  • โœ… No accidental back swipe when tapping leftmost buttons
  • โœ… .container-safe class provides 12px minimum edge padding

Performance

  • โœ… Smooth 60fps scrolling in main panels and lists
  • โœ… No jank during transitions or animations
  • โœ… touch-action: manipulation prevents double-tap zoom delay
  • โœ… -webkit-tap-highlight-color: transparent removes tap flash

Accessibility

  • โœ… High-contrast mode remains legible at 480 CSS px width
  • โœ… Large text mode (20px) flows correctly without overflow
  • โœ… Focus indicators scale appropriately for touch input
  • โœ… prefers-reduced-motion disables all animations

PWA Installation

  • โœ… beforeinstallprompt event shows install banner with [Install] [Later] buttons
  • โœ… Installed app uses standalone display mode
  • โœ… Theme color (#0B132B) applied to system UI
  • โœ… Offline functionality works (NetworkFirst strategy for API)

Testing Scripts

Run Lighthouse PWA audit:

cd frontend
npm run lighthouse:pwa

This will:

  1. Build the production bundle
  2. Run Lighthouse PWA checks (installability, offline support, performance)
  3. Open results in browser

Expected Lighthouse PWA Score: โ‰ฅ 90/100

Manual Testing Checklist

iOS (Safari + Installed PWA)

  • Install app via Share โ†’ Add to Home Screen
  • Launch from Home Screen (standalone mode)
  • Verify status bar color and style
  • Test offline mode (airplane mode)
  • Deploy new version and verify update banner appears
  • Check safe-area padding around notch and home indicator
  • Verify all buttons are tappable (โ‰ฅ44pt)

Android (Chrome + Installed PWA)

  • Install app via Chrome's "Install" prompt
  • Launch from Home Screen (standalone mode)
  • Test edge gesture safety (no accidental back swipes)
  • Verify offline mode works
  • Check 60fps scrolling performance
  • Test high-contrast mode and large text
  • Verify all buttons are tappable (โ‰ฅ48dp)

Device Testing Matrix

Device OS Version Browser Status
iPhone 15 Pro iOS 17+ Safari โœ… Tested
iPhone 15 Pro iOS 17+ PWA Installed โœ… Tested
Samsung Galaxy S23 Ultra Android 13+ Chrome โœ… Tested
Samsung Galaxy S23 Ultra Android 13+ PWA Installed โœ… Tested
iPad Pro 11" iPadOS 17+ Safari โณ Planned
Google Pixel 8 Pro Android 14+ Chrome โณ Planned

Known Issues

  • iOS Safari: Service worker update prompt may not appear immediately (requires page refresh)
  • Android Chrome: Install prompt dismissal persists for 7 days (localStorage)
  • Low-end devices: Initial bundle load may take 1-2 seconds on 3G connections

๐Ÿ™‹ Support

For questions or issues, please create an issue in the repository or contact the development team.


Happy Coding! ๐Ÿ’ฐ๐ŸŽฎ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors