A comprehensive backend API for a restaurant management system, serving a WinUI client application.
- Milestone 1 Report: https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/
- Milestone 2 Report: https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/HkhqJdrz1g
- Milestone 3 Report: https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/SywYnZt81l
BistroQ API is a RESTful backend service designed to handle all operations for a modern restaurant management system. It provides endpoints for order management, product catalog, user authentication, and more. This project was developed as part of the CSC13001 Windows Development course at HCMUS.
- JWT-based authentication with access and refresh tokens
- Role-based access control (Admin, Kitchen, Cashier, Client)
- User account management
- Zone & Table Management: Create and manage dining zones and tables
- Product Catalog: Manage menu items with nutritional information
- Category Management: Organize products into categories
- Order Processing: Handle order creation, updates, and status tracking
- Client Orders: Customers can create orders, add/remove items
- Kitchen Management: Kitchen staff can view and update order item status
- Cashier Operations: Process payments and handle checkouts
- Real-time Updates: SignalR hubs for real-time notifications
- Nutritional Analysis: Track nutritional information of ordered items
- Product Recommendations: AI-based recommendations based on nutritional balance
- Image Management: Upload and serve product images via AWS S3/CloudFront
BistroQ API implements Clean Architecture principles to create a maintainable, testable, and scalable system with clear separation of concerns:
- Contains business entities, domain logic, and interfaces
- Defines the core business rules and entities
- Includes DTOs, interfaces, exceptions, and domain models
- Has no dependencies on other layers or external frameworks
- Defines contracts that outer layers must implement
- Contains business logic and use cases
- Implements service interfaces defined in the Core layer
- Orchestrates the flow of data between entities
- Contains validation, business rules, and transaction management
- Depends only on the Core layer (domain interfaces)
- Provides implementations for interfaces defined in the Core layer
- Contains database access (Entity Framework Core), external services
- Implements repositories, data access, and persistence logic
- Contains AWS S3 integration for image storage
- Implements the Unit of Work pattern for transaction management
- Contains controllers, middleware, and API endpoints
- Handles HTTP requests and responses
- Configures dependency injection and routes
- Maps external requests to internal commands/queries
- Forms the entry point to the application
- Dependencies flow inward, with the Core layer having no external dependencies
- Outer layers depend on inner layers through interfaces
- Dependency Injection is used to implement Inversion of Control
- All layers communicate via defined interfaces, ensuring loose coupling
- BistroQ.API: API endpoints, controllers, middleware, and configurations
- BistroQ.Core: Domain entities, DTOs, interfaces, and exceptions
- BistroQ.Infrastructure: Database context, repositories, and data access
- BistroQ.Services: Business logic, services implementation
- BistroQ.Tests: Unit tests for controllers and services
- Repository Pattern: Abstracts data access logic
- Unit of Work: Manages transactions and data persistence
- Dependency Injection: For loose coupling and testability
- Builder Pattern: For constructing complex queries
- Specification Pattern: For encapsulating query logic
- Framework: ASP.NET Core 8.0
- Database: MySQL with Entity Framework Core
- Authentication: JWT with Identity
- Real-time Communication: SignalR
- Cloud Services: AWS S3 for storage, CloudFront for CDN
- Testing: MSTest
- .NET 8.0 SDK
- MySQL Server
- AWS Account (for image storage)
- Git
-
Clone the repository
git clone https://github.com/your-username/bistro-q-api.git cd bistro-q-api -
Configure environment variables Copy the
.env.samplefile to.envand update the values:cp BistroQ.API/.env.sample .env
The following environment variables need to be configured:
- Database connection string
- JWT settings
- AWS credentials (for image storage)
- Payment gateway credentials
-
Apply database migrations
dotnet ef database update --project BistroQ.Infrastructure --startup-project BistroQ.API --context BistroQ.Infrastructure.Data.BistroQContext
-
Run the application
cd BistroQ.API dotnet run -
Access the API documentation Navigate to
https://localhost:7034/swaggerin your browser to view the API documentation.
The API is structured around the following main controllers:
POST /api/Auth/login: Login with username and passwordPOST /api/Auth/refresh: Refresh access token
GET /api/Client/Order: View current orderPOST /api/Client/Order: Create a new orderPATCH /api/Client/Order/PeopleCount: Update people countPOST /api/Client/Order/Items: Add items to orderDELETE /api/Client/Order/Items: Remove items from order
GET /api/Kitchen/Order: View pending ordersPATCH /api/Kitchen/Order/Status: Update order item status
GET /api/Cashier/Order: View all current ordersGET /api/Cashier/Order/{tableId}: Get order by tablePATCH /api/Cashier/Order/Status: Update order statusGET /api/Cashier/Zones: Get zones with checkout status
GET /api/Admin/Category: Manage product categoriesGET /api/Admin/Product: Manage menu itemsGET /api/Admin/Zone: Manage dining zonesGET /api/Admin/Table: Manage tablesGET /api/Admin/Account: User account management
The system uses a combination of RESTful APIs and SignalR hubs to maintain real-time data synchronization between clients:
CheckoutHub: Real-time notifications for checkout operations
The system tracks nutritional information (calories, protein, fat, fiber, carbohydrates) for all menu items and calculates the total nutritional content of orders.
The API includes a recommendation engine that analyzes the nutritional content of a customer's current order and suggests complementary items to achieve a balanced meal.
Run the test suite with:
dotnet testThis project is part of an academic course and may be subject to specific licensing requirements of HCMUS.
- CSC13001 course instructors and teaching assistants
- Entity Framework Core
- ASP.NET Core
- AWS SDK for .NET
Developed as a project for CSC13001 Windows Development course at HCMUS.