Skip to content

feat: add ChatService sample with React frontend#19

Merged
Theauxm merged 2 commits into
mainfrom
feat/chat-service-sample
Mar 15, 2026
Merged

feat: add ChatService sample with React frontend#19
Theauxm merged 2 commits into
mainfrom
feat/chat-service-sample

Conversation

@Theauxm
Copy link
Copy Markdown
Member

@Theauxm Theauxm commented Mar 15, 2026

Summary

  • New ChatService sample (Model 5) — single-server chat app with real-time GraphQL subscriptions powered by a custom ITrainLifecycleHook
  • Three-project backend: ChatService.Data (EF Core entities, chat schema), ChatService (trains, lifecycle hook, subscriptions), ChatService.Api (single-server web app)
  • React + TypeScript frontend using Apollo Client with split HTTP/WebSocket transport, demonstrating queries, mutations, and onChatEvent subscriptions
  • Optimistic message rendering (pending → confirmed) to show the client/server round-trip visually
  • 31 tests (10 unit, 21 integration) covering lifecycle hook behavior and all train steps

Test plan

  • cd Trax.Samples && docker compose up -d
  • ./pack-local.sh
  • dotnet test tests/Trax.Samples.ChatService.Tests — 31 tests pass
  • dotnet run --project samples/ChatService/Trax.Samples.ChatService.Api
  • cd samples/ChatService/Trax.Samples.ChatService.Client && npm install && npm run dev
  • Open http://localhost:5173 — create room as Alice, switch to Bob, join via room ID, send messages from both, verify real-time delivery via subscription
  • Verify pending message appears light blue then transitions to solid blue on server confirmation

Theauxm added 2 commits March 15, 2026 11:27
Single-server chat application demonstrating lifecycle hooks driving
real-time GraphQL subscriptions. Includes EF Core data layer (chat
schema), six trains (create/join/send/read/history/rooms), a custom
ITrainLifecycleHook that publishes to room-scoped HotChocolate topics,
and a React + TypeScript frontend using Apollo Client with split
HTTP/WebSocket transport for queries, mutations, and subscriptions.
@Theauxm Theauxm merged commit 3c15e4e into main Mar 15, 2026
1 check passed
@Theauxm Theauxm deleted the feat/chat-service-sample branch March 15, 2026 17:46
@traxsharp
Copy link
Copy Markdown

traxsharp Bot commented Mar 15, 2026

This PR is included in version 1.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant