A Flutter-based hotel reservation mobile application with role-based access control (Customer, Owner, Admin), local data persistence using Hive, and GetX for state management.
- ✅ Browse available hotel rooms
- ✅ View detailed room information (price, amenities, availability)
- ✅ Book rooms with calendar date selection
- ✅ View booking history
- ✅ Cancel bookings
- ✅ Date validation (no past dates, checkout after checkin)
- ✅ Real-time availability calculation
- ✅ Dashboard with statistics
- ✅ Full CRUD operations for rooms
- ✅ View all users
- ✅ View and cancel all bookings
- ✅ Manage room pricing and features
- ✅ System overview dashboard
- ✅ View all rooms, users, and bookings
- ✅ Cancel bookings
- ✅ Full system access
The app follows Clean Architecture principles with the Repository Pattern:
lib/
├── data/
│ ├── models/ # Data models with Hive adapters
│ ├── repositories/ # Abstract repository interfaces
│ └── local_db/ # Hive service and local implementations
├── domain/
│ └── services/ # Business logic services
├── presentation/
│ ├── controllers/ # GetX controllers
│ ├── screens/ # UI screens
│ └── widgets/ # Reusable widgets
├── routes/ # Navigation routes
└── utils/ # Helper functions and constants
- Repository Pattern: Abstract data layer for easy backend integration
- Dependency Injection: GetX for managing dependencies
- State Management: GetX reactive state management
- Navigation: GetX routing
dependencies:
get: ^4.6.6 # State management & navigation
hive: ^2.2.3 # Local database
hive_flutter: ^1.1.0 # Hive Flutter integration
intl: ^0.18.1 # Date formatting
table_calendar: ^3.0.9 # Calendar widget
uuid: ^4.0.0 # UUID generation
dev_dependencies:
hive_generator: ^2.0.1 # Hive code generation
build_runner: ^2.4.6 # Build tools- Flutter SDK (3.0+)
- Dart SDK (3.0+)
-
Clone the repository
cd hotel-revervation -
Install dependencies
flutter pub get
-
Generate Hive adapters (if needed)
dart run build_runner build --delete-conflicting-outputs
-
Run the app
flutter run
On first launch, the app will:
- Initialize Hive database
- Seed dummy data:
- 3 users (one per role)
- 5 hotel rooms
- 2 sample bookings
Select your role from the login screen:
- Customer: Browse and book rooms
- Owner: Manage rooms, users, and bookings
- Admin: Full system access
The app seeds these users:
- Customer: John Doe (john@customer.com)
- Owner: Sarah Smith (sarah@owner.com)
- Admin: Admin User (admin@hotel.com)
- Login as Customer
- Browse rooms list
- Tap on a room to view details
- Click "Book Now"
- Select check-in and check-out dates
- Review booking summary
- Confirm booking
- View "My Bookings" to see all bookings
- Cancel booking if needed
- Login as Owner
- View dashboard with statistics
- Manage Rooms:
- Add new rooms
- Edit existing rooms
- Delete rooms
- View all users
- View and cancel bookings
- Login as Admin
- View system dashboard
- Access all rooms, users, and bookings
- Cancel bookings as needed
{
id: String,
name: String,
email: String,
role: String // 'customer', 'owner', 'admin'
}{
id: String,
name: String,
type: String,
price: double,
totalRooms: int,
features: List<String>,
images: List<String>,
description: String
}{
id: String,
userId: String,
roomId: String,
checkIn: DateTime,
checkOut: DateTime,
nights: int,
totalPrice: double,
status: String // 'confirmed', 'cancelled'
}The app is designed for easy backend integration. See BACKEND_INTEGRATION.md for detailed instructions.
Quick Summary:
- Create API service class
- Implement API repository classes (ApiUserRepository, ApiRoomRepository, ApiBookingRepository)
- Replace local repositories in
main.dart - No changes needed to UI, controllers, or business logic!
Run Flutter analyzer:
flutter analyzeRun tests (when added):
flutter testhotel-revervation/
├── lib/
│ ├── data/
│ │ ├── models/
│ │ │ ├── user_model.dart
│ │ │ ├── room_model.dart
│ │ │ └── booking_model.dart
│ │ ├── repositories/
│ │ │ ├── user_repository.dart
│ │ │ ├── room_repository.dart
│ │ │ ├── booking_repository.dart
│ │ │ ├── local_user_repository.dart
│ │ │ ├── local_room_repository.dart
│ │ │ └── local_booking_repository.dart
│ │ └── local_db/
│ │ └── hive_service.dart
│ ├── domain/
│ │ └── services/
│ │ ├── availability_service.dart
│ │ └── booking_service.dart
│ ├── presentation/
│ │ ├── controllers/
│ │ │ ├── auth_controller.dart
│ │ │ ├── room_controller.dart
│ │ │ ├── booking_controller.dart
│ │ │ └── user_controller.dart
│ │ ├── screens/
│ │ │ ├── splash_screen.dart
│ │ │ ├── auth/
│ │ │ ├── customer/
│ │ │ ├── owner/
│ │ │ └── admin/
│ │ └── widgets/
│ │ ├── room_card.dart
│ │ └── booking_card.dart
│ ├── routes/
│ │ ├── app_routes.dart
│ │ └── app_pages.dart
│ ├── utils/
│ │ ├── constants.dart
│ │ └── date_helper.dart
│ └── main.dart
├── BACKEND_INTEGRATION.md
├── README.md
└── pubspec.yaml
- Material Design 3
- Responsive layouts
- Bottom navigation for customers
- Role-specific color schemes:
- Customer: Green
- Owner: Orange
- Admin: Red
- Loading states
- Error handling
- Empty states
- Confirmation dialogs
For MVP:
- No password authentication (role selection only)
- No encryption
- Local storage only
For Production:
- Implement proper authentication (JWT, OAuth)
- Add password hashing
- Use HTTPS for API calls
- Implement role-based access control on backend
- Add data encryption
- User registration and authentication
- Payment integration
- Email notifications
- Search and filter rooms
- Room reviews and ratings
- Multi-language support
- Dark mode
- Push notifications
- Analytics dashboard
- Export bookings to PDF
This is an MVP project. For production use:
- Add proper authentication
- Integrate with backend API
- Add comprehensive tests
- Implement error handling
- Add logging and analytics
This project is for educational/demonstration purposes.
Built with Flutter, GetX, and Hive.
Note: This is an MVP (Minimum Viable Product) with local storage. See BACKEND_INTEGRATION.md for instructions on connecting to a real backend.