9fc5d3baea4e8ee65206034aea6e5a5a86020456
- Create EbookScanner service with multiple folder support - Update scanner to handle array of folder paths instead of single path - Add EPUB metadata extraction for rich ebook information - Implement folder monitoring with fsnotify for real-time updates - Add API endpoints for folder management: - POST /api/auth/ebook-folders (add folder) - GET /api/auth/ebook-folders (list folders) - DELETE /api/auth/ebook-folders/:folderPath (remove folder) - Update scanner endpoints to accept folder_paths array - Add go-epub and fsnotify dependencies for metadata extraction and file watching
📚 Bookmann
A self-hosted ebook management system built with Go, PostgreSQL, HTMX, and Tailwind CSS (fully integrated into a single service) featuring multiple beautiful dark themes with Tokyo Night as default.
✨ Features
- 🔒 Multi-User Authentication: Complete user system with registration/login, JWT-based sessions, and bcrypt password hashing
- ✅ Server-Side Validation: Comprehensive input validation with detailed error messages
- 🌙 Multiple Themes: 11 beautiful themes including Tokyo Night, Dracula, Nord, Solarized Dark, Monokai, One Dark Pro, Material Dark, and Catppuccin variants (Mocha, Macchiato, Frappé, Latte) with user preferences saved to database
- 🎨 Theme Persistence: User theme choices sync between browser and server
- 📖 Reading Progress: User-specific reading progress tracking
- 🔧 RESTful API: Clean API endpoints with JWT authentication
- 🐳 Docker Ready: Single-container deployment with PostgreSQL
- 🧪 API Testing: Complete Bruno collection for testing all endpoints
- 📱 Responsive Design: Mobile-first responsive interface using Tailwind CSS
- ⚡ HTMX Integration: Dynamic interactions without JavaScript frameworks
- 🎯 TypeScript Support: Client-side scripting with TypeScript compilation
Quick Start
Prerequisites
- Docker and Docker Compose
Running the Application
- Clone the repository
- Run the application:
docker-compose up --build
- Access the application at http://localhost:8765
Database
PostgreSQL runs on port 5432 with default credentials:
- Database: ebookdb
- User: postgres
- Password: password
Development
Backend
cd backend
go mod tidy
go run github.com/sqlc-dev/sqlc/cmd/sqlc@latest generate
go run cmd/server/main.go
The application uses Go HTML templates for server-side rendering with HTMX for dynamic interactions. Templates are located in backend/templates/.
✨ Enhanced Features:
- Authentication: Login/Register forms with multiple theme support at
/loginand/register - JWT Management: Secure token storage with localStorage and session persistence
- Theme Switching: 7 popular dark themes with dropdown selector and database persistence
- HTMX Integration: Form submissions and dynamic updates without page reloads
- Input Validation: Server-side validation with detailed error messages
- Multiple Themes: Beautiful dark themes with smooth transitions
- Responsive Design: Mobile-first approach with optimized layouts for all screen sizes
Note: The frontend is fully integrated into the Go backend using HTML templates and HTMX.
API Endpoints
Auth (Public)
POST /api/auth/register- Register new userPOST /api/auth/login- Login user (email or username)GET /api/auth/profile- Get user profile (requires JWT)PUT /api/auth/theme- Update user theme preference (requires JWT)
Ebooks (Protected)
GET /api/ebooks- List ebooksGET /api/ebooks/:id- Get specific ebookPOST /api/ebooks- Create new ebookPUT /api/ebooks/:id- Update ebookDELETE /api/ebooks/:id- Delete ebook
Reading Progress (Protected)
GET /api/ebooks/:id/progress- Get reading progressPUT /api/ebooks/:id/progress- Update reading progress
Ratings (Protected)
GET /api/ebooks/:id/rating- Get user's rating for ebookPOST /api/ebooks/:id/rating- Create or update ebook ratingPUT /api/ebooks/:id/rating- Create or update ebook ratingDELETE /api/ebooks/:id/rating- Delete user's ratingGET /api/ebooks/:id/ratings- Get all ratings for ebook
API Testing
Use the included Bruno collection in the bruno/ directory for testing the API:
- Install Bruno
- Import the
bruno/folder as a collection - Select the "localhost" environment
- Run the application and test the endpoints
Project Structure
.
├── backend/
│ ├── cmd/server/ # Application entry point
│ ├── internal/
│ │ ├── config/ # Configuration management
│ │ ├── database/ # Database connection and queries
│ │ └── handlers/ # HTTP handlers (auth + ebooks)
│ ├── migrations/ # Database migrations
│ ├── templates/ # Go HTML templates with HTMX
│ └── sqlc.yaml # sqlc configuration
├── bruno/ # Bruno API testing collection
├── docker-compose.yml
└── README.md
🎨 Recent Enhancements
Backend Improvements
- Server-Side Rendering: Replaced static frontend with Go HTML templates
- Theme System: Database-backed user theme preferences with 7 popular dark themes
- HTMX Integration: Dynamic interactions using HTMX for modern UX
- Enhanced Security: JWT authentication with theme persistence
Frontend Redesign
- Beautiful Homepage: Hero section with features showcase and modern design
- Multiple Themes: 11 beautiful themes including Tokyo Night, Dracula, Nord, Solarized Dark, Monokai, One Dark Pro, Material Dark, and Catppuccin variants (Mocha, Macchiato, Frappé, Latte) with CSS variables
- HTMX Forms: Real-time form submissions and updates without JavaScript frameworks
- Theme Switcher: Dropdown selector that saves preferences to database
- Responsive Design: Tailwind CSS for mobile-first responsive layouts
- Smooth Animations: CSS transitions and scroll effects
Technical Updates
- Go Templates: Server-side rendering with template inheritance
- Tailwind CSS: Utility-first CSS framework via CDN
- TypeScript Support: Client-side scripting with TypeScript compilation
- Database Schema: Added theme column to users table
- API Expansion: New theme update endpoint
License
GPL-3.0