# chillicream/graphql-workshop architecture

> Architecture diagram of the GitHub repository chillicream/graphql-workshop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chillicream/graphql-workshop
- Repository: https://github.com/chillicream/graphql-workshop

## Overview

1. This repository is a workshop-style .NET 8 solution that evolves a GraphQL server across seven sessions. The most complete implementation is in `code/session-7`, while earlier session folders are intermediate checkpoints showing how the architecture grows over time.

2. The core runtime is an ASP.NET Core GraphQL server built with Hot Chocolate. `Program.cs` in each session is the composition root: it wires the GraphQL server, registers application services, and connects the schema to the database-backed domain model.

3. Persistence is handled with Entity Framework Core. The `Data` folder contains the `ApplicationDbContext`, entity classes, and migrations; these define the relational model for conference planning data such as speakers, sessions, attendees, tracks, and join entities like `SessionAttendee` and `SessionSpeaker`.

4. The application is organized by GraphQL domain area rather than by classic web layers. In the later sessions, the schema is split into `Sessions`, `Speakers`, `Attendees`, and `Tracks`, each with its own queries, mutations, object types, input types, loaders, exceptions, and in some cases subscriptions.

5. Data flow is GraphQL request → resolver/mutation → EF Core/DbContext → database. Queries generally read through Hot Chocolate types and DataLoaders; mutations create or update entities and return typed payloads; the database is the shared backing store for all modules.

6. DataLoader usage is a major architectural boundary. Session 2 introduces loaders to avoid N+1 access patterns, and later sessions expand that pattern per domain so object graph navigation is resolved through batched lookups rather than ad hoc database calls.

7. The schema layer is strongly modeled. Types like `SessionType`, `SpeakerType`, `AttendeeType`, and `TrackType` define how domain entities are exposed to GraphQL, while input classes like `AddSessionInput`, `RegisterAttendeeInput`, and `RenameTrackInput` define write operations and shape the mutation boundary.

8. Session 4 introduces custom GraphQL middleware and descriptor extensions. The `Extensions` folder contains reusable schema-building behavior such as `UseUpperCaseAttribute` and object field descriptor helpers, which means some field behavior is enforced centrally rather than inside individual resolvers.

9. Session 5 adds more advanced filtering on sessions. `SessionFilterInputType` shows that the query layer is no longer just simple entity retrieval; it now supports richer search/filter semantics that sit between GraphQL clients and the EF Core-backed query model.

10. Session 6 introduces real-time behavior through subscriptions. The `Subscriptions` classes in `Attendees` and `Sessions` indicate a publish/subscribe path alongside the normal query/mutation flow, so clients can receive event-driven updates for conference activity.

11. Session 7 adds automated testing as a first-class architectural component. `GraphQL.Tests` contains schema tests and mutation tests with snapshot files, so schema shape and resolver behavior are validated as part of the repo’s contract.

12. Tooling and environment setup are lightweight but important: the repo pins .NET tooling via `.config/dotnet-tools.json`, uses `docker-compose.yml` per session for local dependencies, and stores app settings per environment. The docs and saved schema snapshots in `GraphQL.Tests/__snapshots__` serve as the authoritative reference for expected API behavior.

