Skip to content

leonkwan46/foodspin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽก FoodSpin

Let fate decide your next meal!

DEMO

test.mov

A fun, interactive restaurant selection app built using the BMAD (Build, Measure, Analyse, Deliver) methodology. This project demonstrates modern full-stack development with AI-assisted workflows.

Next.js React TypeScript Tailwind CSS Vitest

Tests Coverage TypeScript ESLint BMAD

๐ŸŽฏ About BMAD

This project was developed using the BMAD methodology - a structured approach to AI-assisted software development that combines traditional product management practices with AI agent orchestration.

What is BMAD?

  • Build - Structured development using specialised AI agents (Product Owner, Architect, UX Expert, Developer, QA)
  • Measure - Quality gates and validation checkpoints throughout development
  • Analyse - Continuous refinement based on feedback and testing
  • Deliver - Production-ready code with comprehensive documentation

AI Agents Used:

  • /po - Product Owner for requirements and validation
  • /architect - System design and architecture decisions
  • /ux-expert - UI/UX design and specifications
  • /dev - Implementation and coding
  • /qa - Quality assurance and test implementation (142 tests built with QA agent)

Key Benefits:

  • Systematic approach to AI-assisted development
  • Role-based AI agents for specialised tasks
  • Comprehensive documentation from planning to deployment
  • Quality-first development with built-in validation

Learn More:

โœจ Features

  • ๐ŸŽฏ Instant Decision - Fast 1-second random selection
  • ๐ŸŽจ Beautiful Grid Layout - 6 restaurants with photos in 3x2 grid
  • ๐Ÿ‘† Clickable Cards - Click any restaurant to view details instantly
  • ๐ŸŽ‰ Celebration Effects - Confetti explosion on every spin
  • ๐Ÿ“ฑ Fully Responsive - Works perfectly on mobile and desktop
  • โšก Live Restaurant Data - Google Places API integration with smart hotel filtering
  • ๐Ÿ“ Auto Location Detection - Or manual location entry
  • ๐ŸŽš๏ธ Adjustable Search Radius - Control search distance from 1km to 10km
  • ๐Ÿ”„ Refresh Options - Don't like the options? Get 6 more!
  • โญ Google Reviews - View reviews and get directions for any restaurant
  • ๐ŸŽญ Cuisine Info - Shows restaurant type on each card

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 20.9.0 or higher
  • npm or pnpm
  • Google Places API key (for live restaurant data)

Installation

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env.local
# Add your Google Places API key to .env.local

# Run development server
npm run dev

Open http://localhost:3000 to see the app!

๐ŸŽฎ How to Use

  1. Visit the homepage - grid loads automatically
  2. Allow location access when prompted (or enter manually)
  3. Adjust search radius (1-10km) using the slider if needed
  4. Wait for nearby restaurants to load (6 options)
  5. Option A: Click "SPIN!" button to randomly select a restaurant
    • Watch the fast random animation (1 second)
    • Celebrate with confetti! ๐ŸŽ‰
  6. Option B: Click any restaurant card directly to view its details
  7. View restaurant details in the popup:
    • Click "Get Directions" to navigate via Google Maps
    • Click "See Reviews" to read Google reviews
  8. Click "Different Options" to load 6 more restaurants

๐Ÿ“ Project Structure

