Skip to content
 
 

Repository files navigation

ShoppingListApp

Built live during the Blazor AI Workshop on May 20th, 2026. A demo of building a real-world Blazor Server app end-to-end using Claude Code with Claude Opus 4.7 as the implementer — one prompt at a time, no scaffolding pre-baked.

The full session is reproducible: every feature in this repo was driven by one of the 9 prompts at the bottom of this file.


What it does

A multi-user shopping list app:

  • Sign up / sign in (ASP.NET Core Identity).
  • Create, rename, delete shopping lists.
  • Add, edit, tick off, delete items per list.
  • Share a list with other users by email — they immediately see the list and can manage its items. No invitation/acceptance flow.
  • Generate ingredients from a recipe with OpenAI — type "pasta napoli for 4 people" and the AI populates the list with the items needed.

Tech stack

  • ASP.NET Core Blazor Server on .NET 10
  • ASP.NET Core Identity (cookie auth, IdentityDbContext<ApplicationUser>)
  • EF Core 10 + SQL Server Express (.\SQLEXPRESS)
  • Vertical Slice Architecture with a custom CQRS mediator (just Send)
  • OpenAI .NET SDK 2.10 (gpt-4o-mini, JSON-object response format)
  • Dark-themed UI with a blue→purple gradient accent

Architecture (TL;DR)

Strict Vertical Slice + custom CQRS. One folder per entity, one folder per use case, one file per type — command, handler, DTO, form model, Razor page all in the slice folder. No services, no repositories; ApplicationDbContext is injected directly into handlers via primary constructors.

Common/Mediator/                           # IRequest, IRequestHandler, IMediator, Mediator
Data/                                      # entities, DbContext, migrations
Features/
├─ ShoppingLists/
│  ├─ CreateShoppingList/
│  ├─ GetShoppingLists/
│  ├─ UpdateShoppingList/
│  └─ DeleteShoppingList/
└─ ShoppingItems/
   ├─ CreateShoppingItem/
   ├─ GetShoppingItems/
   ├─ UpdateShoppingItem/
   ├─ DeleteShoppingItem/
   └─ GenerateItemsFromRecipe/             # OpenAI integration lives here

Full conventions, naming rules, do/don't list: see AGENTS.md. That file is read by Claude Code on every new prompt so future sessions follow the same patterns without re-explaining them.

Authorization model

  • A ShoppingList has an owner (UserId) and a many-to-many set of ShoppingListShares to other users.
  • Owner-only operations: rename list, delete list, manage shares.
  • Owner OR shared operations: see list, all item CRUD, AI recipe generation.
  • The predicate l.UserId == userId || l.Shares.Any(s => s.UserId == userId) is inlined in every relevant handler.

Getting started

1. Prerequisites

  • .NET 10 SDK
  • SQL Server Express (default instance .\SQLEXPRESS)
  • (Optional) An OpenAI API key for the recipe feature

2. Database

The connection string in appsettings.json points to .\SQLEXPRESS and creates a database called ShoppingListApp. To apply the schema:

dotnet ef database update

Or — for environments where the EF tools aren't available (e.g. an Azure SQL deployment) — run the idempotent script:

sqlcmd -S <server> -d <database> -E -i Migrate.sql

Migrate.sql is safe to re-run; each migration block is guarded against __EFMigrationsHistory.

3. OpenAI API key (for the recipe feature)

Stored in .NET user-secrets — never in appsettings.json, never in git:

dotnet user-secrets set "OpenAI:ApiKey" "sk-..."

If the key isn't set, the rest of the app still works; the recipe panel just shows a friendly "API key is not configured" message.

4. Run

dotnet run --launch-profile http

Open http://localhost:5206, register an account, and start a list.


The workshop prompts

These are the exact prompts that produced this repo. Each one led to a single chunk of work — entities, slices, migrations, design, sharing, AI integration.

Prompt 1 — Entities + EF Core wired to SQL Server Express

i want to build an app where users can create shopping lists. each list has items which can be marked as done. for now, please create the entities first. that would be a simple list entity with id, name, items list and the user id. then also the item entity with an id, item name, a field to mark we put the item in the cart and the user id. i would like to use ef core with a local sql server express database. so make sure, that this already works.

Prompt 2 — Read + Create lists, VSA, custom mediator

next, please implement creating and reading shopping lists for the users. for the architecture i would like to use vertical slice architecture. for that, use a feature folder structure, meaning for every entity one folder, then for every use case one folder. additionally, i want to use cqrs with a custom mediator implementation - we only need the send function. use individual files for the commands/queries, handlers, records, classes, dtos, anything really, use best practices. make sure it works first time!!! dont use services or repositories. make sure the logic is in the handlers. use dependency injections and inject the dbcontext in the handlers if necessary.

Prompt 3 — Lock the conventions into AGENTS.md

please create an AGENTS.md file, where you write down all the specs, coding guidelines, the architecture and so on that i told you in the last prompt and what you actually already used for your implementations, so i dont have to tell you that with every single prompt in the future. in particular, make sure to write about the vertical slice architecture, with the folder structure, individual files, and so on

Prompt 4 — Full item CRUD

now, please implement all crud operations for shopping list items

Prompt 5 — Idempotent migration script for Azure

create an idempotent migration script we can use to migrate the database also on azure

Prompt 6 — Visual redesign

let's change the design of the complete page. please use a similar look as in the attached screenshot.

(Reference: a dark-themed dashboard with a left sidebar, gradient blue→purple accents, card-based layout, rounded pill-style active nav state.)

Prompt 7 — Sharing between users

i would like to see a sharing feature, where users can share shopping lists between accounts. so, if one account creates a shopping list or wants to update a shopping list, i also want to be able, to add an email address of another user, so that this user also has access to that specific shopping list. dont implement an invitation system where another user would have to confirm the invitation, just show the other user the shopping list in the list of all shopping lists already. and this invited user then, should also be able to add, update and delete items.

Prompt 8 — Re-generate the migration script for the new schema

update the idempotent migration script please

Prompt 9 — AI recipe-to-ingredients

i would like to have a feature, where i can prompt the openai api with a recipe. meaning, i say something like "i would like to cook pasta napoli", and then the ai api thinks of the items necessary to cook this and add it to the list. so i think we need a textbox to prompt the ai inside a shopping list. please implement that and only show me the environment variable for the api key i have to set in the end.

Prompt 10 — Switch to dotnet user-secrets

please use the dotnet user secrets for the key and use this api key: sk-proj-***


Files worth opening first

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages