A beautiful, mobile-first web application to manage your personal book collection. Track your books, organize them into libraries and shelves, manage lending, and discover new titles using ISBN lookup.
- π Library Management: Organize your books into custom libraries and shelves
- π Smart Book Entry:
- Manual Mode: Full control with detailed form entry
- ISBN Lookup: Automatically fetch book details from Google Books API
- Camera Mode: Capture book covers for AI-powered analysis (requires OpenAI API key)
- π€ Lending Tracker: Keep track of who borrowed your books and when they're due back
- β Ratings & Reviews: Rate your books and add personal notes
- π Advanced Filtering: Filter by rating, reading status, library, and more
- π€ Export Options: Export your collection in CSV, MARC21, or JSON formats
- π± Mobile First: Optimized for smartphones with a responsive design for desktop
- π¨ Modern UI: Beautiful, intuitive interface built with Tailwind CSS
- π Admin Dashboard: Track AI usage, manage user quotas, and monitor platform statistics
- π° Usage Tracking: Built-in token and API call tracking with three-tier quota system (Free, Pro, Unlimited)
The easiest way to run Book Guardian is using Docker Compose:
-
Clone the repository:
git clone https://github.com/RuBiCK/bookguardian.git cd bookguardian -
Configure environment variables:
cp .env.example .env # Edit .env if needed (default values work for Docker Compose) -
Start the application:
docker compose up -d
-
Access the application: Open http://localhost:3000 in your browser
The first startup will:
- Build the Next.js application
- Start PostgreSQL database
- Run database migrations automatically
If you prefer to run without Docker:
- Node.js 18 or higher
- PostgreSQL 15 or higher (or use Docker for database only)
-
Clone the repository:
git clone https://github.com/RuBiCK/bookguardian.git cd bookguardian -
Install dependencies:
npm install
-
Start the database (if using Docker):
docker compose up -d postgres
-
Configure environment:
cp .env.example .env # Edit .env with your database connection string -
Run database migrations:
npx prisma migrate deploy
-
Start the development server:
npm run dev
-
Open the application: Navigate to http://localhost:3000
Book Guardian uses environment variables for configuration. Copy .env.example to .env and customize as needed.
# Database connection string
DATABASE_URL="postgresql://user:password@host:port/database?schema=public"# OpenAI API Key (for Camera feature)
# Get your key from https://platform.openai.com/api-keys
OPENAI_API_KEY=sk-your-actual-api-key-here
# Google Books API Key (for enhanced ISBN lookup)
# Get your key from https://console.cloud.google.com/
GOOGLE_BOOKS_API_KEY=your-google-books-api-key-hereThe camera feature uses AI to extract book information from cover images. To enable it:
- Sign up at OpenAI Platform
- Create an API key
- Add it to your
.envfile asOPENAI_API_KEY - The feature will automatically become functional
Note: The camera feature is currently a demonstration skeleton. Full implementation requires integrating the OpenAI API in
src/components/AddBookCamera.tsx.
Book Guardian includes a built-in admin dashboard for tracking AI usage and managing user quotas. To set up your first admin user:
- Create your user account by signing up through the application
- Set yourself as admin by running the SQL script:
# For Docker deployment
docker exec -i book-guardian-db psql -U library_user -d personal_library << 'EOF'
-- Update all users with default quotas
UPDATE "User"
SET role = 'USER', tier = 'FREE',
"monthlyTokenQuota" = 50000, "monthlyCallQuota" = 20,
"tokensUsed" = 0, "callsUsed" = 0,
"quotaResetDate" = NOW() + INTERVAL '1 month'
WHERE role IS NULL OR role = '';
-- Set your user as ADMIN with unlimited quota
UPDATE "User"
SET role = 'ADMIN', tier = 'UNLIMITED',
"monthlyTokenQuota" = 999999999, "monthlyCallQuota" = 999999
WHERE email = 'your-email@example.com'; -- Replace with your email
SELECT email, role, tier FROM "User";
EOF- Access the admin dashboard by clicking your profile β "Admin Dashboard"
Book Guardian includes three quota tiers for AI usage:
- Free Tier: 50,000 tokens, 20 API calls per month
- Pro Tier: 500,000 tokens, 200 API calls per month
- Unlimited Tier: Unlimited usage (admin users)
Admins can change user tiers through the admin dashboard. Quotas reset automatically at the beginning of each month.
- Framework: Next.js 16 (App Router)
- Language: TypeScript 5
- Database: PostgreSQL 15
- ORM: Prisma
- Styling: Tailwind CSS v4
- Icons: Lucide React
- Deployment: Docker & Docker Compose
The included docker-compose.yml is production-ready and includes:
- Multi-stage optimized Docker build
- Health checks for both services
- Automatic database migrations
- Persistent data volumes
- Restart policies
Deploy to your server:
# Clone the repository
git clone https://github.com/RuBiCK/bookguardian.git
cd bookguardian
# Configure production environment
cp .env.example .env
# Edit .env with production database credentials
# Start in production mode
docker compose up -d
# View logs
docker compose logs -f appMake sure to set secure values for production:
DATABASE_URL="postgresql://secure_user:secure_password@postgres:5432/personal_library?schema=public"
NODE_ENV=productionContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Book data provided by Google Books API
- Icons by Lucide
Made with β€οΈ for book lovers everywhere