MyLibrary is a sleek, modern, and fully responsive library management web application built with Node.js, Express, and MongoDB. It demonstrates full CRUD operations for managing books and authors, featuring advanced UI aesthetics, image uploading, and database protection mechanisms designed for safe public deployment.
-
Premium UI/UX:
- Complete dark theme (Obsidian, Teal, and Warm Gold gradient accents).
- Glassmorphism effects with modern, floating card designs.
- Fully responsive layout featuring a fixed left sidebar on desktop and a smooth hamburger menu on mobile devices.
- Custom SVG branding and typography.
-
Author & Book Management (CRUD):
- Add, update, and delete authors and books dynamically.
- View individual author profiles and all books published by them.
-
Advanced Image Handling:
- Integrated with FilePond for seamless Drag & Drop image uploads.
- Images are base64-encoded, resized, and saved directly into the MongoDB document block.
-
🛡️ Database Protection & Demo Mode:
- Size Limits: Hard-capped image file size limits (~500KB) to protect database storage.
- Count Limits: Prevents users from adding more than 100 books to protect the free MongoDB tier.
- Protected Data: Includes an
isProtectedboolean flag on specific books/authors. Protected entries hide the "Edit" and "Delete" buttons from the public UI and block modification requests at the route level.
-
Automated Seeding:
- A robust
seedData.jsscript that uses public APIs to automatically download and seed 10 classic/technical books (with their covers) into your database as unmodifiable protected instances.
- A robust
- Backend: Node.js, Express.js
- Database: MongoDB Atlas, Mongoose ODM
- Frontend Template: EJS (Embedded JavaScript templates)
- Styling: Vanilla CSS (Variables, Grid, Flexbox, Media Queries)
- File Upload: FilePond, Base64 Encoding
- Deployment: Vercel Serverless Ready (
vercel.json)
-
Clone the repository:
git clone https://github.com/prashantsaini1525/MyLibrary.git cd MyLibrary -
Install dependencies:
npm install
-
Set Up Environment Variables: Create a
.envfile in the root directory and add your MongoDB connection string:DATABASE_URL=your_mongodb_connection_string PORT=3000
-
Seed the Database (Optional but Recommended): Run the seeding script to populate your database with 10 high-quality, protected demo books:
node seedData.js
-
Run the Application locally:
npm run devStart
Open your browser and navigate to
http://localhost:3000.
This repository is pre-configured to be deployed natively on Vercel as Serverless Functions.
- Import the repository into your Vercel Dashboard.
- Under "Environment Variables", add the
DATABASE_URLkey and provide your MongoDB connection string. - Deploy! Vercel handles the Express routing using the
server.jsexport mapping andvercel.json.
Contributions are welcome! Feel free to fork the repository, open pull requests, or submit issues with suggestions.
This project is licensed under the MIT License. See the LICENSE file for details.