https://github.com/ibrahimelfitiany/sufraapi
Sufra is a .NET-based web application for restaurant table reservation and food order management, built with layered architecture. Customers can reserve tables, place and cancel orders before they're cooked. Restaurant managers manage menus, handle order statuses, and approve or reject reservations. Admins approve restaurant registrations.
https://github.com/ibrahimelfitiany/sufraapi
csharp dotnet-core layered-architecture order-management table-reservation
Last synced: about 2 months ago
JSON representation
Sufra is a .NET-based web application for restaurant table reservation and food order management, built with layered architecture. Customers can reserve tables, place and cancel orders before they're cooked. Restaurant managers manage menus, handle order statuses, and approve or reject reservations. Admins approve restaurant registrations.
- Host: GitHub
- URL: https://github.com/ibrahimelfitiany/sufraapi
- Owner: IbrahimElFitiany
- License: agpl-3.0
- Created: 2025-05-12T21:23:15.000Z (about 1 year ago)
- Default Branch: dev
- Last Pushed: 2025-06-13T19:04:05.000Z (about 1 year ago)
- Last Synced: 2025-06-13T20:19:37.955Z (about 1 year ago)
- Topics: csharp, dotnet-core, layered-architecture, order-management, table-reservation
- Language: C#
- Homepage:
- Size: 170 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ด Sufrรก - Modern Restaurant Management Platform

Sufrรก is a comprehensive restaurant reservation and food ordering system designed with scalability and domain-driven principles in mind. The platform serves three distinct user roles with robust features, implemented using modern architectural patterns and performance-optimized database operations.
---
## ๐ Live Demo (WIP)
- ๐ **Live Site**: [https://sufraa.vercel.app](https://sufraa.vercel.app)
> โ ๏ธ The project is under active development. You may encounter unfinished features or test data. Continuous deployments are used to keep the demo updated.
**Deployment Stack**:
- Frontend: **Vercel**
- Backend: **Dockerized on Railway**
- Database: **Supabase** (PostgreSQL)
## ๐ Key Highlights
- **Production-Grade Architecture**
- Layered design with clear separation of concerns, evolving toward Domain-Driven Design (DDD)
- Utilized aggregates and root aggregates to build rich domain models in key entities
- **Performance Optimizations**
- Trigram-based fuzzy search using PostgreSQL similarity (`pg_trgm` extension)
- N+1 query prevention with strategic eager/lazy loading
- Pagination and filtering across all listings for scalable performance
- **Email Integration**
- Automated email notifications for confirmations and rejections
- QR code generation for reservation confirmation
- **Advanced Reservation Logic**
- Smart table allocation with "max effort" capacity management
- Fallback strategies for handling edge cases and overbookings
---
## ๐ฅ User Role Matrix
### ๐ Admin Capabilities
- Secure authentication and access control
- Full CRUD operations on restaurants, including approval and blocking
- Advanced search with trigram-based fuzzy matching combined with multi-criteria filtering and paginated results
- System-wide oversight of all reservations and orders with pagination and dynamic filtering
### ๐ด๏ธ Restaurant Manager Features
- Register your restaurant and login to your dashboard
- Full CRUD for tables with labels and seating capacities
- Define and update operating hours
- Manage menu sections and menu items (CRUD)
- Update order status through full lifecycle: Pending โ Preparing โ Ready โ Delivered/Canceled
- Approve or reject reservations with automated email notifications and QR code confirmations
### ๐ฅ Customer Experience
- Secure registration and login
- Discover approved restaurants with fuzzy search, filtering, and pagination
- Browse restaurant menus organized by sections
- Book tables with a smart reservation system and fallback handling
- Cancel reservations when needed
- Manage cart, place orders, cancel if unprepared, and track order status
- Receive email confirmations with QR codes for reservations
---
## ๐ ๏ธ Technical Deep Dive
### Backend Stack
- **Framework:** .NET 9
- **Database:** PostgreSQL (with `pg_trgm` extension)
- **Authentication:** JWT with BCrypt password hashing
- **Email:** SMTP integration with templated messages
### Frontend Stack
- **Framework:** React
- **Styling:** Tailwind CSS
### UI Design
- Prototyped in Figma with complete UI designs
[View Figma Designs](https://www.figma.com/design/KEogmNOd6C18xBlSZhmzUI/Sufr%C3%A1?node-id=0-1&t=FbwQ7tHBZPepIqb3-1)
---
## ๐ Architecture Pattern
```mermaid
graph TD
A[Controller] --> B[Application Service Layer]
B --> C[Repository]
C --> D[PostgreSQL]
B --> E[Domain Models]
style E stroke:#ff6e96,stroke-width:2px
```
---
## ๐ Getting Started
### ๐ฆ Prerequisites
- [.NET 9 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
- [PostgreSQL 15+](https://www.postgresql.org/download/)
- [EF Core CLI](https://docs.microsoft.com/en-us/ef/core/cli/)
### ๐ณ Using Docker for PostgreSQL (Recommended)
For development, you can run PostgreSQL in a Docker container for consistency and easy setup:
```bash
docker run --name sufra-postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=sufra_v2 \
-p 5432:5432 \
-d postgres:latest
```
## Installation & Run
```
### Clone the repository
git clone https://github.com/IbrahimElFitiany/SufraAPI
cd SufraAPI
### Restore dependencies
dotnet restore
### Apply database migrations
dotnet ef database update
### Run the backend server
dotnet run
```
## ๐ฌ API Postman Collection
- Import the Postman collection to explore and test all available API endpoints:
[Download Postman Collection](./Sufra.postman_collection.json)
## ๐ Frontend Repository
- The frontend is maintained separately and still under active development:
- ๐ [Sufrรก Frontend Repository](https://github.com/IbrahimElFitiany/Sufra_FrontEnd)
## โ๏ธ Planned Improvements
- **Optimize Entity Framework Queries**
Replace `.Include()` calls with `.Select()` projections where only specific fields are needed
(e.g., `Cuisine.Name`, `District.Name`, `Gov.Name`) to reduce unnecessary data loading and improve performance.
- **Implement Transactional Consistency (Unit of Work)**
Currently, creating a `Manager` and their associated `Restaurant` occurs in separate steps.
If the restaurant creation fails, it may leave orphaned manager records.
I plan to refactor this flow using the Unit of Work pattern to wrap related operations in a single transaction,
ensuring data consistency and atomicity.