Book config
Book-wide settings in src/book/bookConfig.json
src/book/bookConfig.json is the source of truth for textbook identity and book-wide settings. It lives under src/book/, so tbx update does not overwrite it.
tbx create writes the required fields. Edit this file to change language, type, title, or to add your own values. Import it wherever you need those values:
import bookConfig from "@/book/bookConfig.json";Required fields
| Field | Description |
|---|---|
bookName | Display title (TOC header, index.html title on create/update) |
bookNameSafe | camelCase id used in package.json |
bookSubtitle | Subtitle shown under the title |
bookType | "default" (print + digital) or "minimal" (print only) |
bookLanguage | Exercise UI language: "en" or "ro" |
{
"bookName": "My Textbook",
"bookNameSafe": "myTextbook",
"bookSubtitle": "Year 2",
"bookType": "default",
"bookLanguage": "ro"
}Optional fields wired by the template
The layout passes these to <BookProvider> when they are present. Omit them to keep the provider defaults.
| Field | BookProvider prop | Description |
|---|---|---|
bookRatio | pageRatio | Page image width / height as a number. For 1448×2048 use 0.70703125 (1448 / 2048). |
sidebarWidth | sidebarWidth | TOC sidebar width (CSS length, e.g. "17em") |
Custom fields
You can add any other JSON-serializable keys and read them from the same import. Extra keys are typed as unknown, so narrow them when you use them.
{
"bookName": "My Textbook",
"bookNameSafe": "myTextbook",
"bookSubtitle": "Year 2",
"bookType": "default",
"bookLanguage": "ro",
"publisher": "Editura XYZ"
}import bookConfig from "@/book/bookConfig.json";
const publisher = bookConfig.publisher as string;
export function Credits() {
return <p>Published by {publisher}</p>;
}Do not put React components, functions, or image imports here — use a TypeScript module under src/book/ instead (see hotspot icons).
Do not store secrets in this file. It is imported by the app and shipped in the client bundle.