A comprehensive narrative analytics platform that decodes the DNA of bestsellers through multi-dimensional analysis. By examining structural patterns, emotional arcs, and narrative techniques across successful novels, this project reveals the underlying mechanics that make stories resonate with readers. The project consists of two main components:
- A proprietary analysis engine (closed source) that powers the metrics
- An open-source web interface that provides:
- Deep insights into what makes bestsellers successful through comprehensive analysis of successful fictions
- Interactive metrics dashboard for analyzing your own manuscript
👉 Analysis showcase: https://v0-bestseller-website-design.vercel.app/
The demo has two main features:
- Anatomy of a Bestseller – Explore detailed insights and patterns from our analysis of successful novels, revealing the key elements that make stories resonate with readers
- Analyze My Book – Upload your manuscript (TXT) to receive a comprehensive metrics dashboard showing how your story compares to bestseller patterns
- Bestseller Probability Score: Get an AI-powered prediction of your manuscript's potential success
- Success Factors Analysis: Understand which elements contribute to or detract from your book's bestseller potential
- Comparative Market Analysis: See how your book compares to current market trends
- Optimization Suggestions: Receive data-driven recommendations to improve your manuscript's market potential
- Upload your manuscript
- Our AI analyzes your text against our bestseller database
- Receive a comprehensive probability score
- Get detailed insights into:
- Market fit
- Reader engagement potential
- Competitive positioning
- Optimization opportunities
The core analysis engine is built on extensive research and machine learning models. While the engine itself is not open source, here's what it does:
- Analyzed 80 contemporary bestsellers (≈ 8.3 M words)
- Developed proprietary scoring algorithms
- Implemented advanced NLP techniques
| Category | Libraries/Tools | Purpose |
|---|---|---|
| Deep Learning & NLP | PyTorch, Transformers | BERT-based text analysis and inference |
| Scientific Computing | NumPy, SciPy | Numerical operations and statistical analysis |
| Data Processing | Pandas | Data manipulation and analysis |
| Classical ML & Statistics | scikit-learn, XGBoost | Model preparation, metrics, and feature importance |
| Feature Analysis | SHAP (SHapley Additive exPlanations) | Feature importance and model interpretation |
| Dimensionality Reduction | PCA, UMAP, t-SNE | High-dimensional data visualization and pattern discovery |
| Language Modeling | SpaCy, Gensim, NLTK | Tokenization, embeddings, word vectors |
| Visualization | Matplotlib, Plotly | Statistical plots, interactive visualizations, and analysis dashboard |
| System Tools | os, pathlib, json, re, time | File management, regex, debugging |
| Environment | Google Colab GPU | CUDA acceleration for processing |
- Chapter-level sentiment analysis
- Emotional arc tracking
- Pacing and tension measurement
- Style and readability metrics
- Temporal and sensory analysis
- ~100 raw metrics per chapter
- ~200 derived features
- Statistical validation
- Pattern recognition
- Archetype identification
This repository contains the open-source web interface that connects to the analysis engine. It provides:
- TXT file upload
- Real-time analysis processing
- Interactive visualizations
- Comprehensive dashboards
- Export capabilities
| Component | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 14, React 19 | User interface and interactions |
| File Processing | Supabase Storage | Secure file handling |
| Analysis Pipeline | Edge Functions | Serverless processing |
| Data Storage | Supabase Postgres | Metrics persistence |
| Visualization | Plotly.js, Recharts | Interactive charts |
- Framework: Next.js 15.2.4
- Language: TypeScript
- UI Library: React 19
- Styling: Tailwind CSS
- Component Library: Radix UI
- Form Handling: React Hook Form with Zod validation
- Data Visualization: Plotly.js, Recharts
- Database: Supabase
- State Management: React Hooks
- Date Handling: date-fns
- Clone the repository:
git clone [repository-url]
cd bestseller_anatomy- Install dependencies:
pnpm install- Set up environment variables:
Create a
.env.localfile in the root directory with the following variables:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_keyRun the development server:
pnpm devThe application will be available at http://localhost:3000
To create a production build:
pnpm buildTo start the production server:
pnpm startbestseller_anatomy/
├── app/ # Next.js app directory
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout component
│ └── page.tsx # Main page component
│
├── components/ # React components
│ ├── ui/ # Reusable UI components
│ ├── tabs/ # Tab-related components
│ ├── book-dashboard.tsx # Book analysis dashboard
│ ├── chart-viewer.tsx # Data visualization components
│ ├── nav-tabs.tsx # Navigation components
│ ├── podcast-player.tsx # Audio content player
│ └── table-of-contents.tsx # Content navigation
│
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and configurations
├── public/ # Static assets
├── styles/ # Global styles and Tailwind configurations
│
├── next.config.mjs # Next.js configuration
├── tailwind.config.ts # Tailwind CSS configuration
├── postcss.config.mjs # PostCSS configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies and scripts
The web interface includes multiple visualization types for comprehensive analysis:
- Scatter/Bubble Plots: Readability vs. length distribution, cluster analysis
- Box/Violin Plots: Chapter length distribution, word count variance
- Line/Area Charts: Emotional flow, pacing variations, peak points across chapters
- Timeline/Step Charts: Structural turning points (Disturbance, Doorways, Midpoint)
- Progress Indicators: Chapter-by-chapter advancement
- Bar/Column Charts: Genre-based average reading times, feature comparisons
- Stacked/100% Stacked Bars: Character traits, narrative POV, mood distributions
- Donut/Pie Charts: Sensory balance (visual-auditory-tactile ratios)
- KPI Cards:
- Readability scores
- Word counts
- Average chapter length
- Key success metrics
- Zoom and pan capabilities
- Tooltip information
- Dynamic filtering
- Export functionality
GNU General Public License v3.0 (GPL-3.0)
This project is licensed under the GPL-3.0 License. Commercial use is not permitted.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This repository contains only the web interface code. The analysis engine that powers the metrics is proprietary and not included in this repository.

