This is a Library App project that allows users to manage a list of books, search for books, and rate them. The project demonstrates modern frontend development techniques using Webpack, TailwindCSS, and JSON Server to handle CRUD operations.
- 📚 Add, Edit, and Delete Books
- 🔍 Search books by title or author
- ⭐ Rate books from 1 to 5 stars
- 📂 Data persistence via JSON Server
- 🎉 Fully responsive design using TailwindCSS
- ⚡ Live reload with Webpack Dev Server
📦 library-app
├── 📁 dist (Production build files)
│ ├── index.html
│ ├── style.css
│ └── bundle.js
├── 📁 src (Source files)
│ ├── 📁 css
│ │ └── style.css (Tailwind base styles)
│ ├── 📁 js
│ │ ├── book.js (Class for Book objects)
│ │ ├── library.js (Handles API requests for books)
│ │ ├── ui.js (Handles UI interactions and DOM updates)
│ │ └── index.js (Main entry point)
│ └── index.html (HTML structure)
├── 📄 package.json (Project dependencies and scripts)
├── 📄 webpack.config.js (Webpack configuration)
├── 📄 postcss.config.js (PostCSS configuration for Tailwind)
├── 📄 tailwind.config.js (Tailwind configuration file)
└── 📄 db.json (Mock database for JSON Server)
- Webpack - Module bundler for JS, CSS, and images
- TailwindCSS - Utility-first CSS framework
- JSON Server - Fake REST API for CRUD operations
- PostCSS - CSS transformations for Tailwind
- MiniCssExtractPlugin - Extracts CSS into separate files
-
Clone the repository:
git clone https://github.com/your-username/library-app.git cd library-app -
Install dependencies:
npm install
-
Run JSON Server (for API backend):
npm run server
-
Run development server:
npm start
npm start- Starts the development server with live reload onhttp://localhost:3000/npm run server- Starts the JSON Server onhttp://localhost:5000/npm run build- Creates a production-ready build in the dist/ folder
Handles the bundling of JavaScript, CSS, and HTML files.
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
entry: './src/js/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
devServer: {
static: './dist',
port: 3000,
open: true,
hot: true,
},
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
}),
new MiniCssExtractPlugin({
filename: 'style.css',
}),
],
};Tailwind configuration file that specifies the content paths for PurgeCSS.
module.exports = {
content: ['./src/**/*.{html,js}'],
theme: {
extend: {},
},
plugins: [],
}PostCSS configuration file used to run Tailwind transformations.
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}-
Add a Book:
- Fill in the form for title, author, and rating.
- Click the Add Book button to add the book to the list.
- The book will be saved in the JSON Server database.
-
Search for Books:
- Type the title or author in the search bar to filter the book list.
-
Rate a Book:
- Click the rating input to set the rating from 1 to 5 stars.
-
Delete a Book:
- Click the delete button next to a book to remove it.
If you'd like to customize Tailwind, modify the tailwind.config.js file.
module.exports = {
content: ['./src/**/*.{html,js}'],
theme: {
extend: {
colors: {
customBlue: '#1da1f2',
},
},
},
plugins: [],
}After changes, rebuild the project:
npm run build- Fork the project.
- Create a feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for more information.
If you have any questions or suggestions, please feel free to open an issue or reach out to the developer.
Happy Coding! 🚀