LibraryOS is a comprehensive multi-tenant library management system that enables organizations to manage their book collections, track loans, handle reservations, and manage team members with role-based access control.
Built with Next.js 16, React 19, TypeScript, Supabase, TailwindCSS 4, and Stripe for subscription billing.
One-click FREE deployment for your digital library transformation.
Live Demo · Documentation · Report Bug · Request Feature
Share Repository
🌟 LibraryOS: The operating system for modern libraries. Built for organizations, librarians, and book enthusiasts.
[!TIP] Experience the modern, intuitive interface designed for both librarians and library users.
Tech Stack Showcase:
Important
This is a multi-tenant SaaS platform where organizations can create isolated library environments. Features include Stripe subscription billing (Free/Basic/Pro/Enterprise plans), role-based access control (Owner/Admin/Librarian/Member), team invitations, and comprehensive book management.
📑 Table of Contents
- 📚 LibraryOSThe Operating System for Modern Libraries
This comprehensive library management system is designed for organizations that need to manage their book collections with team collaboration. Each organization operates in an isolated environment with its own books, members, and settings.
Key Differentiators:
- Multi-tenancy: Each organization has isolated data and settings
- Subscription Plans: Tiered pricing with different quotas and features
- Team Management: Invite members with different roles and permissions
- Modern Stack: Built with the latest versions of Next.js, React, and TailwindCSS
Note
- Node.js >= 18.0 required
- Supabase account required for database and authentication
- Stripe account required for subscription billing
- Modern web browser with JavaScript enabled
| Experience the system firsthand with our live demo - no installation required! | |
|---|---|
| Join our community of developers and library professionals. |
Tip
⭐ Star us to receive notifications about new features and updates!
⭐ Star History
Create and manage multiple library organizations, each with isolated data and customizable settings.
Organization Features:
- 🏢 Create Organizations: Set up new library environments with custom branding
- 👥 Team Management: Invite members via email with role assignment
- 🔄 Organization Switching: Users can belong to multiple organizations
- ⚙️ Custom Settings: Configure loan duration, max loans per user, and more
- 📊 Organization Stats: Track books, members, loans, and usage
graph LR
A[User] --> B[Organization 1]
A --> C[Organization 2]
B --> D[Books]
B --> E[Members]
B --> F[Loans]
C --> G[Books]
C --> H[Members]
C --> I[Loans]
Experience next-generation library catalog management with intelligent search, real-time availability tracking, and automated inventory management.
Key Capabilities:
- 🔍 Smart Search: Advanced search by title, author, ISBN, and categories
- 📚 Real-time Inventory: Live tracking of book availability and stock levels
- 🏷️ Category Management: Organized book classification system (global + org-specific)
- 📱 Responsive Design: Seamless experience across all devices
- 🖼️ Cover Management: Support for book cover images and placeholders
- ⭐ Reviews & Ratings: Members can rate and review books
Integrated Stripe subscription system with tiered plans and automatic billing.
| Plan | Max Books | Max Users | Max Loans/User | Price | Features |
|---|---|---|---|---|---|
| Free | 100 | 5 | 3 | $0 | Reservations, Reviews |
| Basic | 1,000 | 20 | 5 | $29/mo | + Reports |
| Pro | 10,000 | 100 | 10 | $99/mo | + Custom Branding |
| Enterprise | Unlimited | Unlimited | Unlimited | Custom | + API, SSO, Priority Support |
Billing Features:
- 💳 Stripe Checkout: Secure payment processing with 14-day trial
- 📊 Billing Portal: Self-service subscription management
- 🔄 Auto-renewal: Monthly or yearly billing cycles
- 📧 Payment Notifications: Email alerts for successful/failed payments
- 📜 Billing History: Complete audit trail of all transactions
Granular permission system with four distinct roles.
| Permission | Owner | Admin | Librarian | Member |
|---|---|---|---|---|
| Browse books | ✅ | ✅ | ✅ | ✅ |
| Borrow/return books | ✅ | ✅ | ✅ | ✅ |
| Write reviews | ✅ | ✅ | ✅ | ✅ |
| Add/edit books | ✅ | ✅ | ✅ | ❌ |
| Delete books | ✅ | ✅ | ❌ | ❌ |
| Manage members | ✅ | ✅ | ❌ | ❌ |
| Access billing | ✅ | ✅ | ❌ | ❌ |
| Delete organization | ✅ | ❌ | ❌ | ❌ |
Beyond the core functionality, this system includes:
- 🔐 Secure Authentication: Email-based authentication with Supabase Auth
- 📧 Email Invitations: Send team invitations via Resend
- 📊 Analytics Dashboard: Comprehensive statistics and reporting
- 🔄 Real-time Updates: Live synchronization across all connected devices
- 📱 Mobile Responsive: Perfect experience on smartphones and tablets
- 🌙 Dark Mode: Eye-friendly dark theme with brand colors
- 🔔 Smart Notifications: Toast notifications for all user actions
- 📈 Progress Tracking: Visual progress indicators for all operations
- 🛡️ Row Level Security: Secure data isolation at database level
- 💚 Brand Design: Custom gradient theme with #02FF73 and #09ADAA
✨ More features are continuously being added based on user feedback and library needs.
| Layer | Technologies |
|---|---|
| Frontend | Next.js 16 (App Router), React 19, TypeScript, TailwindCSS 4, shadcn/ui (Radix UI) |
| Backend | Supabase (PostgreSQL, Auth, RLS policies, Stored Procedures) |
| Payment | Stripe (Subscriptions, Checkout, Billing Portal, Webhooks) |
| Resend (Transactional emails for invitations) | |
| State | React Context (AuthContext, OrganizationContext) |
| Forms | React Hook Form + Zod validation |
Tip
Each technology was selected for production readiness, developer experience, and seamless integration with the overall architecture.
graph TB
subgraph "Frontend Layer"
A[Next.js 16 App] --> B[React 19 Components]
B --> C[AuthContext]
B --> D[OrganizationContext]
C --> E[Supabase Client]
D --> E
end
subgraph "API Layer"
F["/api/auth/register"]
G["/api/stripe/checkout"]
H["/api/stripe/portal"]
I["/api/stripe/webhook"]
J["/api/email/invite"]
end
subgraph "Backend Layer"
K[Supabase API] --> L[PostgreSQL]
L --> M[RLS Policies]
L --> N[Stored Procedures]
end
subgraph "External Services"
O[Stripe]
P[Resend Email]
end
E --> K
A --> F
A --> G
A --> H
G --> O
H --> O
I --> O
J --> P
erDiagram
organizations ||--o{ organization_members : has
organizations ||--o{ books : owns
organizations ||--o{ loans : tracks
organizations }o--|| subscription_plans : subscribes
users ||--o{ organization_members : belongs
users ||--o{ loans : borrows
users ||--o{ reviews : writes
books ||--o{ loans : borrowed
books ||--o{ reviews : reviewed
books }o--|| categories : categorized
organizations {
uuid organization_id PK
varchar name
varchar slug UK
varchar subscription_plan FK
varchar subscription_status
varchar stripe_customer_id
integer max_books
integer max_users
}
organization_members {
uuid membership_id PK
uuid organization_id FK
uuid user_id FK
varchar role
varchar status
}
books {
uuid book_id PK
varchar title
varchar author
varchar isbn
integer available_copies
uuid organization_id FK
}
loans {
uuid loan_id PK
uuid user_id FK
uuid book_id FK
date due_date
varchar status
}
🔐 Authentication Flow
sequenceDiagram
participant U as User
participant F as Frontend
participant API as /api/auth/register
participant SA as Supabase Auth
participant DB as Database
U->>F: Submit registration form
F->>API: POST {email, password, username, fullName}
API->>SA: createUser (auto-confirm email)
SA-->>API: Auth user created
API->>DB: INSERT into users table
DB-->>API: User profile created
API-->>F: {success: true, user}
F->>SA: signInWithPassword
SA-->>F: Session established
F->>U: Redirect to /dashboard
📚 Book Borrowing Flow
sequenceDiagram
participant U as User
participant F as Frontend
participant RPC as Supabase RPC
participant DB as Database
U->>F: Click "Borrow" on book
F->>RPC: borrow_book(org_id, book_id, user_id, due_date)
RPC->>RPC: Check membership status
RPC->>RPC: Check subscription active
RPC->>RPC: Check user loan quota
RPC->>RPC: Check book availability
alt All checks pass
RPC->>DB: INSERT loan record
RPC->>DB: DECREMENT available_copies
RPC-->>F: {success: true, loan_id}
F->>U: Show success message
else Quota exceeded
RPC-->>F: {success: false, error}
F->>U: Show error message
end
💳 Subscription Payment Flow
sequenceDiagram
participant A as Admin
participant F as Frontend
participant API as /api/stripe/checkout
participant S as Stripe
participant WH as /api/stripe/webhook
participant DB as Database
A->>F: Select plan on /org/billing
F->>API: POST {organizationId, planId, billingPeriod}
API->>S: Create checkout session (14-day trial)
S-->>API: {sessionId, url}
F->>S: Redirect to Stripe Checkout
A->>S: Complete payment
S->>WH: checkout.session.completed webhook
WH->>DB: UPDATE organization subscription
WH->>DB: INSERT subscription_history
S-->>F: Redirect to /org/billing?success=true
Note
Performance optimizations ensure fast loading times and smooth user experience across all devices.
Key Performance Indicators:
- ⚡ Lightning Fast: < 2s initial page load
- 🚀 Instant Navigation: Client-side routing with prefetching
- 📱 Mobile Optimized: Perfect scores on mobile devices
- 🔄 Real-time Updates: < 100ms database synchronization
- 📊 Efficient Rendering: Optimized React 19 components
Optimization Techniques:
- 🎯 Image Optimization: Next.js Image component with lazy loading
- 📦 Code Splitting: Automatic route-based code splitting
- 🗄️ Database Optimization: Efficient PostgreSQL queries with indexes
- 🔄 Caching Strategy: Static generation where possible
Important
Ensure you have the following installed and configured:
- Node.js 18.0+ (Download)
- npm/yarn/pnpm package manager
- Git (Download)
- Supabase Account (Sign up)
- Stripe Account (Sign up) - for billing features
1. Clone Repository
git clone https://github.com/ChanMeng666/library-management-system.git
cd library-management-system2. Install Dependencies
# Using npm
npm install
# Using pnpm (recommended)
pnpm install3. Environment Setup
# Copy environment template
cp .env.example .env.local
# Edit environment variables
nano .env.local4. Start Development
npm run dev🎉 Success! Open http://localhost:3000 to view the application.
Create .env.local file with the following variables:
# Supabase (Required)
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
# Stripe (Required for billing)
STRIPE_SECRET_KEY=sk_test_or_live_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Email (Optional - for invitations)
RESEND_API_KEY=re_your_api_keyWarning
Never commit sensitive environment variables to version control. Use Vercel's environment variables settings for production.
Using Supabase CLI:
# Start local Supabase
npx supabase start
# Apply migrations
npx supabase db reset
# Stop local Supabase
npx supabase stopManual Setup:
- Create a new project on Supabase
- Run the migration files in
supabase/migrations/in order - Configure RLS policies as defined in the migrations
Important
The application is optimized for deployment on Vercel, but can be deployed on any platform that supports Next.js.
One-Click Deploy:
Manual Deployment:
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel --prod| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Supabase project URL | ✅ |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Supabase anonymous key | ✅ |
SUPABASE_SERVICE_ROLE_KEY |
Supabase service role key | ✅ |
STRIPE_SECRET_KEY |
Stripe secret key | ✅ |
STRIPE_WEBHOOK_SECRET |
Stripe webhook secret | ✅ |
NEXT_PUBLIC_APP_URL |
Application URL | ✅ |
RESEND_API_KEY |
Resend API key | 🔶 |
Note
✅ Required, 🔶 Optional
- Create Organization - Set up your library environment
- Configure Settings - Set loan duration, max loans per user
- Invite Team - Add librarians and members via email
- Subscribe - Choose a plan that fits your needs
- Manage Books - Add, edit, and delete books
- Process Loans - Handle borrowing and returns
- Track Inventory - Monitor book availability
- Browse Catalog - Search and filter books
- Borrow Books - Check out available books
- Write Reviews - Rate and review books
- Track Loans - View due dates in dashboard
| Service | Purpose | Status |
|---|---|---|
| Supabase | Database, Auth, RLS | ✅ Active |
| Stripe | Subscriptions, Billing | ✅ Active |
| Resend | Email Invitations | ✅ Active |
| Vercel | Hosting & Deployment | ✅ Active |
| shadcn/ui | UI Components | ✅ Active |
# Development
npm run dev # Start dev server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
# Database
npx supabase start # Start local Supabase
npx supabase stop # Stop local Supabase
npx supabase db reset # Reset databasesrc/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication
│ │ ├── stripe/ # Stripe webhooks
│ │ └── email/ # Email sending
│ ├── books/ # Book pages
│ ├── dashboard/ # User dashboard
│ └── org/ # Organization pages
├── components/
│ ├── books/ # Book components
│ ├── layout/ # Layout components
│ ├── organization/ # Org components
│ └── ui/ # shadcn/ui components
├── contexts/ # React contexts
├── lib/ # Utilities
└── types/ # TypeScript types
We welcome contributions to improve the Library Management System!
Development Process:
- Fork the Repository
- Create Feature Branch (
git checkout -b feature/AmazingFeature) - Commit Changes (
git commit -m 'Add some AmazingFeature') - Push to Branch (
git push origin feature/AmazingFeature) - Open Pull Request
Contribution Guidelines:
- Follow TypeScript best practices
- Maintain consistent code style
- Add comments for complex logic
- Test your changes thoroughly
- Update documentation as needed
|
|
|---|
This project is licensed under the MIT License - see the LICENSE file for details.
Chan Meng Creator & Lead Developer |
Chan Meng
LinkedIn: chanmeng666
GitHub: ChanMeng666
Email: chanmeng.dev@gmail.com
Website: chanmeng.live
Empowering organizations and readers worldwide
⭐ Star us on GitHub • 📖 Read the Documentation • 🐛 Report Issues • 💡 Request Features • 🤝 Contribute
Made with ❤️ for the library community





