Skip to content

This project is a learning resource for understanding Spring Boot, RESTful APIs, PostgreSQL, and Docker. It simulates a library management system with role-based access control.

Notifications You must be signed in to change notification settings

hasbyrosyadi/library-app

Repository files navigation

📚 Library Management System

📌 Summary

Library Management System is a Spring Boot-based application used to manage a library's book collection, including book CRUD features and user management with different roles.

🚀 Running via Docker

  1. Ensure Docker and Docker Compose are installed.
  2. Open a terminal and navigate to the project root.
  3. Run the following command:
    docker-compose up --build
  4. The application will be available at http://localhost:8080, and the PostgreSQL database at localhost:5432.

💻 Running Locally

  1. Ensure Java 17, Maven, and PostgreSQL are installed.
  2. Create a new database in PostgreSQL named library_db.
  3. Configure application.properties or application.yml with the appropriate PostgreSQL credentials.
  4. Run the following command:
    mvn clean spring-boot:run
  5. The application can be accessed at http://localhost:8080.

🔄 Importing Collection to Postman

  1. Open Postman.
  2. Click Import at the top left corner.
  3. Select Upload Files and choose the collection file provided in the project.
  4. Once imported successfully, the API collection is ready for use.

🔑 Roles & Access

Role Create Articles Edit Other Users' Articles Delete Articles Manage Users
SUPER_ADMIN ✅ Yes ✅ Yes ✅ Yes ✅ Yes (CRUD User & Role)
ADMIN ✅ Yes ✅ Yes ✅ Yes ❌ Cannot manage users
EDITOR ✅ Yes ✅ Yes (only their own) ❌ Cannot delete ❌ Cannot manage users
CONTRIBUTOR ✅ Yes ❌ Cannot edit ❌ Cannot delete ❌ Cannot manage users
VIEWER ❌ Cannot create ❌ Cannot edit ❌ Cannot delete ❌ Cannot manage users

🔍 Role Explanation

  • SUPER_ADMIN → Can perform all actions, including managing users & their roles.
  • ADMIN → Same as SUPER_ADMIN but cannot manage users.
  • EDITOR → Can create & edit only their own articles but cannot delete them.
  • CONTRIBUTOR → Can create articles but cannot edit or delete them.
  • VIEWER → Can only read articles (default role upon registration).

📝 Note

By default, newly registered users are assigned the VIEWER role.
To set a user as SUPER_ADMIN, you must manually update their role in the database.

About

This project is a learning resource for understanding Spring Boot, RESTful APIs, PostgreSQL, and Docker. It simulates a library management system with role-based access control.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages