The Shipping Management System is a robust and scalable solution designed to streamline shipping operations. It provides features for managing orders, users, and reporting, with a focus on security, performance, and modularity. Built on .NET 9.0, it leverages modern development practices and tools.
- Order Management:
- Create, update, and track orders with detailed information.
- Support for filtering, sorting, and pagination.
- User Management:
- Role-based access control (Admin, Employee, Merchant, Delivery Agent).
- User registration and authentication with JWT.
- Authentication & Authorization:
- Secure JWT-based authentication.
- Role and permission-based authorization.
- Error Handling:
- Centralized exception handling with custom error responses.
- API Documentation:
- Integrated Swagger for API testing and documentation.
- Database Management:
- Entity Framework Core with SQL Server for database operations.
- Dependency Injection:
- Modular and testable architecture with built-in .NET DI.
The solution is organized into multiple projects for better separation of concerns:
-
Shipping.Core:
- Contains domain models, enums, and shared logic.
- Implements specifications for querying data.
-
Shipping.Repository:
- Handles database operations using Entity Framework Core.
- Implements generic repository and unit of work patterns.
-
Shipping.Service:
- Contains business logic and service layer.
- Implements services for orders, users, and reporting.
-
Shipping.DTOs:
- Defines data transfer objects (DTOs) for API communication.
-
Shipping_BackEnd:
- API layer for exposing endpoints and handling requests.
- Includes middleware for error handling and authentication.
- .NET 9.0 SDK
- SQL Server
- Visual Studio 2022 or later
- Postman (optional, for API testing)
git clone <repository-url> cd Shipping_Management_System
Update the appsettings.json
file in the Shipping_BackEnd
project with your database connection string:
"ConnectionStrings": { "DefaultConnection": "Server=<server>;Database=ShippingDB;Trusted_Connection=True;" }
Run the following command to apply migrations and create the database:
dotnet ef database update --project Shipping.Repository
The application seeds initial roles and an admin user during startup. Ensure the database is properly configured before running the application.
Start the application using the following command:
dotnet run --project Shipping_BackEnd
- Swagger UI: https://localhost:/swagger
- Example Endpoints:
- Orders:
/api/orders
- Users:
/api/users
- Authentication:
/api/auth
- Orders:
- GET
/api/orders
: Retrieve all orders with optional filters. - POST
/api/orders
: Create a new order. - PUT
/api/orders/{id}
: Update an existing order. - DELETE
/api/orders/{id}
: Delete an order.
- POST
/api/auth/register
: Register a new user. - POST
/api/auth/login
: Authenticate and retrieve a JWT token.
- GET
/api/buggy/notfound
: Simulate a 404 error. - GET
/api/buggy/servererror
: Simulate a 500 error.
- Framework: .NET 9.0
- Database: SQL Server
- Authentication: JWT
- API Documentation: Swagger
- ORM: Entity Framework Core
- Dependency Injection: Built-in .NET DI
- Logging: Integrated logging with
ILogger
.
- Custom middleware (
ExceptionHandlerMiddleware
) is used for centralized error handling. - Provides detailed error responses in development and generic responses in production.
- Initial roles and an admin user are seeded during application startup.
- Modify the
IdentitySeedData
class to customize seeding logic.
- Used for mapping between domain models and DTOs.
- Configured in the
MappingProfiles
class.
- Implements the Specification pattern for flexible and reusable query logic.
- Example:
OrderSpecifications
for filtering and sorting orders.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a detailed description of your changes.
For any questions or support, please contact the project maintainer.