A modern web application for managing books with Node.js backend, Express API, and JSON file database.
- 📖 Book Listing: View all books with search and filter functionality
- ➕ Create Books: Add new books with comprehensive form
- 📋 Book Details: View detailed information about individual books
- ✏️ Edit Books: Update existing book information
- 🗑️ Delete Books: Remove books from the collection
- 🔍 Search & Filter: Find books by title, author, genre, or rating
- 📱 Responsive Design: Works on desktop, tablet, and mobile devices
- 🎨 Modern UI: Beautiful gradient design with smooth animations
- Backend: Node.js with Express.js
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Database: JSON file (data/books.json)
- Styling: Modern CSS with gradients and animations
- API: RESTful API endpoints
UIProject/
├── data/
│ └── books.json # JSON database file
├── public/
│ ├── index.html # Main book listing page
│ ├── create.html # Create new book page
│ ├── book-details.html # Book details page
│ ├── styles.css # Main stylesheet
│ └── script.js # Frontend JavaScript
├── server.js # Node.js server and API
├── package.json # Project dependencies
└── README.md # This file
-
Install Dependencies
npm install
-
Start the Server
# Development mode (with auto-restart) npm run dev # Production mode npm start
-
Access the Application
- Open your browser and go to
http://localhost:3000 - The application will be ready to use!
- Open your browser and go to
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/books |
Get all books |
| GET | /api/books/:id |
Get book by ID |
| POST | /api/books |
Create new book |
| PUT | /api/books/:id |
Update book |
| DELETE | /api/books/:id |
Delete book |
- Displays all books in a responsive grid
- Search functionality by title, author, or genre
- Filter by genre and rating
- Click on any book to view details
- Form to add new books
- Required fields: Title, Author
- Optional fields: Genre, Published Year, Description, ISBN, Pages, Rating, Cover Image
- Automatic redirect to book details after creation
- Detailed view of individual books
- Shows all book information including cover image
- Edit and delete options
- Navigation back to book listing
Each book object contains:
{
"id": "1",
"title": "Book Title",
"author": "Author Name",
"genre": "Genre",
"publishedYear": 2024,
"description": "Book description...",
"isbn": "978-1234567890",
"pages": 300,
"rating": 4.5,
"coverImage": "https://example.com/image.jpg"
}- Search: Real-time search across title, author, and genre
- Genre Filter: Filter books by specific genres
- Rating Filter: Show books with minimum rating (2+, 3+, 4+ stars)
- Mobile-first approach
- Adaptive grid layout
- Touch-friendly interface
- Optimized for all screen sizes
- Loading states for better feedback
- Success/error messages
- Smooth animations and transitions
- Intuitive navigation
- Update the API endpoints in
server.js - Modify the frontend JavaScript in
public/script.js - Update the UI in the respective HTML files
- Style changes in
public/styles.css
- The JSON file (
data/books.json) serves as the database - Data persists between server restarts
- Easy to backup and version control
- Can be easily migrated to a real database later
-
Port already in use
# Change port in server.js or use different port PORT=3001 npm start -
CORS issues
- The server includes CORS middleware
- If issues persist, check browser console for errors
-
Image loading errors
- Default fallback images are provided
- Check image URLs in the book data
# Run with debug logging
DEBUG=* npm start- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
For questions or issues, please check the troubleshooting section or create an issue in the repository.
Happy Reading! 📚✨