The Café Order Management System is a Command-Line Interface (CLI) application built to manage a café’s product catalog, customer details, courier assignments, and order tracking. The project has transitioned from file-based storage to PostgreSQL, enabling more robust data persistence, integrity, and scalability. Users can create, view, update, and delete data in real-time, directly via the terminal.
This project was built as part of a mini challenge to demonstrate database integration and CRUD operations in Python.
Local cafés need a lightweight yet reliable tool to manage day-to-day operations, including:
- Taking customer orders
- Managing couriers and products
- Tracking the status of each order
- Ensuring that all data is stored and persisted securely
Previously, this was handled using CSV and text files, which posed challenges in consistency, scaling, and data accuracy.
The CLI Order Management System addresses these issues by:
- Replacing CSV/text storage with PostgreSQL for structured, queryable data
- Offering full CRUD operations for products, customers, couriers, and orders
- Introducing real-time order tracking and inventory monitoring (in progress)
- Providing a modular, extensible codebase that supports additional features like CSV import/export
- ✅ Display orders by status or assigned courier
- ✅ Full CRUD for customers
- ⚙️ Product inventory tracking (partially complete)
- 🛠️ Planned: CSV import/export support for major entities
- ✅ All data stored in a PostgreSQL database
- ✅ Tables include: Products, Couriers, Orders, Order Status, Customers
-
✅ Create, view, update, and delete:
- Products
- Couriers
- Orders
-
✅ Update order status
-
✅ Persist all data to PostgreSQL
- ✅ Display orders by status/courier
- ✅ CRUD functionality for customers
- ⚙️ Inventory tracking (in progress)
- 🔜 CSV import/export
Ensure the following are installed:
- Python 3.12+
psycopg2-binarypython-dotenv==0.15.0- A running PostgreSQL database with the appropriate tables
python main.pypytest test_functions.pyAdditional test cases are outlined in testcase.txt.
| Table | Fields |
|---|---|
| Products | id, name, price |
| Couriers | id, first_name, last_name, phone |
| Orders | id, customer_id, courier_id, status_id, items |
| Order Status | id, order_status |
| Customers | id, first_name, last_name, phone |
- Products Menu: View, create, update, delete
- Couriers Menu: View, create, update, delete
- Orders Menu: View, update status, update order, delete
- Customers Menu: View, create, update, delete
- All core features tested and functional
- Modular and reusable codebase
- Data persists correctly across sessions
- Team (or solo) review confirms task completion
- Code committed to repository
- Python – Main language used for CLI and logic
- PostgreSQL – Relational database for persistence
- psycopg2 – PostgreSQL connector for Python
- dotenv – Manage environment variables securely
- pytest – For testing reusable functions
What worked well? Building reusable functions and watching the CLI menus interact smoothly with the database was especially satisfying. Each refactor made the system more maintainable.
What could be improved with more time?
- Refactor for separation of concerns (e.g., separate
order_productslogic) - Delete cascading logic for related entries
- Full suite of unit tests
- Finalize inventory tracking logic
├── data/
├── src/
│ ├── database/
│ ├── menus/
│ └── utils/
├── test_functions.py
├── testcase.txt
├── .env
├── README.md
└── main.py
- Separate menu for managing
order_products - Implement cascading deletes (e.g., when an order is removed)
- Integrate CSV import/export for bulk data management
- Deploy using Docker for easy replication across systems