{"id":28719829,"url":"https://github.com/ibrahimelfitiany/sufraapi","last_synced_at":"2026-05-19T07:06:17.232Z","repository":{"id":293314257,"uuid":"982420280","full_name":"IbrahimElFitiany/SufraAPI","owner":"IbrahimElFitiany","description":"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.","archived":false,"fork":false,"pushed_at":"2025-06-13T19:04:05.000Z","size":174,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-06-13T20:19:37.955Z","etag":null,"topics":["csharp","dotnet-core","layered-architecture","order-management","table-reservation"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IbrahimElFitiany.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-12T21:23:15.000Z","updated_at":"2025-06-13T19:04:09.000Z","dependencies_parsed_at":"2025-05-28T20:33:15.727Z","dependency_job_id":"0784ac18-f3bb-45ca-b70c-84a3ef109453","html_url":"https://github.com/IbrahimElFitiany/SufraAPI","commit_stats":null,"previous_names":["ibrahimelfitiany/sufra_mvc","ibrahimelfitiany/sufraapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IbrahimElFitiany/SufraAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IbrahimElFitiany%2FSufraAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IbrahimElFitiany%2FSufraAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IbrahimElFitiany%2FSufraAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IbrahimElFitiany%2FSufraAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IbrahimElFitiany","download_url":"https://codeload.github.com/IbrahimElFitiany/SufraAPI/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IbrahimElFitiany%2FSufraAPI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259929969,"owners_count":22933534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet-core","layered-architecture","order-management","table-reservation"],"created_at":"2025-06-15T06:05:44.707Z","updated_at":"2025-10-29T22:39:04.795Z","avatar_url":"https://github.com/IbrahimElFitiany.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍴 Sufrá - Modern Restaurant Management Platform\n![Sufra Logo](https://i.postimg.cc/Jh31vMZJ/sufra-copy.png)\n\nSufrá 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.\n\n---\n## 🚀 Live Demo (WIP)\n- 🌐 **Live Site**: [https://sufraa.vercel.app](https://sufraa.vercel.app)  \n\u003e ⚠️ The project is under active development. You may encounter unfinished features or test data. Continuous deployments are used to keep the demo updated.\n\n**Deployment Stack**:\n- Frontend: **Vercel**\n- Backend: **Dockerized on Railway**\n- Database: **Supabase** (PostgreSQL)\n\n## 🌟 Key Highlights\n\n- **Production-Grade Architecture**\n  - Layered design with clear separation of concerns, evolving toward Domain-Driven Design (DDD)\n  - Utilized aggregates and root aggregates to build rich domain models in key entities\n\n- **Performance Optimizations**\n  - Trigram-based fuzzy search using PostgreSQL similarity (`pg_trgm` extension)\n  - N+1 query prevention with strategic eager/lazy loading\n  - Pagination and filtering across all listings for scalable performance\n\n- **Email Integration**\n  - Automated email notifications for confirmations and rejections\n  - QR code generation for reservation confirmation\n\n- **Advanced Reservation Logic**\n  - Smart table allocation with \"max effort\" capacity management\n  - Fallback strategies for handling edge cases and overbookings\n\n---\n\n## 👥 User Role Matrix\n\n### 👑 Admin Capabilities\n\n- Secure authentication and access control\n- Full CRUD operations on restaurants, including approval and blocking\n- Advanced search with trigram-based fuzzy matching combined with multi-criteria filtering and paginated results\n- System-wide oversight of all reservations and orders with pagination and dynamic filtering\n\n### 🕴️ Restaurant Manager Features\n\n- Register your restaurant and login to your dashboard\n- Full CRUD for tables with labels and seating capacities\n- Define and update operating hours\n- Manage menu sections and menu items (CRUD)\n- Update order status through full lifecycle: Pending → Preparing → Ready → Delivered/Canceled\n- Approve or reject reservations with automated email notifications and QR code confirmations\n\n### 👥 Customer Experience\n\n- Secure registration and login\n- Discover approved restaurants with fuzzy search, filtering, and pagination\n- Browse restaurant menus organized by sections\n- Book tables with a smart reservation system and fallback handling\n- Cancel reservations when needed\n- Manage cart, place orders, cancel if unprepared, and track order status\n- Receive email confirmations with QR codes for reservations\n\n---\n\n## 🛠️ Technical Deep Dive\n\n### Backend Stack\n\n- **Framework:** .NET 9\n- **Database:** PostgreSQL (with `pg_trgm` extension)\n- **Authentication:** JWT with BCrypt password hashing\n- **Email:** SMTP integration with templated messages\n\n### Frontend Stack\n\n- **Framework:** React\n- **Styling:** Tailwind CSS\n\n### UI Design\n\n- Prototyped in Figma with complete UI designs  \n  [View Figma Designs](https://www.figma.com/design/KEogmNOd6C18xBlSZhmzUI/Sufr%C3%A1?node-id=0-1\u0026t=FbwQ7tHBZPepIqb3-1)\n\n---\n\n## 🏗 Architecture Pattern\n\n```mermaid\ngraph TD\n    A[Controller] --\u003e B[Application Service Layer]\n    B --\u003e C[Repository]\n    C --\u003e D[PostgreSQL]\n    B --\u003e E[Domain Models]\n    style E stroke:#ff6e96,stroke-width:2px\n```\n\n---\n\n## 🚀 Getting Started\n\n### 📦 Prerequisites\n\n- [.NET 9 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)\n- [PostgreSQL 15+](https://www.postgresql.org/download/)\n- [EF Core CLI](https://docs.microsoft.com/en-us/ef/core/cli/)\n\n### 🐳 Using Docker for PostgreSQL (Recommended)\n\nFor development, you can run PostgreSQL in a Docker container for consistency and easy setup:\n\n```bash\ndocker run --name sufra-postgres \\\n  -e POSTGRES_USER=postgres \\\n  -e POSTGRES_PASSWORD=password \\\n  -e POSTGRES_DB=sufra_v2 \\\n  -p 5432:5432 \\\n  -d postgres:latest\n```\n\n## Installation \u0026 Run\n\n```\n### Clone the repository\ngit clone https://github.com/IbrahimElFitiany/SufraAPI\ncd SufraAPI\n\n### Restore dependencies\ndotnet restore\n\n### Apply database migrations\ndotnet ef database update\n\n### Run the backend server\ndotnet run\n```\n## 📬 API Postman Collection\n\n- Import the Postman collection to explore and test all available API endpoints:  \n  [Download Postman Collection](./Sufra.postman_collection.json)\n\n## 🌐 Frontend Repository\n\n- The frontend is maintained separately and still under active development:\n\n- 👉 [Sufrá Frontend Repository](https://github.com/IbrahimElFitiany/Sufra_FrontEnd)\n\n## ⚙️ Planned Improvements\n\n- **Optimize Entity Framework Queries**  \n  Replace `.Include()` calls with `.Select()` projections where only specific fields are needed  \n  (e.g., `Cuisine.Name`, `District.Name`, `Gov.Name`) to reduce unnecessary data loading and improve performance.\n\n- **Implement Transactional Consistency (Unit of Work)**  \n  Currently, creating a `Manager` and their associated `Restaurant` occurs in separate steps.  \n  If the restaurant creation fails, it may leave orphaned manager records.  \n  I plan to refactor this flow using the Unit of Work pattern to wrap related operations in a single transaction,  \n  ensuring data consistency and atomicity.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrahimelfitiany%2Fsufraapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibrahimelfitiany%2Fsufraapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrahimelfitiany%2Fsufraapi/lists"}