How arhamifham/banamatics works
Banamatix is a browser-based banana-math quiz game with trial and logged-in play, account access, coin rewards, and a theme store. Users enter through the routed app, play puzzles fetched from an external quiz service, and can sign in to continue and spend coins on themes. The PHP backend handles account and user/theme operations against MySQL; theme selection is also applied and persisted in browser storage. Backend endpoint links to the database are supported by the source index; frontend-to-backend calls are shown where excerpts expose them.
Main entry points: StorePage.tsx Theme store · db.php MySQL connection · App.tsx Route application · LoginPage.tsx Login and registration
Components 19
Web application
- Route application
src/App.tsx
Quiz gameplay
- Trial quiz
src/components/HomePage.tsx - Full game
src/components/GamePage.tsx - Quiz generator
src/components/utils/quizGenerator.ts - Quiz image
src/components/QuizImage.tsx
Accounts and persistence
- Login and registration
src/components/LoginPage.tsx - Login endpoint
backend/login.php - Registration endpoint
backend/register.php - Google login endpoint
backend/google_login.php - User update endpoint
backend/update_user.php - Theme update endpoint
backend/update_theme.php - Token verification
backend/verify_token.php - MySQL connection
backend/db.php
Themes and store
- Theme store
src/components/StorePage.tsx - Theme state
src/components/ThemeContext.tsx - Theme catalog
src/components/themeConfig.ts
Other components
- Player browser
- Quiz API
- Browser storage
Connections 27
- Player browser → Route application: opens
- Route application → Trial quiz: routes to
src/App.tsx - Route application → Login and registration: routes to
src/App.tsx - Route application → Full game: routes to
src/App.tsx - Route application → Theme store: routes to
src/App.tsx - Trial quiz → Quiz generator: requests quiz
src/components/HomePage.tsx - Full game → Quiz generator: requests quiz
src/components/GamePage.tsx - Quiz generator → Quiz API: fetches puzzle
src/components/utils/quizGenerator.ts - Trial quiz → Quiz image: renders puzzle
src/components/HomePage.tsx - Full game → Quiz image: renders puzzle
src/components/GamePage.tsx - Login and registration → Login endpoint: posts credentials
src/components/LoginPage.tsx - Login and registration → Registration endpoint: posts registration
src/components/LoginPage.tsx - Login and registration → Google login endpoint: uses Google sign-in
- Login endpoint → MySQL connection: uses connection
backend/login.php - Registration endpoint → MySQL connection: uses connection
backend/register.php - Google login endpoint → MySQL connection: uses connection
backend/google_login.php - User update endpoint → MySQL connection: uses connection
backend/update_user.php - Theme update endpoint → MySQL connection: uses connection
backend/update_theme.php - Token verification → MySQL connection: uses connection
backend/verify_token.php - Theme store → User update endpoint: syncs user
src/components/StorePage.tsx - Theme store → Theme update endpoint: saves selection
src/components/StorePage.tsx - Theme store → Theme state: applies theme
src/components/StorePage.tsx - Theme store → Theme catalog: reads catalog
src/components/StorePage.tsx - Theme state → Theme catalog: loads defaults
src/components/ThemeContext.tsx - Theme state → Browser storage: persists selection
src/components/ThemeContext.tsx - Login and registration → Browser storage: stores session
src/components/LoginPage.tsx - Theme store → Browser storage: updates user
src/components/StorePage.tsx