4.5 KiB
4.5 KiB
CreaBook - AI Book Generation Application
A web application for generating books with AI, featuring book cover design and AI-powered book content generation.
Features
Cover Designer
- Gallery View: Browse and manage all your book covers
- AI Generation: Generate covers using AI with style presets and genre templates
- Manual Editor: Edit covers with text layers, adjust fonts, colors, and positioning
- Export: Download covers in high quality (PNG, JPEG)
Book Generator
- Genre Templates: 12 genres including Fiction, Mystery, Romance, Sci-Fi, Fantasy, Horror, Thriller, Children's Books, Non-Fiction, Self-Help, Business, and Memoir
- AI Outline Generation: Create detailed chapter outlines based on your book idea
- Chapter Writing: Generate chapters with AI or write manually
- Character Development: Generate AI-suggested characters with traits, motivations, and backstories
- Writing Assistant: AI-powered text expansion and improvement tools
Tech Stack
- Frontend: React 18 + Vite + TypeScript + Tailwind CSS
- State Management: Zustand
- Canvas Editing: react-konva
- Backend: Node.js + Express + TypeScript
- AI: Ollama (local AI - llama3 for text, stable-diffusion for images)
- HTTP: Axios + TanStack Query
Prerequisites
- Node.js (v18 or higher)
- Ollama installed and running locally
Install Ollama
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Windows
# Download from https://ollama.com/download
Pull Required Models
ollama pull llama3
ollama pull flux
Installation
# Install dependencies
npm install
# Start development servers (both client and server)
npm run dev
The application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
Project Structure
CreaBook/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/
│ │ │ ├── cover-designer/ # Cover gallery, editor, AI generator
│ │ │ ├── book-generator/ # Genre selector, outline, editor
│ │ │ └── SettingsPage.tsx
│ │ ├── stores/ # Zustand stores (cover, book)
│ │ ├── services/ # API clients
│ │ └── App.tsx
├── server/ # Node.js backend
│ ├── src/
│ │ ├── api/ # Express routes
│ │ ├── services/ # Business logic
│ │ └── prompts/ # Genre templates
└── uploads/ # Uploaded/generated covers
API Endpoints
Ollama
POST /api/ollama/generate- Generate textPOST /api/ollama/stream- Stream text generation (SSE)POST /api/ollama/image- Generate imagesGET /api/ollama/models- List available models
Covers
GET /api/covers- List all coversPOST /api/covers/upload- Upload a coverPOST /api/covers/process- Process/edit a coverDELETE /api/covers/:id- Delete a cover
Books
GET /api/books/genres- List all genre templatesPOST /api/books/outline- Generate book outlinePOST /api/books/chapter- Generate a chapterPOST /api/books/expand- Expand/improve textPOST /api/books/characters- Generate charactersPOST /api/books/plot- Get plot suggestions
Usage Guide
1. Design a Book Cover
- Navigate to Cover Designer
- Choose between:
- Gallery: Upload or browse existing covers
- AI Generate: Create covers with AI prompts
- Editor: Edit covers with text layers
- For AI generation:
- Select a style (Modern, Minimalist, Vintage, etc.)
- Describe your desired cover or use a genre preset
- Click "Generate Cover"
2. Generate a Book
- Navigate to Book Generator
- Select a genre
- Enter your book title (optional) and core idea
- Click "Generate Outline"
- Review the AI-generated chapter outline
- Navigate to Write tab
- Generate chapters individually or write manually
- Use Characters tab to develop your cast
3. Combine Cover and Book
After creating both a cover and a book, you can assign the cover to your book for a complete package.
Scripts
# Development
npm run dev # Start both servers
npm run dev:client # Start frontend only
npm run dev:server # Start backend only
# Build
npm run build # Build both
npm run build:client # Build frontend
npm run build:server # Build backend
License
MIT