Skip to content

This project serves as an educational assignment for Year II, Semester II, Batch 23 students at Cambodian University for Specialties

Notifications You must be signed in to change notification settings

sophatlab/elibrary-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

78 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

eLibrary App

A modern multi-page eLibrary application built with Webpack, JavaScript ES6 modules, and Tailwind CSS v4.

Purpose

This project is a modern, full-featured eLibrary web application built for educational purposes at Cambodian University for Specialties (Year II, Semester II, Batch 23). It demonstrates:

  • Multi-page architecture: Home, Collection, Authors, Book Details, About, and 404 Error pages
  • Advanced book catalog and author profile management
  • Component-based architecture for scalable and maintainable code
  • Responsive design with Tailwind CSS v4
  • Dark/Light theme toggle with system preference and localStorage persistence
  • API integration for dynamic data and asynchronous handling
  • Loading skeletons and image optimization (srcset, lazy loading, WebP)
  • Accessibility features: semantic HTML, ARIA labels, keyboard navigation, color contrast
  • Modern build system with Webpack (HMR, code splitting, asset management)
  • Version control and project organization

The eLibrary App provides a practical platform for applying these concepts in a real-world, production-grade application context.

Team Members

Features

πŸ“š Core Library Features

  • Multi-page Architecture: Separate pages for Home, Collection, Authors, Book Details, and About
  • Book Catalog: Browse extensive book collections with advanced filtering and pagination
  • Author Profiles: Dedicated author pages with biographical information and book collections
  • Book Details: Comprehensive book information with related recommendations
  • Advanced Search: Global search functionality with modal interface and real-time results
  • Category Filtering: Dynamic category tabs for organizing book collections

🎨 User Experience

  • Responsive Design: Built with Tailwind CSS v4 for seamless mobile-first experience
  • Dark/Light Theme: System-aware theme toggle with localStorage persistence
  • Loading Skeletons: Smooth loading states for better perceived performance
  • Image Optimization: Responsive images with srcset, lazy loading, and error fallbacks
  • Breadcrumb Navigation: Clear navigation hierarchy across all pages
  • 404 Error Handling: Custom error pages for better user experience

