first commit

This commit is contained in:
Ichitux
2026-04-05 03:08:53 +02:00
commit 1082d36c12
28015 changed files with 3767672 additions and 0 deletions

156
README.md Normal file
View File

@@ -0,0 +1,156 @@
# 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
1. **Node.js** (v18 or higher)
2. **Ollama** installed and running locally
### Install Ollama
```bash
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Windows
# Download from https://ollama.com/download
```
### Pull Required Models
```bash
ollama pull llama3
ollama pull flux
```
## Installation
```bash
# 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 text
- `POST /api/ollama/stream` - Stream text generation (SSE)
- `POST /api/ollama/image` - Generate images
- `GET /api/ollama/models` - List available models
### Covers
- `GET /api/covers` - List all covers
- `POST /api/covers/upload` - Upload a cover
- `POST /api/covers/process` - Process/edit a cover
- `DELETE /api/covers/:id` - Delete a cover
### Books
- `GET /api/books/genres` - List all genre templates
- `POST /api/books/outline` - Generate book outline
- `POST /api/books/chapter` - Generate a chapter
- `POST /api/books/expand` - Expand/improve text
- `POST /api/books/characters` - Generate characters
- `POST /api/books/plot` - Get plot suggestions
## Usage Guide
### 1. Design a Book Cover
1. Navigate to **Cover Designer**
2. Choose between:
- **Gallery**: Upload or browse existing covers
- **AI Generate**: Create covers with AI prompts
- **Editor**: Edit covers with text layers
3. 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
1. Navigate to **Book Generator**
2. Select a genre
3. Enter your book title (optional) and core idea
4. Click "Generate Outline"
5. Review the AI-generated chapter outline
6. Navigate to **Write** tab
7. Generate chapters individually or write manually
8. 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
```bash
# 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