Skip to content

Latest commit

 

History

History
341 lines (272 loc) · 16 KB

File metadata and controls

341 lines (272 loc) · 16 KB
Shelfy Logo

Shelfy - Library Management System

A comprehensive, user-friendly web application for streamlined library operations built with React, TypeScript and modern web technologies.

Backend Repo GitHub Repo React TypeScript Redux Toolkit Tailwind CSS


🔍 Frontend Overview

Shelfy is a production-ready, full-featured web application that serves as the visual interface for the Shelfy ecosystem. It provides an intuitive, responsive experience for browsing books, managing inventory, and tracking borrow activities.

This repository focuses exclusively on the Client-Side UI, consuming the RESTful API from the Shelfy Backend Server.


✨ Key Features

📚 Book Management

FeatureDescription
Book CatalogBrowse all books with advanced sorting and genre filtering
CRUD OperationsCreate, read, update and delete book records with real-time feedback
Rich MetadataTitle, Author, Genre, ISBN, Description and copy management
Availability TrackingAutomatic status updates based on available copies

🔄 Borrowing System

FeatureDescription
Streamlined CheckoutSimple, intuitive book borrowing process with form validation
Due Date PickerFlexible date selection with future-date enforcement via React Day Picker
Inventory SyncReal-time availability updates reflected immediately across the UI
Borrow SummaryAggregated dashboard showing total borrow quantities per book

🎨 UI & Developer Experience

FeatureDescription
Dark / Light ModeTheme switching powered by next-themes with zero flash
Toast NotificationsElegant success and error feedback via Sonner
Accessible ComponentsBuilt on Radix UI primitives for WCAG-compliant interactions
Responsive DesignOptimized layout for desktop, tablet and mobile devices

🛠️ Tech Stack

TechnologyVersionPurpose
React^19.1.0Core UI library with concurrent features
TypeScript~5.8.3Type-safe development experience
Vite^7.0.4Lightning-fast build tool and dev server
Redux Toolkit^2.8.2Global state management
RTK Query^2.8.2Efficient API data fetching and caching
React Router^7.7.1Client-side routing
Tailwind CSS^4.1.11Utility-first CSS framework
Radix UI^1.4.3Accessible, unstyled component primitives
React Hook Form^7.62.0Performant form state management
Zod^4.0.14Runtime schema validation
Lucide React^0.535.0Consistent, beautiful icon library
React Day Picker^9.8.1Flexible date picker component
Sonner^2.0.7Elegant toast notification system
next-themes^0.4.6Dark/light mode theme management
date-fns^4.1.0Modern date utility library
clsx / tailwind-merge^2.1.1Conditional class name utilities

🏗️ Architecture

                           ┌───────────────────────────────────────────────────────┐
                           │                    Browser Client                     │
                           │              React 19 + TypeScript + Vite             │
                           └──────────────────────────────┬────────────────────────┘
                                                          │
                           ┌──────────────────────────────▼────────────────────────┐
                           │                  React Router v7                      │
                           │       /books   /create-book   /borrow/:id             │
                           └───────────┬───────────────────────────────┬───────────┘
                                       │                               │
                           ┌───────────▼──────────┐       ┌────────────▼───────────┐
                           │   Page Components    │       │   Redux Store          │
                           │  (Layouts/Pages)     │       │   RTK Query Slices     │
                           └───────────┬──────────┘       └────────────┬───────────┘
                                       │                               │
                           ┌───────────▼───────────────────────────────▼───────────┐
                           │              Shared Components (Radix UI /            │
                           │              Lucide Icons / Tailwind CSS)             │
                           └────────────────────────────┬──────────────────────────┘
                                                        │     HTTP (RTK Query)
                           ┌────────────────────────────▼──────────────────────────┐
                           │                Shelfy Backend REST API                │
                           │           Node.js · Express · MongoDB                 │
                           └───────────────────────────────────────────────────────┘

📂 Project Structure

