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.
- π° 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
- Frontend: Next.js, Chakra UI, React Icons
- API: Cloudflare Workers
- AI: OpenAI GPT-3.5 Turbo
- Styling: Chakra UI + Custom CSS Animations
- Clone the repository:
git clone https://github.com/yourusername/should-i-buy-it.git
cd should-i-buy-it
- Install dependencies:
npm install
- 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
- Run the development server:
npm run dev
- Open http://localhost:3000 to view the app.
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.
npm run build
npm run export
wrangler deploy
pages/
- Next.js pagesindex.js
- Main application page_document.js
- Custom document for emoji favicon
worker.js
- Cloudflare Worker code for API handlingwrangler.toml
- Cloudflare Worker configuration
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
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
- 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
Feel free to submit issues and enhancement requests!