The Library Manager is a practical study project focused on Backend development, aiming to manage users, books, and loans in a web application. The project was developed to enhance skills in Node.js, Express, JWT (JSON Web Tokens) authentication, and automated testing with Jest and Supertest. It serves as a foundation to understand concepts such as routes, middlewares, models, and integration of external libraries.
- 🔐 User Authentication: Registration and login with JWT.
- 🔒 Route Protection: Middleware to ensure only authenticated users can access specific routes.
- 📚 Book Management: Create, read, update, and delete books.
- 📖 Loan Management: Borrow and return books by authenticated users.
- 🧪 Automated Testing: Integration and unit tests with Jest and Supertest.
- ⚙️ Environment Variables: Use of
.envfor sensitive configurations.
- Node.js: JavaScript runtime environment.
- Express: Framework for building APIs.
- JWT (JSON Web Tokens): Secure authentication.
- Bcrypt: Password encryption.
- UUID: Unique ID generation.
- Dotenv: Environment variable management.
- Nodemon: Automatic server restart during development.
- Jest: Testing framework.
- Supertest: API integration testing.
- Node.js installed (version 16 or higher).
- NPM or Yarn for dependency management.
-
Clone the repository:
git clone https://github.com/mdanieldantas/library-manager.git cd library-manager -
Install dependencies:
npm install
-
Configure environment variables: Create a
.envfile in the project root and add the following variables:PORT=3000 JWT_KEY=a-very-secure-secret-key
-
Run the project:
npm run dev
-
Run tests:
npm test
library-manager/
├── coverage/
├── front-test/
├── search-form-author.html
├── node_modules/
├── src/
│ ├── assets/
│ ├── controllers/
│ │ ├── auth-controller.js
│ │ ├── auth-controller.test.js
│ │ ├── books-controller.js
│ │ └── loans-controller.js
│ ├── errors/
│ │ └── HttpError.js
│ ├── middlewares/
│ │ ├── auth-middleware.js
│ │ └── error-middleware.js
│ ├── models/
│ │ ├── books-model.js
│ │ ├── books-model.test.js
│ │ ├── loans-model.js
│ │ ├── user.test.js
│ │ └── users-model.js
│ ├── routes/
│ │ ├── api.js
│ │ ├── auth.js
│ │ └── index.js
│ └── index.js
├── .env
├── .gitignore
├── jest.config.js
├── package-lock.json
├── package.json
└── README.md
- JWT Authentication: How to implement a secure authentication system.
- Middlewares: How to create and use middlewares to protect routes.
- Book and Loan Management: How to implement CRUD for books and loans.
- Automated Testing: How to write integration and unit tests with Jest and Supertest.
- Environment Variables: How to manage sensitive configurations with
.env. - Dependency Management: How to structure a Node.js project with Express.
Contributions are welcome! Follow the steps below:
- Fork the project.
- Create a branch for your feature (
git checkout -b feature/new-feature). - Commit your changes (
git commit -m 'Add new feature'). - Push to the branch (
git push origin feature/new-feature). - Open a Pull Request.
This project is licensed under the ISC License. See the LICENSE file for details.
M Daniel Dantas
- GitHub: mdanieldantas
- LinkedIn: mdanieldantas
- Portfolio: Daniel Dantas Portfolio
- Email: contatomarcosdgomes@gmail.com
- Resume: Download Resume

