Skip to content

bry-ly/Librarium

Repository files navigation

Librarium - Modern Library Management System

A comprehensive, modern library management system built with Next.js 15, featuring role-based access control for Members and Librarians. This system streamlines book circulation, inventory management, and member services with a beautiful, responsive user interface.

🎯 Overview

Librarium provides a complete solution for managing library resources, tracking book circulation, and handling member reservations. The system supports distinct user roles, each with tailored dashboards and functionalities to meet their specific needs.

Key Highlights

  • Multi-Role System: Separate dashboards for Members (Users) and Librarians (Admins)
  • Smart Circulation: Efficient tracking of book issues, returns, and overdue fines
  • Catalog Management: Comprehensive management of Books, Authors, Genres, and Racks
  • Responsive Design: Modern UI built with TailwindCSS 4 and Radix UI components
  • Type-Safe: Full TypeScript implementation with Zod validation
  • Database-Driven: PostgreSQL with Prisma ORM for robust data management

✨ Features

👤 Member Features

  • Catalog Browsing: Browse available books, filter by genre, author, or subject
  • Smart Search: Advanced search functionality to find resources quickly
  • Reservation System: Reserve books that are currently borrowed
  • Borrow History: View current loans and past borrowing history
  • Fine Tracking: Track and view outstanding fines
  • Profile Management: Update personal information and preferences

👨‍💼 Librarian (Admin) Features

  • Dashboard Overview: Real-time statistics on total books, active members, and circulation
  • Resource Management: Add, update, and remove Books, Authors, Genres, and Subjects
  • Inventory Control: Manage physical items, rack locations, and status (Available, Lost, Damaged)
  • Circulation Desk: Streamlined process for issuing and returning books
  • Member Management: Manage member accounts, roles, and statuses
  • Fine Management: Track and settle member fines
  • Reports & Analytics: View circulation trends and inventory reports

🛠️ Tech Stack

Frontend

  • Next.js 15 - React framework with App Router
  • React 19 - UI library
  • TypeScript - Type-safe development
  • TailwindCSS 4 - Utility-first CSS framework
  • Radix UI - Accessible component primitives
  • Shadcn/ui - High-quality component library
  • Recharts - Chart library for analytics
  • React Hook Form - Form management
  • Zod - Schema validation
  • Motion - Animation library

Backend

  • Next.js API Routes - Server-side API endpoints
  • Better Auth - Authentication and session management
  • Prisma - Type-safe database ORM
  • PostgreSQL - Relational database

Development Tools

  • ESLint - Code linting
  • Turbopack - Fast bundler for development

📋 Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 20.x or higher
  • npm, yarn, pnpm, or bun package manager
  • PostgreSQL database (local or cloud instance)

🚀 Getting Started

1. Clone the Repository

git clone <repository-url>
cd library-system

2. Install Dependencies

npm install
# or
yarn install
# or
pnpm install

3. Environment Variables Setup

Create a .env file in the root directory and add the following variables:

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/library_db?schema=public"

# Better Auth Configuration
BETTER_AUTH_URL="http://localhost:3000"
BETTER_AUTH_SECRET="your_secret_key"

# Next.js
NEXT_PUBLIC_APP_URL="http://localhost:3000"

4. Database Setup

Generate Prisma Client and run migrations:

# Generate Prisma Client
npx prisma generate

# Push schema to database
npm run db:push

# (Optional) Seed the database with initial data
npm run db:seed

5. Run the Development Server

npm run dev

Open http://localhost:3000 in your browser to see the application.

📁 Project Structure

library-system/
├── app/                      # Next.js App Router pages
│   ├── api/                 # API routes
│   │   ├── auth/           # Authentication API
│   │   ├── books/          # Books API
│   │   ├── transactions/   # Transactions API
│   │   └── users/          # User API
│   ├── dashboard/          # Dashboard pages
│   │   ├── admin/         # Admin dashboard
│   │   └── user/          # User dashboard
│   ├── auth/               # Auth pages (Login/Signup)
│   └── page.tsx            # Landing page
├── components/              # React components
│   ├── auth/               # Authentication components
│   ├── dashboard/          # Dashboard components
│   ├── ui/                 # UI components (Shadcn)
│   └── ...
├── lib/                     # Utility functions and configurations
│   ├── auth.ts             # Auth configuration
│   ├── prisma.ts           # Prisma client
│   └── utils.ts            # Utility functions
├── prisma/                  # Database schema and migrations
│   ├── schema.prisma       # Prisma schema
│   └── seed.ts             # Database seeder
├── public/                  # Static assets
└── package.json            # Dependencies and scripts

🔐 Authentication

The system uses Better Auth for secure authentication:

  • Sign Up: Users register with name, email, and password
  • Sign In: Secure login with credentials
  • Role-Based Access: Automatic routing based on user role (USER, ADMIN)
  • Session Management: Secure session handling

📊 Database Schema

The system uses PostgreSQL with the following main models:

  • User: System users with roles (User, Admin)
  • Resource: Book titles and metadata
  • Item: Physical copies of books
  • Transaction: Borrow and return records
  • Reservation: Book reservation requests
  • Author/Genre/Subject: Metadata for categorization
  • Rack: Physical location tracking

🧪 Available Scripts

# Development
npm run dev          # Start development server with Turbopack

# Production
npm run build        # Build for production
npm run start        # Start production server

# Database
npm run db:push      # Push schema changes to DB
npm run db:seed      # Seed database

📝 License

This project is private and proprietary.

About

Resources

Stars

Watchers

Forks

Contributors

Languages