Generate captivating 5-scene stories with AI-powered illustrations
โจ Live Demo โข ๐ Quick Start โข ๐ Documentation โข ๐ฏ Features
StoryForge AI is an innovative storytelling platform that leverages advanced AI to create immersive 5-scene narratives with automatically generated images. Perfect for writers, educators, content creators, and anyone who loves great stories!
graph LR
A[Scene 1: Opening Hook] --> B[Scene 2: World Building]
B --> C[Scene 3: Rising Action]
C --> D[Scene 4: Climax]
D --> E[Scene 5: Resolution]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#fff3e0
style D fill:#ffebee
style E fill:#e8f5e8
๐ฌ Click to see StoryForge AI in action!
Idea: "A detective cat solves mysteries in a magical bakery"
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ StoryForge AI โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ก Story Idea: [A magical cat opens a restaurant] โ
โ ๐ญ Genre: [Fantasy โผ] โ
โ ๐จ Tone: [Whimsical โผ] โ
โ ๐ฅ Audience: [Children โผ] โ
โ โ
โ [โจ Generate Story] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Node.js 18+
- npm or yarn
- Google Gemini API Key (Get one here)
# Clone the repository
git clone https://github.com/your-username/story-generator.git
cd story-generator
# Install dependencies for both backend and frontend
npm run install:all
# Set up environment variables
cp backend/.env.example backend/.env
# Add your GEMINI_API_KEY to backend/.env
# Start the development servers
npm run devClick for detailed setup instructions
cd backend
npm install
# Create environment file
echo "GEMINI_API_KEY=your_api_key_here" > .env
echo "PORT=3000" >> .env
# Start backend server
npm startcd frontend
npm install
# Start development server
npm run devOpen your browser to http://localhost:5173 and start creating amazing stories!
- Gemini 2.5 Flash for intelligent narrative creation
- 5-Scene Structure with perfect story arc
- Genre-Specific writing (Fantasy, Sci-Fi, Mystery, Romance, etc.)
- Tone Adaptation (Adventurous, Whimsical, Dark, Heartwarming)
- Audience Targeting (Children, Young Adult, General, Adult)
- Scene-Specific Images generated for each scene
- AI-Analyzed Prompts based on actual scene content
- Multiple Services: Imagen-4, Pollinations.ai with smart fallbacks
- High-Quality Output with professional styling
- Real-Time Generation with progress tracking
- Full-Size Image Viewer with download capability
- Smooth Scene Navigation - click scene numbers to jump
- Edit & Regenerate individual scenes
- Mobile Responsive design
- TypeScript for type safety
- Comprehensive Testing suite
- Error Handling with graceful fallbacks
- Modular Architecture for easy extension
- API Documentation included
graph TB
subgraph "Frontend (React + TypeScript)"
A[Story Input Form] --> B[Loading Screen]
B --> C[Story Display]
C --> D[Scene Cards]
D --> E[Image Modal]
end
subgraph "Backend (Node.js + Express)"
F[Story Generation API] --> G[Image Generation API]
G --> H[Fallback Services]
end
subgraph "AI Services"
I[Google Gemini 2.5 Flash]
J[Imagen-4]
K[Pollinations.ai]
end
A --> F
F --> I
G --> J
H --> K
style A fill:#e3f2fd
style F fill:#f3e5f5
style I fill:#e8f5e8
POST /api/stories/generate-text - Generate 5-scene story
// Request
{
"idea": "A robot chef discovers emotions through cooking",
"settings": {
"genre": "Science Fiction",
"tone": "Heartwarming",
"audience": "General"
}
}
// Response
{
"id": "1704123456789",
"idea": "A robot chef discovers emotions through cooking",
"settings": { ... },
"scenes": [
{
"id": "1",
"title": "Scene 1",
"text": "In the sterile chrome kitchen of Neo-Tokyo...",
"imagePrompt": "A sleek robot chef in a futuristic kitchen..."
},
// ... 4 more scenes
],
"createdAt": "2024-01-01T12:00:00.000Z"
}POST /api/stories/generate-image - Generate scene image
// Request
{
"imagePrompt": "A sleek robot chef in a futuristic kitchen, discovering emotions through cooking",
"sceneId": "1"
}
// Response
{
"imageUrl": "https://image.pollinations.ai/prompt/...",
"sceneId": "1",
"generated": true,
"service": "Pollinations",
"fallback": false
}# Run all tests
npm test
# Test story generation
npm run test:story
# Test image generation
npm run test:images
# Test complete flow
npm run test:fullEnvironment Variables
# Backend (.env)
GEMINI_API_KEY=your_gemini_api_key_here
PORT=3000
NODE_ENV=development
# Optional: Google Cloud credentials for Imagen-4
GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json// In frontend/src/components/StoryInput.tsx
const genres = [
'Fantasy', 'Science Fiction', 'Mystery', 'Romance',
'Horror', 'Adventure', 'Historical Fiction',
'Your Custom Genre' // Add here
];const tones = [
'Adventurous', 'Whimsical', 'Dark', 'Heartwarming',
'Epic', 'Humorous', 'Mysterious',
'Your Custom Tone' // Add here
];Adding custom image generation services
// In backend/controllers/storyController.js
const fallbackServices = [
{
name: 'Your Custom Service',
url: `https://your-api.com/generate?prompt=${encodeURIComponent(cleanPrompt)}`
},
// ... existing services
];story-generator/
โโโ ๐ backend/
โ โโโ ๐ controllers/ # API logic
โ โโโ ๐ routes/ # Express routes
โ โโโ ๐ data/ # Data management
โ โโโ ๐ server.js # Main server
โโโ ๐ frontend/
โ โโโ ๐ src/
โ โ โโโ ๐ components/ # React components
โ โ โโโ ๐ types/ # TypeScript types
โ โ โโโ ๐ App.tsx # Main app
โ โโโ ๐ package.json
โโโ ๐ README.md
โโโ ๐ package.json
# Start development servers
npm run dev # Both frontend and backend
npm run dev:frontend # Frontend only
npm run dev:backend # Backend only
# Build for production
npm run build # Build frontend
npm run build:all # Build everything
# Testing
npm run test:story # Test story generation
npm run test:images # Test image generation
npm run test:ai # Test AI integrations
# Utilities
npm run format # Format code with Prettier
npm run lint # Run ESLint
npm run type-check # TypeScript type checkingWe love contributions! Here's how to get started:
Click to expand contribution steps
-
Fork the repository
gh repo fork your-username/story-generator
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Make your changes
- Add new features
- Fix bugs
- Improve documentation
-
Test your changes
npm test npm run test:full -
Commit with conventional format
git commit -m "feat: add amazing new feature" -
Push and create PR
git push origin feature/amazing-feature
- ๐ Multi-language support
- ๐ต Audio narration for stories
- ๐ฑ Mobile app version
- ๐ฎ Interactive story modes
- ๐ Story analytics dashboard
- ๐ค Collaborative editing
- ๐ Story collections & sharing
- ๐จ Custom illustration styles
| Metric | Average | Excellent |
|---|---|---|
| ๐ Story Generation | 30-60s | โ |
| ๐จ Image Generation | 5-10s per image | โ |
| ๐ฑ App Load Time | < 2s | โ |
| ๐ Success Rate | 99%+ | โ |
- Languages Supported: English (more coming soon!)
- Genres Available: 15+ genres
- Image Styles: Professional digital artwork
- Concurrent Users: Scales with your infrastructure
- Story Length: 1000-2000 words (optimal range)
Common Issues & Solutions
# Check API key
echo $GEMINI_API_KEY
# Test API connection
curl http://localhost:3000/api/stories/# Test image generation
npm run test:images
# Check fallback services
curl "https://image.pollinations.ai/prompt/test"# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm install
npm run dev# Check what's using port 3000
lsof -i :3000
# Use different port
PORT=3001 npm startThis project is licensed under the MIT License - see the LICENSE file for details.
MIT License - feel free to use this project for personal and commercial purposes!
- Google Gemini for intelligent story generation
- Imagen-4 for high-quality image generation
- Pollinations.ai for reliable image fallbacks
- React & TypeScript for the frontend
- Node.js & Express for the backend
- Tailwind CSS for beautiful styling
- Lucide React for icons
Special thanks to the storytelling community and AI researchers making creative AI accessible to everyone.
Found a bug? Create an issue
Have a feature idea? Start a discussion
Need help? Check our documentation or ask in Discord
Give us a star! โญ It helps others discover this project.
Made with โค๏ธ by developers who love great stories
- ๐ Multi-language story generation
- ๐ต Text-to-speech narration
- ๐ฑ Progressive Web App (PWA)
- ๐ฎ Interactive story choices
- ๐ Analytics dashboard
- ๐ค Collaborative story editing
- ๐ Story marketplace
- ๐จ Custom art styles
- ๐ API for third-party integrations
Ready to create amazing stories? Get started now! ๐