- User Registration and Authentication: Users can register and log in to the system with different access levels (patrons, librarians, administrators).
- Searching and Browsing Books: Users can search for books by title, author, genre, and other criteria, and browse all available books. Book information includes details like title, author, publication date, genre, and availability status.
- Book Transactions: Patrons can reserve available books, librarians can check out books to patrons, and accept returned books. The system tracks due dates for borrowed books and identifies overdue books.
- Patron Profiles: Patrons can view their own profile, including borrowing history and current or overdue loans. Librarians and administrators can view and edit patron profiles.
- Book and Author Management: Librarians and administrators can add, edit, or remove books and authors in the system. Administrators can manage librarian accounts.
- Reading Lists: Patrons can create and manage custom reading lists.
- Book Reviews and Ratings: Patrons can rate and review books, and view reviews and ratings by other patrons.
- Notifications: The system can send notifications to patrons about due dates, reserved books, or other important events.
- Book Recommendations: The system can provide personalized book recommendations to patrons based on their borrowing history or favorite genres.
This project follows the Onion Architecture with Domain-Driven Design (DDD) principles to build a scalable and maintainable software system. The Onion Architecture provides a layered architectural approach that promotes separation of concerns and allows for easy testing and evolution of the system.
The inner layer is the Domain Layer and the outer ones are the Infrastructure and WebApi layers. Code is always coupled towards the center which is the Domain Model and, since the Domain Model is the center, it can be only coupled to itself.
By adopting the Onion Architecture with DDD, this project aims to achieve a clear separation of concerns, maintainable codebase, and flexibility to adapt to changing business requirements. The layering structure ensures that each layer has well-defined responsibilities, making the system more modular, testable, and easier to maintain in the long run.
The project is organized into the following four layers:- Libro.Domain: This layer represents the core domain of the application and contains the domain models, Enums, and interfaces that define the behavior of the system. It encapsulates the essential business logic and is independent of any specific technology or framework.
- Libro.Application: The application layer implements the application services that orchestrate the domain entities. It coordinates the flow of data and actions within the system and enforces the business rules defined in the domain layer. This layer depends on domain layer.
- Libro.Infrastructure: It includes data access components,implementations for repositories, and other infrastructure-specific implementations. The infrastructure layer handles persistence and data retrieval and takes care of communicating with the external world.
- Libro.WebApi: Presentation Layer that is the entry point of the application and handles the communication with clients. It exposes the necessary endpoints for clients to interact with the system. This layer is responsible for handling HTTP requests, authentication, authorization, and input/output mapping.
- Programming Language: C#
- Framework: ASP.NET Core
- Database: SQL Server
- Authentication: JWT (JSON Web Tokens)
- ORM: Entity Framework Core
- API Documentation: Swagger and OpenAPI
- Validations: FluentValidation
- Unit Testing: xUnit, Moq, and in-memory database
- Clone the repository.
- Install the required dependencies.
- Configure the database connection.
- Run the database migrations.
- Start the application.
To access the API documentation, follow these steps:
- Start the Libro API application.
- Open your browser and navigate to the Swagger UI endpoint:
https://localhost:7283/swagger
. - You will see the Swagger UI interface with a list of available endpoints and detailed documentation for each endpoint.
Use the Swagger UI to explore the Libro API and test the different functionalities it offers.
In addition to the Swagger documentation, a Postman collection is also available for the Libro API. The Postman collection allows you to import a pre-configured set of API requests into Postman, making it easy to test and interact with the API. Import the collection into Postman to quickly access and execute the API requests.
Contributions to the Libro project are welcome! If you find any issues or have suggestions for improvements, please create a new issue in the project