Create library
Create a new library with optional filesystem paths.Input
Library name (minimum 1 character)
Whether to automatically scan this library on a schedule
Whether this library is visible to all organization members
Array of filesystem paths to scan for ebooks
Response
Library ID
Library name
Whether automatic scanning is enabled
Whether library is public
ISO timestamp when library was created
Get libraries
List all libraries for the user’s active organization.Response
Array of library objects with paths included.Get library by ID
Retrieve a single library with its paths.Input
Library ID
Response
Library object with paths array.Add path
Add a filesystem path to an existing library.Input
Library ID
Filesystem path (minimum 1 character)
Response
Library path object.Remove path
Remove a filesystem path from a library.Input
Library path ID
Update library
Update library settings.Input
Library ID
New library name (minimum 1 character)
Enable/disable automatic scanning
Update public visibility
Response
Updated library object.Delete library
Delete a library and all its associated data.Input
Library ID
Scan library
Trigger a filesystem scan to discover and index ebooks.Input
Library ID to scan
Response
BullMQ job ID for tracking the scan operation
Library scanning process
When you trigger a library scan:- Discovery phase - The scanner recursively walks all library paths, discovering ebook files (EPUB, PDF, etc.)
- File events - For each discovered file, a
file-eventjob is queued to BullMQ - Book creation - The
file.event.workerprocesses each file:- Extracts basic metadata from the file
- Creates a
bookrecord in the database - Creates a
scanned_filerecord to prevent duplicate processing - Queues a
book-indexjob for Elasticsearch indexing
- Indexing - The
book.index.workerindexes books into Elasticsearch with full metadata
Supported formats
- EPUB
- Additional formats may be supported depending on metadata extractors
Example: Create and scan library
Library types
The library model is defined inpackages/api/src/routers/libraries/library.model.ts: