The Kitchen Box API is an application designed to manage the operations of a kitchen box service. It provides various endpoints for ingredient and recipe management, as well as the creation and fulfillment of customer orders. The primary goal is to deliver fresh ingredients to customers by checking the boxes that have been ordered on a weekly basis.
To run this application, Docker is required. Follow the steps below to set up the project:
- Run the
start.sh
bash script located at the root of the project. This script initializes the services, including a MySQL database. - If you want to seed the tables with sample data, uncomment the seeders in
database/seeders/DatabaseSeeder.php
before starting the application.
The application runs on port 8080
.
The following endpoints are available in the API:
- Create an ingredient:
POST http://localhost:8080/api/ingredients
Example payload:
{
"name": "Sugar",
"measure": "g",
"supplier": "ABC Supplier"
}
- List ingredients with pagination:
GET http://localhost:8080/api/ingredients?page=1
- Create a recipe:
POST http://localhost:8080/api/recipes
Example payload:
{
"name": "Chocolate Cake",
"description": "A delicious chocolate cake recipe",
"ingredients": [
{
"id": 1,
"amount": 200
},
{
"id": 2,
"amount": 10
}
]
}
- List recipes with pagination:
GET http://localhost:8080/api/recipes?page=1
- Login: (returns a token)
POST http://localhost:8080/api/login
Example payload:
{
"email": "[email protected]",
"password": "password"
}
- Create a box for a customer: (authentication required, include the token in the headers as a Bearer Token)
POST http://localhost:8080/api/boxes
Example payload:
{
"delivery_date": "2023-07-01",
"recipe_ids": [1, 2, 3]
}
- List of ingredients to be ordered:
GET http://localhost:8080/api/ingredients/order?order_date=2023-07-01
- Write unit and integration tests