foodspin/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ page.tsx              # Home page with grid spinner
โ”‚   โ”œโ”€โ”€ layout.tsx            # Root layout
โ”‚   โ”œโ”€โ”€ globals.css           # Global styles & design tokens
โ”‚   โ””โ”€โ”€ api/
โ”‚       โ””โ”€โ”€ restaurants/      # Google Places API proxy
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ GridSpinner.tsx       # Main grid spinner (6 options)
โ”‚   โ”œโ”€โ”€ SpinButton.tsx        # Animated spin button
โ”‚   โ”œโ”€โ”€ ResultCard.tsx        # Restaurant result display
โ”‚   โ”œโ”€โ”€ LocationInput.tsx     # Manual location entry
โ”‚   โ”œโ”€โ”€ ErrorState.tsx        # Error handling UI
โ”‚   โ””โ”€โ”€ ErrorBoundary.tsx     # React error boundary wrapper
โ”œโ”€โ”€ __tests__/                # Comprehensive test suite
โ”‚   โ”œโ”€โ”€ api/                  # API integration tests
โ”‚   โ””โ”€โ”€ components/           # Component tests
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ hooks/                # React hooks
โ”‚   โ”‚   โ”œโ”€โ”€ useGeolocation.ts # Location detection
โ”‚   โ”‚   โ””โ”€โ”€ useRestaurants.ts # Restaurant fetching
โ”‚   โ”œโ”€โ”€ utils/                # Utilities
โ”‚   โ””โ”€โ”€ mockRestaurants.ts    # Fallback mock data
โ”œโ”€โ”€ types/
โ”‚   โ”œโ”€โ”€ restaurant.ts         # Restaurant types
โ”‚   โ”œโ”€โ”€ google-maps.d.ts      # Google Maps types
โ”‚   โ””โ”€โ”€ google-places-api.ts  # Google Places API types
โ””โ”€โ”€ public/                   # Static assets

๐ŸŽจ Tech Stack

Core

  • Next.js 16.1.6 - React framework with App Router
  • React 19.2.3 - UI library
  • TypeScript 5.x - Type safety

Styling

  • Tailwind CSS 4.x - Utility-first CSS
  • Framer Motion 12.x - Animation library

Effects

  • canvas-confetti - Celebration animations

๐Ÿ› ๏ธ Key Components

GridSpinner

  • 3x2 grid showing 6 restaurants
  • Restaurant photos from Google Places API
  • Clickable cards - Click any card to view details instantly
  • Fast random animation (1 second) on spin
  • Jumps randomly between options
  • "Different Options" button to refresh
  • Confetti celebration on selection

ResultCard

  • Glassmorphism design with backdrop blur
  • Restaurant photo with gradient overlay
  • Floating emoji badge
  • Rating, cuisine types, distance info
  • Two action buttons:
    • "Get Directions" - Primary button for navigation
    • "See Reviews" - Secondary button to read Google reviews
  • Smooth spring animation entrance
  • Modal popup with dark overlay

Search Radius Control

  • Smooth slider from 1km to 10km
  • Real-time radius adjustment
  • Visual gradient indicator
  • Continuous movement (0.5km increments)

SpinButton

  • Gradient background (orange โ†’ gold โ†’ yellow)
  • Hover & tap micro-interactions
  • Loading state with spinning icon
  • Disabled state handling

โšก Performance Optimisations

All animations optimised for 60fps:

  • โœ… GPU-accelerated transforms (willChange: 'transform')
  • โœ… Reduced blur effects (blur-xl instead of blur-3xl)
  • โœ… Removed continuous animations (static backgrounds)
  • โœ… Simplified text shadows (2 layers instead of 4)
  • โœ… Minimal SVG filters
  • โœ… Optimised confetti particle count

๐Ÿ“ฑ Browser Support

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+
  • Mobile browsers (iOS 14+, Android 5+)

๐Ÿ”ฎ Future Enhancements

  • User favourites (localStorage)
  • Social sharing with custom cards
  • Filter by cuisine type and price level
  • Settings UI for minimum rating adjustment
  • Intelligent meal-time filters
  • Reduced motion mode
  • Save recent searches
  • Restaurant favouriting system

๐Ÿ“ Available Scripts

npm run dev           # Start development server (localhost:3000)
npm run build         # Build for production
npm run start         # Start production server
npm run lint          # Run ESLint
npm test              # Run test suite (Vitest)
npm run test:watch    # Run tests in watch mode
npm run test:coverage # Run tests with coverage report

๐Ÿงช Test Coverage

Comprehensive test suite with 100% pass rate:

npm test  # Run all tests