milestone-16-client/
├── src/
│   ├── components/         # Reusable UI components (buttons, modals, tables)
│   ├── hooks/              # Custom React hooks
│   ├── layouts/            # Page layout wrappers
│   ├── lib/                # Utility helpers (cn, formatters)
│   ├── pages/              # Route-based page components
│   │   ├── home/           # Landing / dashboard page
│   │   ├── allBooks/       # Book catalog with filter & sort
│   │   ├── addBook/        # Add new book form
│   │   ├── borrowSummary/  # Aggregated borrow analytics
│   │   └── documentation/  # API documentation page
│   ├── providers/          # Theme & Redux providers
│   ├── redux/              # Redux store & RTK Query API slices
│   ├── routes/             # Route definitions
│   ├── schema/             # Zod validation schemas
│   ├── styles/             # Global CSS and Tailwind config
│   ├── types/              # TypeScript type definitions
│   ├── main.tsx            # App entry point
│   └── vite-env.d.ts
├── index.html
├── package.json
├── vite.config.ts
└── README.md

🚀 Getting Started

Prerequisites

RequirementDetails
Node.jsv18 or higher
Backend ServerShelfy Backend running on port 3000
Package Managernpm or yarn

Installation

  1. Clone the repository

    git clone https://github.com/zahid-official/milestone-16-shelfyClient.git
    cd milestone-16-client
  2. Install dependencies

    npm install
  3. Configure environment variables

    Create a .env.local file in the root directory:

    VITE_API_BASE_URL=http://localhost:3000/api
  4. Start the development server

    npm run dev

    The app will open at http://localhost:5173


🔑 Environment Variables

VariableDescriptionRequired
VITE_API_BASE_URLShelfy Backend API base URLYes

📜 Available Scripts

ScriptCommandDescription
Developmentnpm run devStart Vite dev server with HMR
Buildnpm run buildType-check and build for production
Previewnpm run previewPreview the production build locally
Lintnpm run lintRun ESLint across the codebase

⚙️ Application Routes

RoutePageDescription
/HomeLanding page and dashboard overview
/booksAll BooksBrowse, filter, sort and manage the catalog
/books/:idBook DetailsFull book information and quick actions
/create-bookAdd BookForm to create a new book record
/edit-book/:idEdit BookPre-filled form to update book details
/borrow/:bookIdBorrow BookQuantity selection and due date picker
/borrow-summaryBorrow SummaryAggregated borrowing analytics dashboard
/documentationDocumentationAPI and usage documentation

🌟 How It Works

Data Flow:

                                 User Interaction (e.g. Borrow a Book)
                                                    │
                                                    ▼
                              React Component dispatches RTK Query mutation
                                                    │
                                                    ▼
                               RTK Query sends POST /api/borrow to backend
                                                    │
                                             ┌──────┴───────┐
                                             │              │
                                             ▼              ▼
                                          Success?       Error?
                                             │              │
                                             ▼              ▼
                                    Invalidates cache  Sonner toast
                                    Auto-refetches     shows error
                                    book list data     message
                                             │
                                             ▼
                                   UI updates instantly with fresh data
  1. User triggers action — clicks a button or submits a form
  2. React Hook Form validates — Zod schema runs against form values client-side
  3. RTK Query fires request — mutation or query sent to the Shelfy backend API
  4. Cache invalidated on success — related queries auto-refetch for fresh data
  5. Sonner notifies user — toast confirms success or surfaces error message
  6. UI reflects new state — components re-render with updated Redux store data

🌟 Author

Zahid Official

Zahid Official

Web Developer | Tech Enthusiast

GitHub LinkedIn Email

Creating impactful digital experiences with passion and purposeful design


🤝 Contributing

# 1. Fork the repository on GitHub

# 2. Clone your fork
git clone https://github.com/your-username/milestone-16-client.git

# 3. Create a feature branch
git checkout -b feature/your-feature-name

# 4. Commit your changes
git commit -m "feat: add your feature description"

# 5. Push to your fork
git push origin feature/your-feature-name

# 6. Open a Pull Request on GitHub

Shelfy - Redefining library efficiency through seamless digital innovation.