This is a simple AI-powered app that detects your mood from natural language and returns a motivational quote using GPT and predefined content.
-
Install dependencies:
npm install -
Create a
.env.localfile or edit.env.examplefile to.env.local:OPENAI_API_KEY=your-openai-key-here -
Run the app:
npm run dev
This app uses modern JavaScript features (like optional chaining ?.) which require Node.js v14 or later (v16+ recommended).
-
Install
nvm(Node Version Manager):curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash -
Restart your terminal, then install and use Node 20:
nvm install 20 nvm use 20
-
Verify the version:
node -v # Should be v20.x.x
This ensures full compatibility with the app. If you see an error like SyntaxError: Unexpected token '?', it's because your Node version is too old.
pages/
index.js // Frontend UI
api/
getQuote.js // Quote logic + GPT fallback
detectMood.js // Mood detection via GPT
utils/
quotes.js // Static quotes
quote_cache.json // Persistent GPT-generated quotes
.env.local // Your API key (not committed)
Open an issue or reach out