A minimalist web application for generating, saving, and sharing haikus. Features both AI-powered generation using Claude API and template-based generation with traditional 5-7-5 syllable patterns.
- π€ AI Generation: Haikus using Claude API
- π Template Fallback: Classic 5-7-5 syllable generation if AI fails
- π Authentication: Email/password with Firebase
- πΎ Save Haikus: Keep your favorites
- π Gallery: Browse and like other users' haikus
- π Search: Find your saved haikus
- #οΈβ£ Auto-Hashtags: Automatic social media hashtags
- π¦ Share on X: Direct Twitter/X sharing
- π€ User Profiles: Set username, bio, links
- β€οΈ Likes: Like other users' haikus
- π± Responsive: Desktop and mobile compatible
- π₯ Collections: Backend done, UI not yet implemented
- π Following: Backend done, UI not yet implemented
- π User Stats: Basic tracking, minimal UI
- πΌοΈ Avatars: Not yet implemented
- Frontend: Vanilla JavaScript (ES6+), TailwindCSS v3
- Backend: Firebase Cloud Functions v6 (Node.js 20)
- Database: Cloud Firestore with advanced indexing
- Authentication: Firebase Auth with enhanced user profiles
- Hosting: Firebase Hosting
- AI: Anthropic Claude API
- Security: Rate limiting, input validation, comprehensive security rules
every-haiku/
βββ docs/ # π Documentation
β βββ README.md # Doc index (START HERE)
β βββ QUICK_REFERENCE.md # Commands & shortcuts
β βββ CLAUDE.md # Dev notes
β βββ setup-instructions.md # Setup & deploy
β βββ TESTING.md # Testing info
β βββ AI_AGENT_GUIDELINES.md # Dev guidelines
β βββ archived/ # Historical docs
βββ public/
β βββ index.html # Main application (SPA)
βββ functions/
β βββ index.js # Cloud Functions
β βββ package.json # Function dependencies
β βββ __tests__/ # Tests
βββ cypress/ # E2E tests
βββ .github/workflows/test.yml # CI/CD pipeline
βββ firebase.json # Firebase config
βββ firestore.rules # Database security
βββ package.json # Root config
βββ README.md # This file
See docs/README.md for all documentation including:
- Quick reference and commands
- Setup and deployment
- Testing guide
- Developer notes
- Historical/archived docs
- Node.js (v20 or higher)
- npm (v10 or higher)
- Firebase CLI (
npm install -g firebase-tools) - Firebase project with Firestore, Auth, and Functions enabled
- Anthropic API key (for AI haiku generation)
- Git for version control
-
Clone the repository
git clone https://github.com/bshepp/every-haiku.git cd every-haiku -
Install Firebase CLI
npm install -g firebase-tools
-
Login to Firebase
firebase login
-
Initialize Firebase project
firebase init # Select: Firestore, Functions, Hosting # Use existing project or create new
-
Install dependencies
cd functions npm install cd ..
-
Configure Firebase
- Update Firebase config in
public/index.htmlwith your project credentials - Get credentials from Firebase Console > Project Settings
- Update Firebase config in
-
Set Claude API key
firebase functions:secrets:set CLAUDE_API_KEY
-
Deploy Firestore indexes
firebase deploy --only firestore:indexes
-
Deploy
firebase deploy
firebase emulators:startYour app will be available at http://localhost:5000
firebase deploy --only hosting
firebase deploy --only functions
firebase deploy --only firestore:rules
firebase deploy --only firestore:indexesThe project includes a comprehensive testing framework with unit, integration, and end-to-end tests.
- Unit Tests: Jest for Cloud Functions
- Integration Tests: Firebase Emulator + Jest for Firestore rules
- E2E Tests: Cypress for user flows
# Run all tests
./test-all.sh
# Run unit tests
cd functions && npm test
# Run E2E tests
npx cypress open
# Run tests with coverage
cd functions && npm run test:coverageSee TESTING.md for detailed testing documentation.
Update the Firebase config object in public/index.html:
const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_AUTH_DOMAIN",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_STORAGE_BUCKET",
messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
appId: "YOUR_APP_ID"
};Set the Claude API key for AI generation:
firebase functions:config:set claude.api_key="YOUR_KEY"generateAIHaiku: Generate AI-powered haiku using Claude (with rate limiting)generateHashtags: Generate relevant hashtags for haikus
updateProfile: Update user profile informationgetUserStats: Get comprehensive user statistics
toggleLike: Like or unlike a haikutoggleFollow: Follow or unfollow a usercreateCollection: Create a new haiku collectionaddToCollection: Add haiku to a collection
cleanupOldHaikus: Scheduled function to delete old unsaved haikus
- Authentication required for saving haikus and social features
- Users can only modify their own content
- Public haikus and profiles visible to all users
- API keys stored securely using Firebase secrets
- Comprehensive Firestore security rules with granular access control
- Rate limiting on all API endpoints (10 requests/minute)
- Input validation and sanitization
- XSS protection in frontend
- Username uniqueness enforcement
This project is currently in Beta. Core features are complete and stable. See FUTURE_IMPROVEMENTS.md for the roadmap of upcoming features.
- Enhanced user profiles with social features
- Voting/liking system
- Collections infrastructure
- Major dependency updates (Firebase SDK v11, Admin SDK v13)
- Security improvements
- Fork the repository
- 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
Please read:
AI_AGENT_GUIDELINES.mdfor development guidelinesFUTURE_IMPROVEMENTS.mdfor planned featuresMIGRATION_GUIDE.mdfor dependency update information
This project is licensed under the MIT License - see the LICENSE file for details.
- Anthropic for Claude API
- Firebase team for the excellent platform
- The haiku poetry tradition for inspiration
For issues, questions, or contributions, please open an issue on GitHub.