Note: This project is still in development and is not yet ready for use.
EPUB Builder is a TypeScript environment-agnostic library for building EPUB files. It provides a modular pipeline architecture for generating EPUB files with rich metadata, hierarchical chapter management, and customizable content structure.
Recently I found myself in need of a modern, maintained, and flexible EPUB generation library for a project I was working on. I searched for existing solutions, but most of them were either outdated, incomplete, or not flexible enough for my needs. So I decided to build my own.
This is very much a work in progress, and I'm still figuring out the best way to implement certain features. If you have any suggestions or feedback, please feel free to open an issue or a pull request.
These are some of the features that EPUB Builder aims to provide:
content.opf
, toc.ncx
) using popular templating engines like Mustache or
EJS, with the option to switch or add other engines.spine
nodes for navigation),
which improves performance and focus.MetadataBuilder
allows easy
creation of structured metadata fields such as title, author, language,
publisher, and identifiers, with validation for EPUB compliance.IncludeError
,
RenderError
) and detailed logging messages simplify troubleshooting by
pinpointing errors in specific templates or processing steps.@zip.js/zip.js
to compress
and structure EPUB files in a ZIP format, adhering to EPUB’s directory and
file organization requirements.Building an EPUB consists of two steps.
Clone the repository and install dependencies using npm:
git clone https://github.com/MichielvdVelde/epub-builder.git
cd epub-builder
npm install
See src/example.ts for an example of how to use this library.
This project is licensed under the MIT License. See the LICENSE file for details.