FoodAnywhere is a comprehensive platform designed to make food ordering and delivery easier for both customers and vendors. Vendors can easily register their restaurants, manage their menus, and add products to the system. Customers, on the other hand, can effortlessly search for nearby restaurants, browse menus, and place orders with just a few clicks.
This project uses Django as the backend framework, with PostgreSQL and PostGIS for database management and geographic data handling. The application is containerized using Docker and orchestrated with Kubernetes.
For background task processing, Celery is used, with Redis serving as both the caching layer and the message broker. Monitoring and logging are handled with Grafana, Node Exporter, Promtail, and Loki, Also Jaeger is used for distributed tracing.
Testing is managed with pytest to ensure code quality and reliability.
This project has been set up with monitoring and logging capabilities. The following tools are used for monitoring:
This tool is used to collect system metrics from the nodes in the Kubernetes cluster. It provides information about CPU, memory, disk, and network usage, among other things.
Here is an example of the Node Exporter dashboard in Grafana:
Loki is a log aggregation system that is used to store and query logs from the application. It is integrated with Grafana, which allows for easy visualization and querying of logs.
Here is an example of the Loki dashboard in Grafana:
This Project uses OpenTelemetry as its distributed tracing system. Jaeger is used to collect, store, and visualize traces from the application. It provides insights into the performance of the application and helps identify bottlenecks and issues.
Here is an example of the Jaeger dashboard:
Here is an example of the metrics in grafana:
To make the application easier to understand, we have divided it into several components. Each component is responsible for a specific part of the application. The components are as follows:
This component is responsible for managing user accounts. It handles user registration, and login, as well as user profile management. Authorization is handled using JSON Web Tokens (JWT).
To keep track of active user sessions, this component is used. It stores information about the user, the device, and the IP address of the user's current session.
To find nearby restaurants, this component is used. It stores information about the location of restaurants and provides functionality to search for restaurants based on the user's location.
This component handles all vendor-specific and customer-specific functionalities related to restaurants.
Some functionalities include:
- Registering a new restaurant
- Managing restaurant details
- Viewing Nearby Restaurants
- Viewing Restaurant Details
This component is responsible for managing and displaying products. Vendors can easily add products to their restaurant's menu, while customers can browse products and add them to their cart.
The cart component acts as a temporary storage for products that the user wants to order. It allows users to add, remove, and update products in their cart. All the items get saved in a cache until the user places an order.
The order component is responsible for managing orders for both vendors and customers. Customers can place orders, pay or cancel orders, and view their order history. Vendors can view and manage orders that have been placed at their restaurant. So they can update the status of the order.
This component keeps track of all transactions that occur on the platform. This includes payments made by customers, refunds, and other financial transactions.
You can run FoodAnywhere either using Docker Compose or Kubernetes in either a local or production environment.
To run the application using Docker Compose, follow these steps:
- Clone the repository
git clone https://github.com/mohamad-liyaghi/FoodAnywhere.git
- Change to the project directory
cd FoodAnywhere/
- Run the project
make run
- To run in production mode, use the following command:
make deploy
To run the application using Kubernetes, follow these steps:
- Clone the repository
git clone https://github.com/mohamad-liyaghi/FoodAnywhere.git
- Change to the project directory
cd FoodAnywhere/
- Create ConfigMaps
make local_confmap
- To create ConfigMaps for production, use the following command:
make prod_confmap
- Deploy the application
make k8s
This project uses Pytest for testing. To run the tests, run the following command
make test