Welcome and the Roastery Tour

9:00 – 9:20 AM

The goal of the first twenty minutes is simple: everyone has a running starter, everyone knows what they will have built by 5 PM, and everyone knows how to recover if they fall behind.

The finished product

The instructor demonstrates the completed Roastery API end to end:

  1. Browse the menu at GET /api/v1/products with no token.
  2. Sign in as a customer and place an order.
  3. Sign in as a barista and move the order from Pending to Roasting to Ready.
  4. Watch the whole flow appear as a trace in the .NET Aspire dashboard, including the retries against the flaky payment provider and the background notification that fires when the order is ready.

Everything in that demo is something you build today.

The domain in one picture

classDiagram
    class Product {
        int Id
        string Name
        string Roast
        decimal Price
        int StockQuantity
    }
    class Customer {
        int Id
        string Name
        string Email
    }
    class Order {
        int Id
        int CustomerId
        OrderStatus Status
        decimal Total
        DateTimeOffset PlacedAt
    }
    class OrderLine {
        int Id
        int OrderId
        int ProductId
        int Quantity
        decimal UnitPrice
    }
    Customer "1" --> "*" Order
    Order "1" --> "*" OrderLine
    OrderLine "*" --> "1" Product

Orders move through a fixed lifecycle, and the API enforces it:

stateDiagram-v2
    [*] --> Pending
    Pending --> Roasting
    Roasting --> Ready
    Ready --> PickedUp
    Pending --> Cancelled
    PickedUp --> [*]
    Cancelled --> [*]

Two kinds of users

Role Seed account Can
Customer sam@example.com Browse the menu, place orders, view their own orders
Staff barista@roastery.dev Everything a customer can, plus manage products and advance any order

The password for both seed accounts is in the README of the src folder. They exist only for the workshop.

Repo layout

src/
  00-start/          ← where you begin: an empty Minimal API with /health
  Roastery.Api/      ← the project you build all day
  Roastery.Payments/ ← a tiny fake payment provider that fails 30% of the time (Module 4)
  Roastery.Tests/    ← integration tests (Module 4)
  Roastery.AppHost/  ← .NET Aspire orchestration (Module 5)
  Roastery.ServiceDefaults/
http/
  module-1.http … module-5.http
docs/                ← this site

Checkpoints

Every lab ends at a git tag. If you fall behind, or something goes wrong that you cannot fix in a minute or two, do this and keep going with the group:

git stash            # keep your work if you want it later
git checkout checkpoint-2

Nobody is stuck at 2 PM because of a typo at 10 AM.

Environment check

Before Module 1 begins, everyone runs the starter and confirms the health endpoint:

cd src/00-start
dotnet run

Then open https://localhost:7181/health. If you see Healthy, you are ready. If not, raise a hand now; a helper will come by while the instructor starts Module 1.