Test Results:

  • โœ… 142 tests passing (100%)
  • โœ… 95 component tests - All UI components fully tested
  • โœ… 47 API integration tests - Complete API route coverage
  • โœ… 0 TypeScript errors - Fully type-safe codebase
  • โœ… 0 ESLint warnings - Clean, maintainable code

Test Coverage Includes:

  • Component rendering and interactions
  • Google Places API integration
  • Caching and rate limiting
  • Error handling and edge cases
  • Accessibility features
  • Keyboard navigation
  • Missing data scenarios
  • URL generation and routing

Testing Stack:

  • Vitest - Fast unit test framework
  • React Testing Library - Component testing
  • TypeScript - Type safety
  • ESLint - Code quality

๐Ÿงช Manual Testing Guide

  1. Location Detection - Allow location access or enter manually with autocomplete
  2. Search Radius - Adjust slider from 1-10km and see different results
  3. Grid Display - Should show 6 restaurants with photos (hotels filtered out)
  4. Click Cards - Click any restaurant card to view details instantly
  5. Spin Animation - Click "SPIN!" for random selection (1 second)
  6. Confetti - Should explode when selection completes
  7. Result Modal - Should show with dark overlay backdrop
  8. Get Directions - Should open Google Maps navigation in new tab
  9. See Reviews - Should open Google Maps reviews page in new tab
  10. Refresh Options - Click "Different Options" to see more restaurants
  11. Responsiveness - Try on mobile & desktop

๐Ÿ› Troubleshooting

Node version error

# Upgrade to Node 20+
nvm install 20
nvm use 20

Build fails

# Clean build and reinstall
rm -rf .next node_modules
npm install
npm run dev

Hydration errors

Fixed! All hydration issues resolved by loading restaurants client-side only.

๐Ÿ”ง Environment Variables

Copy .env.example to .env.local and add your Google Places API key:

GOOGLE_PLACES_API_KEY=your_api_key_here
NEXT_PUBLIC_GOOGLE_PLACES_API_KEY=your_api_key_here

Get your API key from Google Cloud Console.

๐ŸŽฏ Current Status

โœ… Production Ready

  • 100% Test Coverage - 142 tests passing (95 component + 47 API tests)
  • Type-Safe - 0 TypeScript errors
  • Clean Code - 0 ESLint warnings
  • Fully Documented - Comprehensive docs and inline comments

โœ… Core Features Complete

  • Grid-based restaurant selection (6 options)
  • Clickable restaurant cards for instant details
  • Google Places API integration with smart hotel filtering
  • Real-time location detection with city name display
  • Manual location entry with autocomplete
  • Adjustable search radius control (1-10km slider)
  • Error handling with helpful messages
  • Fast random animation (1 second)
  • Google Reviews integration
  • Two action buttons (directions + reviews)
  • Responsive design
  • Caching and rate limiting for API efficiency

๐Ÿค About This Project

This is a portfolio project demonstrating:

  • Modern full-stack development skills
  • AI-assisted development workflows (BMAD methodology)
  • Production-quality code standards
  • Systematic problem-solving approach

Feel free to fork and customise! If you're an employer or recruiter, check out the BMAD Process Documentation to see the development methodology in action.

๐Ÿ™ Acknowledgments

  • BMAD Methodology - Structured AI-assisted development approach
  • Claude Code - AI development environment
  • Next.js & React - Core framework
  • Icons from emoji
  • Mock photos from Unsplash
  • Animations by Framer Motion
  • Confetti by canvas-confetti

๐Ÿ“š Process Documentation

Want to see how this project was built using BMAD? Check out:

  • BMAD Process Documentation - Detailed walkthrough of the development workflow
  • Demonstrates systematic use of specialised AI agents (PO, Architect, UX Expert, Developer)
  • Shows quality gates, validation checkpoints, and iterative refinement
  • Highlights skills relevant to modern software development roles

Made with โค๏ธ using BMAD methodology and Claude Code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors