This project is a Boat and Trip Booking System developed. It is built using .NET 9 and follows Clean Architecture, CQRS, and modern backend best practices.
The system supports three user roles:
- Admin – manages users, boats, and reservations.
- Owner – registers boats, creates trips, and manages services.
- Customer – browses boats/trips and makes reservations.
- .NET 9
- ASP.NET Core Web API
- Entity Framework Core
- SQL Server
- MediatR (CQRS)
- JWT Authentication
- Serilog Logging
- Swagger (OpenAPI)
The project follows Clean Architecture with four main layers:
BoatBookingSystem
│
├── API
│ └── Controllers, Middleware, JWT, Swagger
│
├── Application
│ └── CQRS, DTOs, Interfaces, Validators, Behaviors
│
├── Infrastructure
│ └── EF Core, Repositories, Database, Logging
│
└── Domain
└── Entities, Enums, Core Business Models
- CQRS using MediatR
- Repository Pattern
- Dependency Injection
- Global Exception Handling
- Validation Pipeline
- Approve or reject user registrations
- Approve or reject boats
- View all reservations
- Register and await approval
- Add boats (pending admin approval)
- Create and manage trips
- Add additional services
- View reservations
- Register and browse trips/boats
- Book trips with additional services
- Book boats
- Cancel reservations within allowed period
-
JWT-based authentication
-
Role-based authorization:
AdminOwnerCustomer
All protected endpoints require a valid JWT token.
- SQL Server
- Entity Framework Core
- Code-first approach using migrations
Main entities:
- ApplicationUser
- Boat
- Trip
- Reservation
- AdditionalService
- ReservationService
git clone <repository-url>
cd BoatBookingSystemOpen:
BoatBookingSystem.API/appsettings.json
Update the connection string if needed:
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=BoatBookingDb;Trusted_Connection=True;TrustServerCertificate=True"
}Open Package Manager Console:
- Set default project to:
BoatBookingSystem.Infrastructure
Run:
Update-DatabaseSet startup project:
BoatBookingSystem.API
Press:
F5 or Ctrl + F5
Navigate to:
https://localhost:<port>/swagger
The system seeds a default admin user:
Email: lotfy@gmail.com
Password: lotfy
Role: Admin
Use this account to:
- Approve owners
- Approve boats
- Manage reservations
- Login using
/api/auth/login - Copy the returned JWT token
- Click Authorize in Swagger
- Paste the token
- Call protected endpoints
The system uses Serilog:
- Logs to console
- Logs to daily rolling files:
Logs/log-<date>.txt
- Automatically triggered via MediatR pipeline
- Returns structured validation errors
-
Global exception middleware
-
Handles:
- Server errors
- Validation errors
-
Returns consistent JSON responses
BoatBookingSystem.API
BoatBookingSystem.Application
BoatBookingSystem.Infrastructure
BoatBookingSystem.Domain
POST /api/auth/register
Role: Owner
POST /api/admin/approve-user/{Id}
POST /api/owner/boats
POST /api/customer/book-trip
- All write operations use CQRS commands
- All read operations use CQRS queries
Lotfy Abdalla Mosalam Full Stack Developer (.NET & Angular)
Swagger UI demonstrating API endpoints and authentication flow.
Entity-Relationship diagram of the Boat & Trip Booking System database.