Main entry points: [`code/session-7/GraphQL/Program.cs`](https://github.com/chillicream/graphql-workshop/blob/main/code/session-7/GraphQL/Program.cs) (Program), [`code/session-7/GraphQL/Data`](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Data) (Data model), [`code/session-7/GraphQL/Sessions`](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Sessions) (Sessions), [`code/session-2/GraphQL`](https://github.com/chillicream/graphql-workshop/tree/main/code/session-2/GraphQL) (Session 2)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workshop["Workshop sessions"]
  node_session1["Session 1<br/>checkpoint"]
  node_session2["Session 2<br/>checkpoint"]
  node_session3["Session 3<br/>checkpoint"]
  node_session4["Session 4<br/>checkpoint"]
  node_session5["Session 5<br/>checkpoint"]
  node_session6["Session 6<br/>checkpoint"]
  node_session7["Session 7<br/>checkpoint"]
end

subgraph group_app["Final app"]
  node_program(("Program<br/>composition root<br/>[Program.cs]"))
  node_data[("Data model<br/>ef core")]
  node_sessions["Sessions<br/>graphql domain"]
  node_speakers["Speakers<br/>graphql domain"]
  node_attendees["Attendees<br/>graphql domain"]
  node_tracks["Tracks<br/>graphql domain"]
  node_extensions["Extensions<br/>graphql middleware"]
end

subgraph group_support["Support"]
  node_tests["GraphQL tests<br/>verification<br/>[GraphQL.Tests]"]
  node_docs["Workshop docs<br/>documentation"]
  node_tools["Dotnet tools<br/>tooling<br/>[.config]"]
end

node_session1 -->|"evolves into"| node_session2
node_session2 -->|"splits into"| node_session3
node_session3 -->|"adds"| node_session4
node_session4 -->|"extends"| node_session5
node_session5 -->|"adds"| node_session6
node_session6 -->|"finalized by"| node_session7
node_program -->|"configures"| node_data
node_program -->|"registers"| node_sessions
node_program -->|"registers"| node_speakers
node_program -->|"registers"| node_attendees
node_program -->|"registers"| node_tracks
node_program -->|"applies"| node_extensions
node_sessions -->|"reads/writes"| node_data
node_speakers -->|"reads/writes"| node_data
node_attendees -->|"reads/writes"| node_data
node_tracks -->|"reads/writes"| node_data
node_sessions -->|"uses"| node_extensions
node_tests -.->|"verifies"| node_program
node_docs -.->|"describes"| node_session7
node_tools -.->|"supports"| node_program

click node_session1 "https://github.com/chillicream/graphql-workshop/tree/main/code/session-1/GraphQL"
click node_session2 "https://github.com/chillicream/graphql-workshop/tree/main/code/session-2/GraphQL"
click node_session3 "https://github.com/chillicream/graphql-workshop/tree/main/code/session-3/GraphQL"
click node_session4 "https://github.com/chillicream/graphql-workshop/tree/main/code/session-4/GraphQL"
click node_session5 "https://github.com/chillicream/graphql-workshop/tree/main/code/session-5/GraphQL"
click node_session6 "https://github.com/chillicream/graphql-workshop/tree/main/code/session-6/GraphQL"
click node_session7 "https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL"
click node_program "https://github.com/chillicream/graphql-workshop/blob/main/code/session-7/GraphQL/Program.cs"
click node_data "https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Data"
click node_sessions "https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Sessions"
click node_speakers "https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Speakers"
click node_attendees "https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Attendees"
click node_tracks "https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Tracks"
click node_extensions "https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Extensions"
click node_tests "https://github.com/chillicream/graphql-workshop/blob/main/code/session-7/GraphQL.Tests"
click node_docs "https://github.com/chillicream/graphql-workshop/tree/main/docs"
click node_tools "https://github.com/chillicream/graphql-workshop/blob/main/code/session-7/.config"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_session1,node_session2,node_session3,node_session4,node_session5,node_session6,node_session7 toneBlue
class node_program,node_data,node_sessions,node_speakers,node_attendees,node_tracks,node_extensions toneAmber
class node_tests,node_docs,node_tools toneMint
```

## Components

### Workshop sessions

Seven checkpoints showing the architecture evolving over time.

- [Session 1](https://github.com/chillicream/graphql-workshop/tree/main/code/session-1/GraphQL): checkpoint · Initial GraphQL server and first speaker mutation/query slice. · `code/session-1/GraphQL`
- [Session 2](https://github.com/chillicream/graphql-workshop/tree/main/code/session-2/GraphQL): checkpoint · Adds DataLoader-based access and broader conference data model. · `code/session-2/GraphQL`
- [Session 3](https://github.com/chillicream/graphql-workshop/tree/main/code/session-3/GraphQL): checkpoint · Splits the schema into Sessions, Speakers, Attendees, and Tracks. · `code/session-3/GraphQL`
- [Session 4](https://github.com/chillicream/graphql-workshop/tree/main/code/session-4/GraphQL): checkpoint · Introduces reusable GraphQL middleware and descriptor extensions. · `code/session-4/GraphQL`
- [Session 5](https://github.com/chillicream/graphql-workshop/tree/main/code/session-5/GraphQL): checkpoint · Adds richer session filtering in the query layer. · `code/session-5/GraphQL`
- [Session 6](https://github.com/chillicream/graphql-workshop/tree/main/code/session-6/GraphQL): checkpoint · Adds subscriptions for real-time conference updates. · `code/session-6/GraphQL`
- [Session 7](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL): checkpoint · Final server with tests and snapshot-backed schema verification. · `code/session-7/GraphQL`

### Final app

The session-7 GraphQL server and its major runtime boundaries.

- [Program](https://github.com/chillicream/graphql-workshop/blob/main/code/session-7/GraphQL/Program.cs): composition root · ASP.NET Core startup that wires Hot Chocolate, EF Core, and domain modules. · `code/session-7/GraphQL/Program.cs`
- [Data model](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Data): ef core · DbContext, entities, and migrations for conference planning persistence. · `code/session-7/GraphQL/Data`
- [Sessions](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Sessions): graphql domain · Session queries, mutations, filtering, subscriptions, loaders, and types. · `code/session-7/GraphQL/Sessions`
- [Speakers](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Speakers): graphql domain · Speaker queries, mutations, loaders, and GraphQL type mapping. · `code/session-7/GraphQL/Speakers`
- [Attendees](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Attendees): graphql domain · Attendee queries, mutations, subscriptions, loaders, and check-in flow. · `code/session-7/GraphQL/Attendees`
- [Tracks](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Tracks): graphql domain · Track queries, mutations, loaders, and domain exceptions. · `code/session-7/GraphQL/Tracks`
- [Extensions](https://github.com/chillicream/graphql-workshop/tree/main/code/session-7/GraphQL/Extensions): graphql middleware · Shared schema-building behavior and custom field conventions. · `code/session-7/GraphQL/Extensions`

### Support

Tooling, tests, and documentation around the workshop.

- [GraphQL tests](https://github.com/chillicream/graphql-workshop/blob/main/code/session-7/GraphQL.Tests): verification · Schema and mutation tests with snapshots for API contract coverage. · `code/session-7/GraphQL.Tests`
- [Workshop docs](https://github.com/chillicream/graphql-workshop/tree/main/docs): documentation · Session-by-session workshop material and architecture notes. · `docs`
- [Dotnet tools](https://github.com/chillicream/graphql-workshop/blob/main/code/session-7/.config): tooling · Pinned local .NET tooling configuration for the workshop. · `code/session-7/.config`

## Connections

- Session 1 → Session 2: evolves into · The initial server grows DataLoader-backed access patterns.
- Session 2 → Session 3: splits into · The schema is organized into domain-specific modules.
- Session 3 → Session 4: adds · Shared middleware and descriptor extensions are introduced.
- Session 4 → Session 5: extends · Session queries gain richer filtering semantics.
- Session 5 → Session 6: adds · Subscriptions introduce real-time event flow.
- Session 6 → Session 7: finalized by · Testing becomes part of the repository contract.
- Program → Data model: configures · Startup wires persistence and schema dependencies.
- Program → Sessions: registers · The composition root adds the sessions module.
- Program → Speakers: registers · The composition root adds the speakers module.
- Program → Attendees: registers · The composition root adds the attendees module.
- Program → Tracks: registers · The composition root adds the tracks module.
- Program → Extensions: applies · Central schema conventions are applied during setup.
- Sessions → Data model: reads/writes · Session operations flow through EF Core and the shared database.
- Speakers → Data model: reads/writes · Speaker operations persist through the DbContext.
- Attendees → Data model: reads/writes · Attendee registration and check-in persist through EF Core.
- Tracks → Data model: reads/writes · Track operations use the shared relational model.
- Sessions → Extensions: uses · Session fields can inherit shared middleware behavior.
- GraphQL tests → Program: verifies · Tests exercise the server composition and schema behavior.
- Workshop docs → Session 7: describes · Workshop docs explain the final architecture and its progression.
- Dotnet tools → Program: supports · Pinned tooling supports local development and workshop execution.
