A modern, visually engaging Haiku Generator application built using Nuxt.js, Pinia for state management, and TailwindCSS for styling. The application is deployed on Cloudflare Pages. The app generates random haikus with a corresponding background image, offering users a poetic and visually enriching experience.
- Features
- Technologies Used
- Getting Started
- Configuration
- Deployment
- Folder Structure
- Contributing
- License
- Random Haiku Generation: Generates a 5-7-5 haiku with modern themes using various AI models.
- Background Images: Each haiku is presented with a visually compelling background image fetched from Lexica's image API.
- Interactive Elements: Clicking on the background or haiku generates a new haiku and corresponding image.
- Typing Effect: The haiku text is displayed with a typing animation for a pleasant reading experience.
- Smooth Transitions: CSS transitions and animations are used for a seamless user experience.
- Server-side Rendering (SSR): Utilizes Nuxt.js capabilities to improve loading times and SEO.
- Nuxt 3 (with SSR support)
- Vue 3 (Composition API and
<script setup>
) - TailwindCSS (Styling)
- Cloudflare Pages (Deployment)
- Lexica API (Background Images)
- Multiple AI Services for generating haikus (as reflected in the topics.js file)
Follow these instructions to get a local copy of the project up and running, including setting up dependencies and configuring environment variables. Then, launch the development server to get a complete local experience.
- Node.js (version 16 or higher)
- npm (comes with Node.js) or yarn
-
Clone the Repository
git clone https://github.com/yourusername/haiku-generator.git cd haiku-generator
-
Install Dependencies
npm install # or yarn install
-
Development Server Start the development server:
npm run dev # or yarn dev
-
Access the Application Open http://localhost:3000 in your browser to view the app.
Configuration can be managed through the nuxt.config.ts
file and environment variables.
- API Keys: The application uses several AI services, and you'll need valid API keys.
- Lexica API: Requires a valid endpoint for fetching background images.
To manage environment variables, you can add a .env
file in the root directory. Make sure not to share or commit this file to the repository to ensure security best practices:
ANTHROPIC_API_KEY=your_anthropic_key
OPENAI_API_KEY=your_openai_key
GROQ_API_KEY=your_groq_key
These keys should also be configured for production in the deployment environment settings.
The application is pre-configured for deployment on Cloudflare Pages.
-
Build the Project
npm run build # or yarn build
-
Deploy to Cloudflare Pages
- Link your GitHub repository to Cloudflare Pages.
- Set the build command as
npm run build
. - Set the output directory to
.output/public
.
Make sure the required environment variables are set up in the Cloudflare Pages settings.
A brief overview of the folder structure:
haiku-generator/
├── components/ # Vue components such as BackgroundImage and HaikuDisplay
├── pages/ # Nuxt pages (e.g., haiku/[id].vue)
├── server/ # API routes and utilities for fetching haikus and images
│ ├── api/ # Haiku API and image streaming logic
│ └── utils/ # AI services and helper utilities
├── public/ # Static assets
├── nuxt.config.ts # Nuxt.js configuration
└── README.md # Documentation for the repository
Contributions make the open-source community a great place to learn and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create Your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit Your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Thank you for using and contributing to the Haiku Generator! Enjoy crafting and reading beautiful haikus.