This project is a Contacts Manager System built using C#.NET and ASP.NET Core. The system allows users to manage contacts with advanced features like authentication, authorization, logging, advanced unit testing, and CRUD operations.
Features
- CRUD Operations: Create, Read, Update, and Delete contacts.
- User Authentication & Authorization: Secure user sign-in and role-based authorization using Identity.
- Web API: Exposes API endpoints to manage contacts using Entity Framework Core and MVC architecture.
- Unit Testing: Advanced unit testing using xUnit, Moq, and Repository Pattern.
- Logging & Error Handling: Integration of Serilog for centralized logging and advanced error handling.
- Filters: Custom filters for handling requests and errors efficiently.
- SOLID Principles: Followed SOLID principles to ensure clean, maintainable, and scalable code.
- CLEAN Architecture: Separation of concerns through a layered architecture to enhance the maintainability and scalability of the system.
Technologies Used
- ASP.NET Core (for backend API and MVC)
- C# (Primary programming language)
- Entity Framework Core (ORM for database interactions)
- xUnit (for unit testing)
- Moq (for mocking dependencies in tests)
- Serilog (for logging)
- Identity (for user authentication and authorization)
- JWT Authentication (for securing Web API endpoints)
- SOLID Principles (for software design)
- CLEAN Architecture (for project structure)
Prerequisites Before running this application, make sure you have the following installed:
.NET 6.0 or higher Visual Studio or Visual Studio Code SQL Server (or any other relational database for Entity Framework Core)
Usage Sign In: Users can register and log in using JWT-based authentication. Use Postman or any HTTP client to interact with the Web API. Contact Management: The application allows CRUD operations to manage contacts: Create: Add new contacts. Read: View existing contacts. Update: Modify contact information. Delete: Remove a contact.
Architecture This project follows the CLEAN Architecture pattern:
Core: Contains the business logic, models, and interfaces. Application: Implements business logic, including services and use cases. Infrastructure: Handles data access, third-party services (e.g., logging), and external API calls. Web API: Contains the web layer (controllers, API routes). Security The system utilizes JWT (JSON Web Tokens) for user authentication and authorization. Users must authenticate before performing CRUD operations.
Identity is used for managing users, passwords, roles, and permissions. Authorization: Only authenticated users can access protected resources. Roles: Admin users can perform all actions, while regular users can only manage their own contacts. Logging & Error Handling Serilog is used for structured logging, making it easier to monitor the system. The system includes comprehensive error handling using filters and custom exception handling middleware.
Thanks
A special thanks to Harsha Vardhan for the amazing teaching on Udemy. His lessons were instrumental in the development of this system.