Skip to content

o-cherpak/Cafe

Repository files navigation

Cafe API Documentation

Fully functional REST API cafe ordering system with a customer kiosk flow, staff management panel, a bonus points economy, and a promotion system with two discount types. The API is live, documented, and ready to be extended with a React frontend. This project was built as a learning exercise while studying .NET backend development. The goal was to go beyond simple CRUD and build something that resembles a real-world system - with proper layering, authentication, business logic, and deployment. Over the course of the project I learned and applied: clean architecture with Repository and Unit of Work patterns, Entity Framework Core with Code First migrations and Fluent API configuration, JWT authentication with role-based authorization, Docker and Docker Compose for containerization, automated testing with xUnit covering both unit and integration scenarios, and deploying a containerized .NET application with PostgreSQL to a cloud platform.

📸 Screenshots

Customer Create
customer_create
Login
login
Get Orders
order_get
Tests
tests

🌐 API Endpoints

🔐 Auth

Method Endpoint Access Description
POST /api/auth/register Public Register a new user
POST /api/auth/login Public Login and receive JWT token

☕ Menu

Method Endpoint Access Description
GET /api/menuitem Public Get all items (filter by ?category=)
GET /api/menuitem/{id} Public Get item by ID
POST /api/menuitem Admin Create menu item
PUT /api/menuitem/{id} Admin Update menu item
DELETE /api/menuitem/{id} Admin Delete menu item

👥 Customers

Method Endpoint Access Description
GET /api/customer Admin, Barista Get all customers
GET /api/customer/{id} Admin, Barista, Customer Get customer by ID
GET /api/customer/by-email Admin, Barista, Customer Get customer by email
POST /api/customer Admin, Barista Create customer
PUT /api/customer/{id} Admin, Barista, Customer Update customer
DELETE /api/customer/{id} Admin Delete customer

📦 Orders

Method Endpoint Access Description
GET /api/order Admin, Barista Get all orders (filter by ?customerId=, ?status=)
GET /api/order/{id} Admin, Barista, Customer Get order by ID
GET /api/order/by-customer Admin, Barista, Customer Get orders by customer ID (filter by ?customerId=)
POST /api/order Admin, Barista, Customer Create order
PUT /api/order/{id} Admin, Barista Update order status

🏷️ Promotions

Method Endpoint Access Description
GET /api/promotion Public Get all promotions
GET /api/promotion/active Public Get active promotions
GET /api/promotion/{id} Public Get promotion by ID
POST /api/promotion Admin Create promotion
PUT /api/promotion/{id} Admin Update promotion

🎁 Customer Promotions

Method Endpoint Access Description
GET /api/customerpromotion Admin, Barista Get all customer promotions
GET /api/customerpromotion/{id} Admin, Barista, Customer Get by ID
GET /api/customerpromotion/by-customer Admin, Barista, Customer Get by customer ID (filter by ?customerId=)
GET /api/customerpromotion/by-customer-promotion Admin, Barista, Customer Get by customer and promotion ID (filter by ?customerId=, ?promotionId=)
GET /api/customerpromotion/by-order Admin, Barista, Customer Get by order ID (filter by ?orderId=)
POST /api/customerpromotion Admin, Barista, Customer Buy a promotion with bonus points
DELETE /api/customerpromotion/{id} Admin Delete customer promotion

🚀 Running Locally

Prerequisites

  • .NET 10 SDK
  • Docker Desktop or Postgres SQL

With Docker Compose

  1. Clone the repository:
    git clone https://github.com/o-cherpak/Cafe.git
    cd Cafe
  2. Create a .env file in the root directory
     DB_USER=your_db_user
     DB_PASSWORD=your_db_password
     JWT_SECRET=your_minimum_32_characters_long_secret
  3. Run Docker Compose
    docker compose up --build
    

🚀 Try online in scalar

Scalar Docs: https://cafe-api-c5dw.onrender.com/scalar/v1

You can try without any auth token:

GET | /api/menuitem | Public | Get all items

About

REST API cafe ordering system. This project was built as a learning exercise while studying .NET backend development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors