Skip to content

cewko/coffee-shop-api

Repository files navigation

Coffee Shop Management System (in progress)

A REST API for managing coffee shop operations with role-based access control, inventory tracking, and order processing.

Overview

Handles coffee shop operations where different staff roles (Cashier, Barista, Manager, Owner) have different permissions. Cashiers take orders, baristas see ingredient details, managers handle inventory and suppliers. When an order is created, the system checks ingredient availability, generates an order number, and automatically deducts items from stock.

Features

  • Custom JWT authentication with token blacklisting (educational experiment)
  • Role-based permissions showing different data to different users
  • Automatic inventory updates when orders are placed or cancelled
  • Email verification and password reset
  • Supplier management and ingredient tracking
  • Activity logging with IP addresses and user agents
  • API documentation with Swagger UI

Stack

Django 5.2 with Django REST Framework and PostgreSQL. Docker Compose runs the app and database in separate containers. Custom user model with role-based permissions. Many-to-many relationships between menu items and ingredients with a component model tracking quantities. Django signals handle automatic inventory updates using database transactions.

The JWT implementation is built from scratch without external libraries using HMAC-SHA256 for signatures. Different serializers control what data each role sees. Order validation checks ingredient availability before processing.

Setup

Create a .env file with database credentials and Django secret key, then run docker-compose up. Application runs on port 8000 with API docs at /rest-api/v1/swagger/

About

rest api for managing coffe shop operations

Resources

Stars

Watchers

Forks