πŸ”§ Technical Features

  • Modern JavaScript: ES6 modules with component-based architecture
  • API Integration: Connected to external API (https://api.sophat.top) with error handling
  • Modern Build System: Webpack with hot module replacement and code splitting
  • Asset Management: Automatic handling of images, fonts, and CSS with content hashing
  • Component System: Reusable card components with skeleton loading states
  • Performance Optimization: Image optimization, lazy loading, and efficient rendering

Pages

  1. Home Page (/) - Landing page with hero section and featured books
  2. Collection Page (/collection/) - Browse and search books catalog with category filtering
  3. Book Details Page (/collection/book/) - Detailed view of individual books with related recommendations
  4. Authors Page (/authors/) - Browse author profiles and their collections
  5. Author Profile Page (/authors/profile/) - Individual author pages with biography and books
  6. About Page (/about-us/) - Information about the project, team, and features
  7. 404 Page (/404/) - Custom error page for not found resources

Project Structure

elibrary-app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ js/                     # JavaScript entry points
β”‚   β”‚   β”œβ”€β”€ index.js            # Home page
β”‚   β”‚   β”œβ”€β”€ collection.js       # Collection page
β”‚   β”‚   β”œβ”€β”€ [collection].js     # Book details page
β”‚   β”‚   β”œβ”€β”€ authors.js          # Authors listing page
β”‚   β”‚   β”œβ”€β”€ [authors].js        # Author profile page
β”‚   β”‚   └── 404.js              # Error page
β”‚   β”œβ”€β”€ components/             # Reusable components
β”‚   β”‚   β”œβ”€β”€ cards.js            # Book & author card components with skeletons
β”‚   β”‚   β”œβ”€β”€ category-tab.js     # Category filtering tabs
β”‚   β”‚   β”œβ”€β”€ detail-card.js      # Book detail card component
β”‚   β”‚   β”œβ”€β”€ hero.js             # Hero section component (home page)
β”‚   β”‚   β”œβ”€β”€ hero-search.js      # Hero with search (collection page)
β”‚   β”‚   β”œβ”€β”€ icons.js            # Icon components
β”‚   β”‚   β”œβ”€β”€ layout.js           # Layout initialization
β”‚   β”‚   β”œβ”€β”€ mobile-sidebar.js   # Mobile navigation sidebar
β”‚   β”‚   β”œβ”€β”€ navigation.js       # Header navigation with theme toggle
β”‚   β”‚   β”œβ”€β”€ pagination.js       # Pagination component
β”‚   β”‚   └── search.js           # Search modal component
β”‚   β”œβ”€β”€ pages/                  # HTML templates
β”‚   β”‚   β”œβ”€β”€ index.html          # Home page
β”‚   β”‚   β”œβ”€β”€ collection.html     # Collection page
β”‚   β”‚   β”œβ”€β”€ [collection].html   # Book details page
β”‚   β”‚   β”œβ”€β”€ authors.html        # Authors listing page
β”‚   β”‚   β”œβ”€β”€ [authors].html      # Author profile page
β”‚   β”‚   β”œβ”€β”€ about-us.html       # About page
β”‚   β”‚   └── 404.html            # Error page
β”‚   β”œβ”€β”€ assets/                 # Static assets
β”‚   β”‚   β”œβ”€β”€ badges/             # Badge images
β”‚   β”‚   β”‚   β”œβ”€β”€ left-rice.png   # Left badge decoration
β”‚   β”‚   β”‚   └── right-rice.png  # Right badge decoration
β”‚   β”‚   └── covers/             # Book cover images
β”‚   β”‚       └── home-cover.png  # Homepage hero cover
β”‚   β”œβ”€β”€ libs/                   # Utility libraries
β”‚   β”‚   β”œβ”€β”€ constant.js         # API configuration & image optimization
β”‚   β”‚   └── utils.js            # Tailwind utility functions (cn helper)
β”‚   └── style/
β”‚       └── main.css            # Tailwind CSS v4 with custom styles
β”œβ”€β”€ dist/                       # Built files (generated)
β”œβ”€β”€ webpack.config.js           # Webpack configuration
β”œβ”€β”€ postcss.config.mjs          # PostCSS configuration
└── package.json

Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation

  1. Clone the repository
  2. Install dependencies:
    npm install

Development

Start the development server:

npm run dev

This will start the Webpack dev server at http://localhost:3000 with hot module replacement.

Build for Production

Build the application for production:

npm run build

This will create optimized files in the dist/ directory with content hashing.

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm start - Start development server and open browser

Technical Features

Component Architecture

  • Navigation Component: Responsive header with logo, search, theme toggle, and GitHub link
  • Hero Components: Landing page hero and search-enabled hero for collection page
  • Search Component: Modal-based search interface with debounced API calls
  • Cards Component: Reusable book and author card components with multiple variants:
    • Cards.book() - Standard book cards with cover and metadata
    • Cards.relatedBook() - Compact related book cards
    • Cards.recommendedBook() - Optimized recommendation cards
    • Cards.author() - Author profile cards with avatar and statistics
    • Cards.skeleton() - Book card loading skeletons
    • Cards.authorSkeleton() - Author card loading skeletons
  • Pagination Component: Reusable pagination with page navigation
  • Mobile Sidebar: Responsive mobile navigation with theme toggle
  • Category Tabs: Dynamic category filtering for book collections
  • Detail Card: Comprehensive book detail display component
  • Icon System: Centralized icon components for consistent UI

API Integration

  • External API: Integrated with https://api.sophat.top for book and author data
  • Image Optimization:
    • Dynamic image sizing with srcset generation
    • Multiple image sizes (50w, 100w, 200w, 400w, 800w)
    • Quality optimization (q=60 for standard, q=10 for srcset)
    • Automatic error fallback images
  • Error Handling: Graceful fallbacks for failed API calls and missing images
  • Performance: Request optimization with lazy loading and efficient caching

Theme System

  • Dark/Light mode toggle with system preference detection
  • localStorage persistence for theme preference
  • Smooth transitions between themes
  • Icon changes based on current theme

Webpack Configuration

  • Multiple Entry Points: Each page has its own JavaScript entry point (7 total pages)
  • HTML Generation: Automatic HTML file generation with proper chunking
  • CSS Extraction: Separate CSS files for production with content hashing
  • Asset Management: Optimized handling of images, fonts, and other assets
  • Code Splitting: Vendor and common chunk splitting for optimal loading
  • History API Fallback: Proper routing for single-page application behavior
  • Clean Plugin: Automatic cleanup of dist folder on builds

Tailwind CSS v4

  • Latest Tailwind CSS with PostCSS integration
  • Custom utility classes and components with tailwind-merge integration
  • Responsive design utilities with mobile-first approach
  • Modern color palette with CSS custom properties
  • Custom component classes for consistent styling
  • cn() utility function for conditional class merging

Performance Optimizations

  • Image Optimization:
    • Responsive images with automatic srcset generation
    • Lazy loading with intersection observer
    • WebP format support with fallbacks
    • Multiple size variants for different screen densities
  • Loading States: Skeleton components for smooth loading experiences
  • Code Splitting: Separate bundles for each page to reduce initial load time
  • Asset Optimization: Content hashing for cache busting and long-term caching
  • Bundle Analysis: Vendor and common chunk separation for optimal caching
  • Development Performance: Hot module replacement for instant updates

Accessibility Features

  • Semantic HTML: Proper HTML5 semantic elements throughout
  • ARIA Labels: Comprehensive aria-label attributes for screen readers
  • Keyboard Navigation: Full keyboard accessibility support
  • Alt Text: Descriptive alt text for all images
  • Focus Management: Proper focus indicators and management
  • Color Contrast: Accessible color combinations in both themes

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Development Features

Hot Module Replacement

  • Instant updates during development without full page reloads
  • CSS hot reloading for immediate style changes
  • JavaScript module hot swapping for component updates
  • Preserved application state during development

Development Server

  • Port 3000 with auto-open browser functionality
  • Compression enabled for faster development loading
  • History API fallback for client-side routing
  • Automatic error overlay for debugging

Build Optimization

  • Content hashing for cache busting and long-term caching
  • Vendor chunk splitting for optimal loading performance
  • Common chunk extraction to reduce bundle duplication
  • Minification and tree-shaking for production builds
  • Asset optimization with automatic compression

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes following the existing code style
  4. Test your changes locally
  5. Submit a pull request

License

This project is licensed under the MIT License.

About

This project serves as an educational assignment for Year II, Semester II, Batch 23 students at Cambodian University for Specialties

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published