A RESTful API for a Book Management System with user authentication, profile management, and book management.
/book-management-system
│
├── /views # EJS templates
│ └── welcomeEmail.ejs # Welcome email template
├── /routes # Express routes
│ ├── auth.js # Authentication routes (register, login)
│ ├── profile.js # Profile management routes
│ └── books.js # Book management routes
├── /controllers # Route handlers
│ ├── authController.js # Handles user registration, login, etc.
│ ├── profileController.js # Handles profile RUD operations
│ └── bookController.js # Handles book CRUD operations
├── /models # Database models and schema
│ ├── userModel.js # User model
│ └── bookModel.js # Book model
├── /middlewares # Protect admin routes
│ ├── authMiddleware.js # Authenticate add, delete and update endpoints
├── /config # Configuration files
│ └── db.js # Database connection setup
├── .env # Stores environment variables
├── package-lock.json # Project metadata
├── package.json # Project metadata and dependencies
├── server.js # server entry point
├── README.md # Setup guide and documentation
└── app.js # Main application setup
Before you begin, ensure you have the following installed on your machine:
Fork this repository by clicking on the fork button on the top of this page, this will create a copy of this repository in your account.
git clone https://github.com/your-github-username/Book-Management-System.git
cd Book-Management-System
Set up environment variables by creating a `.env` file
PORT=3000
JWT_SECRET=your_jwt_secret
DB_URI=your_database_uri
EMAIL_SERVICE=gmail
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=465
EMAIL_USER=your_gmail_username
EMAIL_PASS=your_app_password
npm install node.js express bcryptjs jsonwentoken mongoose body-parser ejs dotenv nodemailer nodemon
npm start
Use MongoDB locally or via MongoDB Atlas. Update the DB_URI
in .env
accordingly.