Skip to content

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.

License

Notifications You must be signed in to change notification settings

IbrahimElFitiany/SufraAPI

Repository files navigation

🍴 Sufrá - Modern Restaurant Management Platform

Sufra Logo

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)

⚠️ 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


🏗 Architecture Pattern

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
Loading

🚀 Getting Started

📦 Prerequisites

🐳 Using Docker for PostgreSQL (Recommended)

For development, you can run PostgreSQL in a Docker container for consistency and easy setup:

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

🌐 Frontend Repository

⚙️ 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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •