A fun web app that generates fortune cookie messages with different personalities.
- Various cookie personalities, each with their own tone and style
- Special cookie behaviors (Matryoshka, Quantum, Apathetic, etc.)
- Toggle between pre-written and AI-generated fortune messages
- Responsive design that works on mobile and desktop
- Animations and sound effects for breaking the cookie
- DALL-E image generation for cookie art (optional)
The app supports two modes for generating fortune messages:
- Classic Mode: Uses pre-written messages from our database
- AI-Generated Mode: Creates unique, personalized messages on-the-fly using OpenAI's GPT-4o
To use the AI-generated mode or DALL-E image generation, you'll need an OpenAI API key:
- Sign up for an OpenAI account at https://platform.openai.com/signup
- Create an API key at https://platform.openai.com/api-keys
- Copy the
.env.examplefile to.envin the root directory of the project - Add your API key:
OPENAI_API_KEY=your_actual_api_key_here - Set
ENABLE_DALL_E=trueif you want to enable DALL-E image generation
- Never commit your
.envfile to version control - The
.envfile is already in.gitignoreto prevent accidental commits - Your API key is only used server-side and is not exposed to the client
- The app includes rate limiting to prevent abuse of your API key
Each cookie personality has custom prompt templates designed to capture their unique tone and style, ensuring that AI-generated messages maintain the personality's character.
First, install the dependencies:
npm install
# or
yarn installThen, run the development server:
npm run dev
# or
yarn devOpen http://localhost:3000 with your browser to see the result.
Run the test suite with:
npm test
# or
yarn testThe tests use mock API responses and don't make actual calls to the OpenAI API, so you don't need a real API key for testing.
The app includes special scripts to help with development and testing:
# Force a specific cookie personality for testing
npm run force-cookie quantum
# Restore normal random cookie behavior
npm run restore-cookie- Next.js
- TypeScript
- Tailwind CSS
- Howler.js (for sound effects)
- OpenAI API (for AI-generated fortunes and DALL-E images)
MIT