An open API service indexing awesome lists of open source software.

https://github.com/kareemwaleed266/library-management-system-api

A secure ASP.NET Core Web API for managing library books, users, and roles with JWT authentication and EF Core.
https://github.com/kareemwaleed266/library-management-system-api

aspnetcore backend-api entityframework jwt-authentication library-management-system-api sqlserver

Last synced: about 1 month ago
JSON representation

A secure ASP.NET Core Web API for managing library books, users, and roles with JWT authentication and EF Core.

Awesome Lists containing this project

README

          

# ๐Ÿ“š Library Management System API

A secure and scalable **ASP.NET Core Web API** for managing library data including books, users, roles, and transactions.
Built using **Entity Framework Core**, **ASP.NET Identity**, **JWT Authentication**, and follows **Clean Architecture** principles.

---

## ๐Ÿš€ Features

- โœ… **User Authentication & Authorization** with JWT and ASP.NET Identity
- ๐Ÿ“˜ **Book & Library Management** (CRUD operations)
- ๐Ÿงฉ **Role-based Access Control**
- ๐Ÿ” **Token security** with encryption and claims
- ๐Ÿ” **Filtering, Searching, Sorting, Pagination**
- ๐Ÿงพ **Swagger UI** for testing endpoints
- ๐Ÿ“Š **Centralized Logging** via NLog
- ๐Ÿ” **Layered Clean Architecture** (Service/Repo/API Separation)
- ๐Ÿ“ฆ **DTO Mapping** using AutoMapper

---

## ๐Ÿ› ๏ธ Tech Stack

| Layer | Technology |
|--------------|---------------------------------|
| Framework | ASP.NET Core 6.0 |
| ORM | Entity Framework Core |
| Database | SQL Server |
| Auth | ASP.NET Identity + JWT |
| Docs | Swagger (Swashbuckle) |
| Logging | NLog |
| Mapping | AutoMapper |

---
## ๐Ÿงฑ Project Structure Overview

### **Presentation Layer** โ€“ (API)
- `Controllers/`: RESTful endpoints for HTTP communication
- `Middlewares/`: Global error handling, JWT validation
- `Extensions/`: Service and middleware setup helpers
- `Helper/`: Token creation and encryption utilities

---

### **Business Layer** โ€“ (Services)
Located in `Library.Service/`:
- `BookService/`: Business logic for books
- `UserService/`: Manages users and roles
- `TransactionService/`: Borrow and return operations
- `TokenService/`: Handles JWT token creation and refreshing
- `Dtos/`: Each service has its own DTOs to decouple data models

---

### **Data Access Layer** โ€“ (Repositories)
- `Library.Repository/`: Contains repositories that interact with the database using EF Core

---

### **Infrastructure Layer** โ€“ (Database & Identity)
- `Library.Data/`:
- `Entities/IdentityEntities/`: Identity user/role entities
- `Migrations/`: EF Core migration files

---

### โš™๏ธ App Entry & Config
- `Program.cs`: Main app entry point (DI setup, Middleware, App config)
- `appsettings.json`: DB connection strings, JWT keys, and app secrets

---

## ๐Ÿ“ฆ Getting Started

### 1. Clone the repository

```bash
git clone https://github.com/kareemwaleed266/library-management-api.git
cd library-management-api/Library