Skip to main content
This quickstart guide will walk you through creating your first kitchen order using the FoodTech Kitchen Service REST API. You’ll learn how to send an order that automatically gets decomposed into station-specific tasks.

What You’ll Build

You’ll create a complete restaurant order that includes:
  • Drinks that go to the BAR station
  • Hot dishes that go to the HOT_KITCHEN station
  • Cold dishes that go to the COLD_KITCHEN station
The system will automatically decompose your order into tasks and execute preparation commands for each kitchen station.

Prerequisites

Before you begin, make sure you have:

Service Running

FoodTech Kitchen Service running on http://localhost:8080

HTTP Client

curl, Postman, or any HTTP client installed
If you haven’t installed the service yet, check out the Installation Guide first.

Create Your First Order

1

Prepare the order request

The order consists of a table number and a list of products. Each product has a name and a type.Available product types:
  • DRINK - Beverages (routed to BAR)
  • HOT_DISH - Hot meals (routed to HOT_KITCHEN)
  • COLD_DISH - Salads and cold items (routed to COLD_KITCHEN)
{
  "tableNumber": "A1",
  "products": [
    {"name": "Coca Cola", "type": "DRINK"},
    {"name": "Sprite", "type": "DRINK"},
    {"name": "Pizza Margherita", "type": "HOT_DISH"},
    {"name": "Grilled Salmon", "type": "HOT_DISH"},
    {"name": "Caesar Salad", "type": "COLD_DISH"}
  ]
}
2

Send the POST request

Use curl to send the order to the /api/orders endpoint:
curl -X POST http://localhost:8080/api/orders \
  -H "Content-Type: application/json" \
  -d '{
    "tableNumber": "A1",
    "products": [
      {"name": "Coca Cola", "type": "DRINK"},
      {"name": "Sprite", "type": "DRINK"},
      {"name": "Pizza Margherita", "type": "HOT_DISH"},
      {"name": "Grilled Salmon", "type": "HOT_DISH"},
      {"name": "Caesar Salad", "type": "COLD_DISH"}
    ]
  }'
3

Verify the response

You should receive a 201 Created response with the following structure:
{
  "tableNumber": "A1",
  "tasksCreated": 3,
  "message": "Order processed successfully"
}
The order was decomposed into 3 tasks - one for each kitchen station:
  • BAR: 2 drinks (Coca Cola, Sprite) - 6 seconds total
  • HOT_KITCHEN: 2 hot dishes (Pizza, Salmon) - 14 seconds total
  • COLD_KITCHEN: 1 cold dish (Caesar Salad) - 5 seconds total
4

Check the server logs

In your server console, you’ll see the Command Pattern in action as each station processes its tasks:
[BAR] 🍹 Starting preparation of 2 drink(s)
[BAR] Preparing drink 1/2: Coca Cola
[BAR] ✓ Coca Cola ready!
[BAR] Preparing drink 2/2: Sprite
[BAR] ✓ Sprite ready!
[BAR] ✅ All drinks completed in 6 seconds

[HOT_KITCHEN] 🔥 Starting preparation of 2 hot dish(es)
[HOT_KITCHEN] Cooking dish 1/2: Pizza Margherita
[HOT_KITCHEN] ✓ Pizza Margherita ready!
[HOT_KITCHEN] Cooking dish 2/2: Grilled Salmon
[HOT_KITCHEN] ✓ Grilled Salmon ready!
[HOT_KITCHEN] ✅ All hot dishes completed in 14 seconds

[COLD_KITCHEN] 🥗 Starting preparation of 1 cold dish(es)
[COLD_KITCHEN] Preparing dish 1/1: Caesar Salad
[COLD_KITCHEN] ✓ Caesar Salad ready!
[COLD_KITCHEN] ✅ All cold dishes completed in 5 seconds
The preparation is simulated with Thread.sleep(). Each product type has different preparation times:
  • DRINK: 3 seconds per item
  • HOT_DISH: 7 seconds per item
  • COLD_DISH: 5 seconds per item

Understanding the Flow

Here’s what happens when you create an order:

Key Architecture Patterns

Hexagonal Architecture

Clean separation between domain, application, and infrastructure layers defined in ProcessOrderUseCase.java:14

Command Pattern

Each station has a dedicated command class (PrepareDrinkCommand.java:8, PrepareHotDishCommand.java, PrepareColdDishCommand.java)

Repository Pattern

Abstracted persistence through port interfaces in the application layer

Factory Pattern

TaskFactory and CommandFactory create appropriate objects based on station type

Testing Different Scenarios

Try these variations to see how the system handles different order types:
curl -X POST http://localhost:8080/api/orders \
  -H "Content-Type: application/json" \
  -d '{
    "tableNumber": "B2",
    "products": [
      {"name": "Mojito", "type": "DRINK"},
      {"name": "Margarita", "type": "DRINK"},
      {"name": "Piña Colada", "type": "DRINK"}
    ]
  }'

Error Handling

The API provides clear error messages for invalid requests:
# Request with invalid type
curl -X POST http://localhost:8080/api/orders \
  -H "Content-Type: application/json" \
  -d '{
    "tableNumber": "A1",
    "products": [
      {"name": "Pizza", "type": "INVALID_TYPE"}
    ]
  }'

# Response: 400 Bad Request
# {
#   "error": "Invalid product type: INVALID_TYPE",
#   "timestamp": "2026-01-15T10:30:00"
# }

Next Steps

API Reference

Explore all available endpoints and their parameters

Architecture Guide

Deep dive into the hexagonal architecture and design patterns

Task Management

Learn how to query and manage kitchen tasks

Domain Model

Understand the core domain entities and business logic

Troubleshooting

Make sure the service is running on port 8080:
# Check if service is running
curl http://localhost:8080/actuator/health

# Or check if port is in use
lsof -i :8080
Ensure your JSON is properly formatted:
  • Use double quotes for strings
  • Include Content-Type header
  • Validate JSON syntax with a linter
The service has CORS enabled by default for development. If you encounter issues, check the CorsConfig.java configuration.

Build docs developers (and LLMs) love