Development Guide
Learn the development workflow and common tasks.
Build Commands
# Build entire solution
dotnet build
# Build specific project
dotnet build Backgammon.Server
# Build in release mode
dotnet build -c Release
Running Tests
# Run all tests
dotnet test
# Run with detailed output
dotnet test --verbosity normal
# Run specific test project
dotnet test Backgammon.Tests
Frontend Development
Development Server
cd Backgammon.WebClient
pnpm dev
Hot Module Replacement (HMR) is enabled for instant updates.
TypeScript Checking
pnpm tsc --noEmit
Regenerate SignalR Types
After modifying IGameHub or IGameHubClient:
pnpm generate:signalr
Build for Production
pnpm build
Output goes to wwwroot/ directory.
Code Quality
Backend (StyleCop)
The project enforces StyleCop rules:
- One type per file
- File name matches class name
- XML documentation on public members
- Usings outside namespace
See the StyleCop section in the project's CLAUDE.md file for details.
Frontend (ESLint)
cd Backgammon.WebClient
pnpm lint
Database (DynamoDB Local)
When running via Aspire, DynamoDB Local starts automatically.
For manual setup:
docker run -p 8000:8000 amazon/dynamodb-local
The table is auto-created on server startup.
Common Tasks
Add a New SignalR Method
- Add method signature to
IGameHub.cs - Implement in
GameHub.cs - Regenerate TypeScript types:
pnpm generate:signalr - Use in frontend via
connection.invoke('MethodName', args)
Add a New REST Endpoint
- Add endpoint in
Program.csusing minimal API syntax - Apply
.RequireAuthorization()if auth needed - Apply
.RequireCors(selectedCorsPolicy)
Add a New Page
- Create component in
src/pages/ - Add route in
App.tsx - Update navigation if needed
Debugging
Backend
Set breakpoints in Visual Studio, Rider, or VS Code with the C# extension.
Frontend
Use browser DevTools. React DevTools extension recommended.
SignalR
Enable detailed errors in development:
options.EnableDetailedErrors = builder.Environment.IsDevelopment();
View SignalR logs in browser console.