Skip to content

Generate Project Structure

Asterios Raptis edited this page Jul 4, 2025 · 2 revisions

Overview

For writing a book, an organized directory structure helps manage content, references, and publishing formats efficiently. Below is a recommended structure:

book-project/
│── manuscript/
β”‚   β”œβ”€β”€ chapters/
β”‚   β”‚   β”œβ”€β”€ 01-introduction.md
β”‚   β”‚   β”œβ”€β”€ 02-chapter.md
β”‚   β”‚   β”œβ”€β”€ ...
β”‚   β”œβ”€β”€ front-matter/
β”‚   β”‚   β”œβ”€β”€ toc.md
β”‚   β”‚   β”œβ”€β”€ preface.md
β”‚   β”‚   β”œβ”€β”€ foreword.md
β”‚   β”‚   β”œβ”€β”€ acknowledgments.md
β”‚   β”œβ”€β”€ back-matter/
β”‚   β”‚   β”œβ”€β”€ about-the-author.md
β”‚   β”‚   β”œβ”€β”€ appendix.md
β”‚   β”‚   β”œβ”€β”€ bibliography.md
β”‚   β”‚   β”œβ”€β”€ faq.md
β”‚   β”‚   β”œβ”€β”€ glossary.md
β”‚   β”‚   β”œβ”€β”€ index.md
β”‚   β”œβ”€β”€ figures/
β”‚   β”œβ”€β”€ tables/
β”‚   β”œβ”€β”€ references.bib
│── assets/
β”‚   β”œβ”€β”€ covers/
β”‚   β”œβ”€β”€ figures/
β”‚       β”œβ”€β”€ diagrams/
β”‚       β”œβ”€β”€ infographics/
│── config/
β”‚   β”œβ”€β”€ metadata.yaml
β”‚   β”œβ”€β”€ styles.css
β”‚   β”œβ”€β”€ template.tex
│── output/
β”‚   β”œβ”€β”€ book.pdf
β”‚   β”œβ”€β”€ book.epub
β”‚   β”œβ”€β”€ book.mobi
β”‚   β”œβ”€β”€ book.docx
│── scripts/
β”‚   β”œβ”€β”€ full_export_book.py
β”‚   β”œβ”€β”€ update_metadata_values.py
β”‚   β”œβ”€β”€ init_book_project.py
β”‚   β”œβ”€β”€ ...
│── LICENSE
│── pyproject.toml
│── README.md

πŸ“œ Explanation

  1. manuscript/
    Contains the main content organized into:

    • chapters/, front-matter/, and back-matter/ (Markdown or LaTeX)
  2. assets/
    Stores images and visual material like:

    • Cover images

    • Diagrams and infographics

  3. config/
    Project configuration files:

    • metadata.yaml holds book metadata

    • styles.css and optional template.tex for styling

  4. output/
    All exported formats will be saved here

  5. scripts/
    Automation tools for exporting and managing metadata.
    πŸ†• Use init_book_project.py to create the structure.
    ⚠️ The older shell script create_project_structure.sh is now deprecated.


πŸ†• βœ… Initializing the Project

To create this structure automatically:

poetry run init-book-project

This Python script:

  • Creates all required directories and base files

  • Initializes metadata.yaml, metadata_values.json

  • Adds a JSON config for image generation workflows

πŸ“˜ Read more here:
πŸ‘‰ πŸ“¦ Project Initialization – Wiki


πŸ“‚ Customizing the Structure

To add new directories (e.g. exercises/), you can:

  1. Edit the Python script scripts/init_book_project.py

  2. Add custom paths to the directories list

For example:

directories = [
    "manuscript/exercises",
    ...
]

Then run:

poetry run init-book-project

Clone this wiki locally