Skip to content

nilay1943/ShouldIBuyIt

Repository files navigation

Should I Buy It? πŸ€”

A web application that helps you decide whether you should make a purchase or not, powered by ChatGPT's witty financial advice and sassy responses. Built with Next.js, Chakra UI, and OpenAI's GPT-3.5.

Features

  • πŸ’° Dynamic money bag visualization based on income and purchase price
  • πŸ”₯ Animated money burning effect when spending money
  • πŸ’… Modern UI with Chakra UI components
  • πŸ€– Sassy AI-powered financial advice
  • 🌐 Secure API handling through Cloudflare Workers

Tech Stack

  • Frontend: Next.js, Chakra UI, React Icons
  • API: Cloudflare Workers
  • AI: OpenAI GPT-3.5 Turbo
  • Styling: Chakra UI + Custom CSS Animations

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/should-i-buy-it.git
cd should-i-buy-it
  1. Install dependencies:
npm install
  1. Set up Cloudflare Worker:
# Install Wrangler CLI
npm install -g wrangler

# Login to Cloudflare
wrangler login

# Add your OpenAI API key to Cloudflare
wrangler secret put OPENAI_API_KEY

# Deploy the worker
wrangler deploy
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000 to view the app.

Deployment

The frontend can be deployed to any static hosting service (Vercel, GitHub Pages, etc.). The API is handled by Cloudflare Workers, so no additional backend deployment is needed.

Frontend Deployment

npm run build
npm run export

API Deployment

wrangler deploy

Project Structure

  • pages/ - Next.js pages
    • index.js - Main application page
    • _document.js - Custom document for emoji favicon
  • worker.js - Cloudflare Worker code for API handling
  • wrangler.toml - Cloudflare Worker configuration

Features Explanation

Money Visualization

The app visualizes your monthly income as a pile of money bags. When you enter a purchase price, it shows the impact on your finances by:

  • Calculating bags based on income using a logarithmic scale
  • Burning away bags proportional to the purchase price
  • Animating the transition with fire effects

AI Financial Advice

The app uses GPT-3.5 to generate personalized, sassy financial advice based on:

  • Your monthly income
  • The item you want to buy
  • The item's price

Security

  • OpenAI API key is securely stored in Cloudflare Workers' secrets
  • No sensitive information is exposed in the frontend
  • All API calls are handled through Cloudflare Workers

Contributing

Feel free to submit issues and enhancement requests!

About

Financial Decision Helper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published