Hotel booking app built with ASP.NET Core (backend) and React + TypeScript (frontend). Uses an in-memory database for quick testing and Docker for easy deployment.
Architecture
- Backend: ASP.NET Core (C#) — project located at
backend/HotelBookingApi - Frontend: React + TypeScript — project located at
frontend/hotel-booking-app
Prerequisites
- .NET 8 SDK (for local backend run)
- Node.js (18+) and npm or yarn (for frontend)
- Docker & Docker Compose (for containerized run)
Run locally (development)
- Backend (run from PowerShell):
cd backend/HotelBookingApi dotnet restore dotnet runThe backend listens on port 7263 by default in this repository.
- Frontend (run from PowerShell):
cd frontend/hotel-booking-app npm install npm startThe frontend dev server runs on port 3000 and expects the API at http://localhost:7263 (the app uses REACT_APP_API_URL environment variable).
Run with Docker Compose
From repository root:
docker-compose up --buildThis will start two services:
- Frontend on host port
3000→ container3000 - Backend on host port
7263→ container7263
Inside Docker the frontend communicates with the backend at http://backend:7263 (configured in docker-compose.yml).
API overview Common endpoints (see backend/Controllers):
GET /api/countriesGET /api/citiesGET /api/hotelsGET /api/roomsGET/POST /api/bookings
Explore the controllers in backend/Controllers for full details and request/response DTOs in backend/DTOs.
Database / Seed data The project uses an in-memory database for quick testing and includes seeding logic in backend/Data/SeedData.cs. When the backend starts in development, sample data is automatically created.
Common tasks
- Build backend:
dotnet build(run insidebackend/HotelBookingApi) - Run frontend build:
npm run build(insidefrontend/hotel-booking-app) - Rebuild Docker images:
docker-compose build --no-cache
Troubleshooting
- If ports are in use, stop conflicting services or change ports in
docker-compose.ymlandProgram.cs. - If frontend cannot reach API when running outside Docker, ensure
REACT_APP_API_URLpoints tohttp://localhost:7263.
Contributing Feel free to open issues or add PRs. Keep changes focused and include steps to reproduce when reporting bugs.
If you'd like, I can add example requests for each endpoint, or a quick Postman collection — tell me which you'd prefer.