A modern multi-page eLibrary application built with Webpack, JavaScript ES6 modules, and Tailwind CSS v4.
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.
- Sophat LEAT - Project Lead & Developer
- 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
- 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
- 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
- Home Page (
/) - Landing page with hero section and featured books - Collection Page (
/collection/) - Browse and search books catalog with category filtering - Book Details Page (
/collection/book/) - Detailed view of individual books with related recommendations - Authors Page (
/authors/) - Browse author profiles and their collections - Author Profile Page (
/authors/profile/) - Individual author pages with biography and books - About Page (
/about-us/) - Information about the project, team, and features - 404 Page (
/404/) - Custom error page for not found resources
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
- Node.js (v16 or higher)
- npm or yarn
- Clone the repository
- Install dependencies:
npm install
Start the development server:
npm run devThis will start the Webpack dev server at http://localhost:3000 with hot module replacement.
Build the application for production:
npm run buildThis will create optimized files in the dist/ directory with content hashing.
npm run dev- Start development servernpm run build- Build for productionnpm start- Start development server and open browser
- 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 metadataCards.relatedBook()- Compact related book cardsCards.recommendedBook()- Optimized recommendation cardsCards.author()- Author profile cards with avatar and statisticsCards.skeleton()- Book card loading skeletonsCards.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
- External API: Integrated with
https://api.sophat.topfor 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
- Dark/Light mode toggle with system preference detection
- localStorage persistence for theme preference
- Smooth transitions between themes
- Icon changes based on current theme
- 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
- Latest Tailwind CSS with PostCSS integration
- Custom utility classes and components with
tailwind-mergeintegration - 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
- 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
- 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
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- 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
- 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
- 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
- Fork the repository
- Create a feature branch
- Make your changes following the existing code style
- Test your changes locally
- Submit a pull request
This project is licensed under the MIT License.