A modern web application for browsing, searching, and downloading books that using Flibusta (MyHomeLib) digital library format. Built with Kotlin/Ktor backend and Preact frontend.
- π Browse Books: View books with covers, metadata, and descriptions
- π Advanced Search: Search by title, author, genre, language, and enriched annotations
- π§ Semantic Search: Optional local ONNX embeddings for KNN search and similar-book recommendations
- π₯ Format Conversion: Download books as the original FB2 or convert to EPUB (via Pandoc)
- π€ Send to Kindle: Queue EPUB deliveries to registered Kindle devices
- π Google OAuth: Secure authentication with Google accounts
- π Operations: Health and Prometheus metrics endpoints
- π± Responsive Design: Works on desktop and mobile devices
Backend:
- Kotlin + Ktor
- SQLite database with jOOQ
- Embedded Lucene search index
- Optional DJL/ONNX semantic embedding worker
- Micrometer/Prometheus metrics
- Google OAuth authentication
- RESTful API design
Frontend:
- Preact (no bundler)
- Modern CSS with CSS Grid/Flexbox
- Native ES modules
- Progressive Web App features
Infrastructure:
- Docker & Docker Compose
- Pandoc-based conversion service
- Read-Only Volume mounts for book data
- Docker and Docker Compose
- Your digital library in Flibusta format (FB2 files and INPX metadata)
- Google OAuth credentials
-
Clone the repository
git clone https://github.com/Heapy/kotbusta.git cd kotbusta -
Set up environment variables
cp .env.example .env
Edit
.envand configure the following required variables:KOTBUSTA_GOOGLE_CLIENT_ID- Your Google OAuth client IDKOTBUSTA_GOOGLE_CLIENT_SECRET- Your Google OAuth client secretKOTBUSTA_GOOGLE_REDIRECT_URI- OAuth redirect URI (e.g.,https://yourdomain.com/callback)KOTBUSTA_SESSION_SIGN_KEY- Session signing key. Auto-generated if not provided, but for production set it explicitly: with auto-generated keys every restart invalidates existing sessions (all users are logged out).KOTBUSTA_SESSION_ENCRYPT_KEY- Session encryption key (same caveat as the sign key β set it explicitly for production)KOTBUSTA_ADMIN_EMAIL- Your admin email addressKOTBUSTA_DB_PATH- Path to SQLite database file (required; e.g./data/db/kotbusta.db)KOTBUSTA_LUCENE_INDEX_PATH- Path to the Lucene search index (required; must be writable. In the prod compose it is set to/data/db/lucene)KOTBUSTA_BOOKS_DATA_PATH_LOCAL- Local path to your Flibusta book archives
-
Prepare your Flibusta data
# Create directory for book data if it doesn't exist mkdir -p /path/to/flibusta/books # Your directory should contain: # - fb2-*.zip archives with books # - flibusta_fb2_local.inpx metadata file
-
Run the application
docker compose -f deploy/prod/docker-compose.yml up -d
-
Monitor the startup
# Check logs to ensure services started correctly docker compose -f deploy/prod/docker-compose.yml logs -f # Verify containers are running docker compose -f deploy/prod/docker-compose.yml ps
-
Initial setup
- Navigate to your configured URL (e.g.,
https://yourdomain.com) - Login with Google using your admin email
- Go to the Admin panel
- Run the import process to index your book collection
- The import may take some time depending on your collection size
- Navigate to your configured URL (e.g.,
-
Verify installation
- Check that books appear in the catalog
- Test search functionality
- Try downloading a book as FB2 and EPUB
-
Clone the repository
git clone git@github.com:Heapy/kotbusta.git cd kotbusta -
Set up environment
cp .env.example .env # Edit .env -
Configure Google OAuth
- Go to Google Console
- Create a new project or select existing
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:8080/callback - Copy Client ID and Secret to
.env - Add your email address as ad
-
Prepare book data
# Create directory for your Flibusta data mkdir books-data # Copy your FB2 archives and INPX files here # Structure should match: books-data/fb2-*.zip, books-data/flibusta_fb2_local.inpx
-
Start the application in IDEA
- Run Kotbusta run-configuration
- The SQLite database will be created automatically on first run
-
Access the application
- Open http://localhost:8080
- Click "Login with Google" to authenticate
- Go to "Admin" and run import
- Start browsing your digital library!
GET /login- Redirects to/oauth/googleGET /oauth/google- Redirect to Google OAuth login pageGET /callback- Google OAuth callbackGET /logout- Logout clearing session dataGET /health- Service health and search-index stateGET /metrics- Prometheus metrics, optionally protected byKOTBUSTA_METRICS_TOKEN
GET /api/me- Get current user informationGET /api/books- List books with paginationGET /api/search/books- Search booksGET /api/books/{id}- Get book detailsGET /api/books/{id}/cover- Get book cover imageGET /api/books/{id}/similar- Get similar booksGET /api/books/{id}/download/{format}- Download book asfb2orepubGET /api/kindle/devices- List Kindle devicesPOST /api/kindle/devices- Add a Kindle devicePUT /api/kindle/devices/{id}- Update a Kindle deviceDELETE /api/kindle/devices/{id}- Delete a Kindle devicePOST /api/books/{id}/send-to-kindle- Queue an EPUB deliveryGET /api/kindle/sends- List Kindle send history
GET /api/admin/status- Check admin rights statusPOST /api/admin/import- Start book import processGET /api/admin/jobs- Get all import jobs and their status
-
Backend development
Start `Kotbusta` run-configuration in IDEA # Navigate to http://localhost:8080`
-
Frontend development
- Edit files in
src/main/resources/static/ - No build process needed, Kotbusta uses native ES modules
- Reload browser to see changes
- Edit files in
The application uses SQLite with the following main tables:
books- Book metadata and file pathsauthors- Author informationseries- Book seriesgenres- Genre informationbook_authors- Book/author linksbook_genres- Book/genre linksbook_enrichment- Extracted annotations, embeddings, and enrichment statususers- User accounts (from Google OAuth)kindle_devices- User Kindle addresseskindle_send_queue- Pending and historical Kindle deliverieskindle_send_events- Delivery event history
kotbusta/
βββ src/main/kotlin/io/heapy/kotbusta/
β βββ Application.kt # Main application entry point
β βββ ApplicationModule.kt # Dependency injection and bean configuration
β βββ coroutines/ # Coroutine utilities and context
β βββ dao/ # Data access objects (deprecated, being migrated to repository)
β βββ database/ # Database setup and transaction management
β βββ jooq/ # jOOQ generated code (tables, records, enums)
β βββ ktor/ # Ktor routes and HTTP modules
β βββ mapper/ # Data mapping utilities
β βββ model/ # Domain models and DTOs
β βββ parser/ # FB2/INPX file parsers
β βββ repository/ # Repository layer for data access
β βββ service/ # Business logic and services
βββ src/main/resources/
β βββ static/ # Frontend files (HTML, CSS, JS)
β βββ logback.xml # Logging configuration
βββ .env # Application configuration
- INP File Format - Detailed documentation about the INP/INPX file format used by Flibusta for metadata cataloging
Edit the .env file to configure all aspects of the application.
Edit src/main/resources/application.conf to add additional ktor modules and adjust ktor configuration.
# Follow logs in real-time
docker-compose logs -f- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the AGPL-3.0 - see the LICENSE file for details.
- Flibusta for the original digital library format
- Pandoc for format conversion
- Preact team for the lightweight framework
- Ktor team for the excellent Kotlin framework