A full‑stack .NET + Angular implementation of a bus ticket reservation system built with Clean Architecture and DDD.
- Search buses by From, To, Journey Date
- See available seats with live status (Available / Booked / Sold)
- Book seats with passenger details
- EF Core (PostgreSQL) with migrations
- Unit tests for search and booking logic
BusBook/
├─ src/
│ ├─ Domain/ # Entities, Value Objects, Domain Services
│ ├─ Application/ # Use cases, business logic
│ ├─ Application.Contracts/ # DTOs, Interfaces
│ ├─ Infrastructure/ # EF Core, DbContext, Repositories
│ ├─ WebApi/ # ASP.NET Core REST API
│ └─ client/ # Angular app (UI)
├─ tests/ # Unit test projects
└─ BusBook.sln # Solution
- .NET 9 SDK
- Node.js 18+ & npm
- Angular CLI (
npm i -g @angular/cli) - PostgreSQL 14+
git clone https://github.com/Belal-uddin/Bus-Ticket-Reservation-System.git
cd BusBook
# Restore .NET deps
dotnet restore
# Install Angular deps
cd src/client
npm install
cd ../..Create a PostgreSQL database (e.g., busbook_db). Then set the connection string in src/WebApi/appsettings.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=busbook_db;Username=postgres;Password=postgres"
}
}# From repository root
dotnet tool update --global dotnet-ef
# Ensure Infrastructure is the migrations assembly and WebApi is startup
dotnet ef database update -p src/Infrastructure -s src/WebApicd src/WebApi
dotnet run
# API runs on https://localhost:5001 (or shown port)cd src/client
# Set the API base URL in src/environments/environment.ts
# Example:
# export const environment = { apiUrl: 'https://localhost:5001' };
ng serve --open# From repository root
dotnet test- Domain – Entities like
BusCompany,Bus,Route,BusSchedule,Seat,Ticket, etc. - Application – Use cases like
SearchServiceandBookingService. - Application.Contracts – DTOs:
AvailableBusDto,SeatPlanDto,BookSeatInputDto, etc. - Infrastructure –
AppDbContext, repositories, PostgreSQL provider, migrations. - WebApi – Controllers:
/api/search,/api/booking. - client – Angular components for search, seat plan, and booking.
GET /api/search?from=Dhaka&to=Chittagong&date=2025-10-28GET /api/booking/seat-plan/{busScheduleId}POST /api/booking/bookwithBookSeatInputDto



