This document provides essential information to help AI agents understand and work effectively with the Tailspin Toys codebase.
Tailspin Toys is a crowdfunding platform for games with a developer theme. The application consists of:
- Backend: ASP.NET Core Minimal API with Entity Framework Core
- Frontend: Blazor Interactive Server
- Styling: Tailwind CSS v4 (dark theme throughout)
- Database: SQLite
- Testing: xUnit (backend), Playwright (frontend)
# Linux/macOS/Codespaces
./scripts/start-app.sh
# Windows (PowerShell)
.\scripts\start-app.ps1
# Access at http://localhost:4321# Linux/macOS/Codespaces
./scripts/run-server-tests.sh # Backend tests
./scripts/run-e2e-tests.sh # Frontend E2E tests
# Windows (PowerShell)
.\scripts\run-server-tests.ps1 # Backend tests
.\scripts\run-e2e-tests.ps1 # Frontend E2E teststailspin-toys/
├── server/ # ASP.NET Core backend
│ ├── TailspinToys.Api/ # API project
│ │ ├── Models/ # Entity Framework Core models
│ │ ├── Routes/ # API endpoints (Minimal API route groups)
│ │ ├── Utils/ # Helper functions
│ │ └── Program.cs # Application initialization
│ └── TailspinToys.Api.Tests/ # xUnit tests
├── client/ # Blazor frontend
│ ├── TailspinToys.Web/ # Blazor web project
│ │ ├── Components/
│ │ │ ├── Layout/ # Layout components
│ │ │ ├── Pages/ # Page components (file-based routing)
│ │ │ └── Shared/ # Reusable components
│ │ ├── Models/ # Client-side data models
│ │ └── wwwroot/ # Static files
│ └── TailspinToys.E2E/ # Playwright E2E tests (C#/xUnit)
├── scripts/ # Development automation scripts
├── data/ # SQLite database files
└── .github/
└── instructions/ # Technology-specific guidelines
Before working with any technology, read the corresponding instruction file:
| Technology | Instruction File | Purpose |
|---|---|---|
| Blazor components | .github/instructions/blazor.instructions.md |
Component patterns, routing, state |
| Tailwind CSS | .github/instructions/tailwindcss.instructions.md |
Dark theme patterns, utility classes |
| ASP.NET Core endpoints | .github/instructions/aspnetcore-endpoint.instructions.md |
Route groups, REST conventions |
| .NET tests | .github/instructions/dotnet-tests.instructions.md |
Test structure, xUnit patterns |
| Playwright tests | .github/instructions/playwright.instructions.md |
E2E test patterns, locators |
Models (server/TailspinToys.Api/Models/)
- Use Entity Framework Core with data annotations
- Include
ToDict()method for JSON serialization - Define relationships clearly with navigation properties
Routes (server/TailspinToys.Api/Routes/)
- Create Minimal API route groups per resource
- Use extension methods:
app.MapGamesRoutes() - Pattern:
group.MapGet("/", async (TailspinToysContext db) => ...) - Register routes in
Program.cs
API Response Format
// Success (200)
return Results.Ok(data);
// Not Found (404)
return Results.NotFound(new { error = "Resource not found" });
// Bad Request (400)
return Results.BadRequest(new { error = "Invalid input" });Component Pattern
@page "/example"
@inject HttpClient Http
<div class="bg-slate-800 rounded-xl p-6">
@if (loading)
{
<LoadingSkeleton />
}
else
{
<h2 class="text-slate-100">@title</h2>
}
</div>
@code {
private bool loading = true;
private string title = "";
protected override async Task OnInitializedAsync()
{
// Fetch data from API
loading = false;
}
}Tailwind Dark Theme
<!-- Standard card pattern -->
<div class="bg-slate-800 rounded-xl p-6 shadow-lg border border-slate-700">
<h2 class="text-slate-100 text-2xl font-bold">Title</h2>
<p class="text-slate-300">Description</p>
</div>Structure (server/TailspinToys.Api.Tests/)
- Use xUnit with
WebApplicationFactory<Program> - Use InMemoryDatabase for test isolation
- Define test data as class constants
- Implement
IDisposablefor cleanup
Existing E2E Tests (client/TailspinToys.E2E/)
The project includes comprehensive Playwright E2E tests written in C# with xUnit:
HomeTests.cs- Homepage display and contentGamesTests.cs- Game listing, navigation, and details pagesAccessibilityTests.cs- Accessibility compliance tests
Before creating new E2E tests, check existing coverage in client/TailspinToys.E2E/.
Playwright Patterns
- Use role-based locators:
getByRole,getByLabel,getByText - Use
test.step()for grouping - Auto-retrying assertions:
await expect(locator).toHaveText() - NEVER use
waitForTimeoutor hard-coded waits
Testability Requirement
- ALL interactive elements MUST have
data-testidattributes - Use descriptive IDs:
data-testid="game-card"
- Explore the project - understand existing patterns
- Read relevant instruction files - follow established conventions
- Create TODO list for complex tasks
- Make minimal changes - surgical, precise edits only
- Follow existing patterns - consistency is critical
- Use absolute paths - for scripts and file operations
- Add type annotations - required for all C# code
- Run backend tests:
./scripts/run-server-tests.sh(or.\scripts\run-server-tests.ps1on Windows) - Run frontend tests (if UI changed):
./scripts/run-e2e-tests.sh(or.\scripts\run-e2e-tests.ps1on Windows) - Update tests - if adding/modifying API endpoints or UI
- Update README - if adding new functionality
- Update instructions - if patterns change
- Read
.github/instructions/aspnetcore-endpoint.instructions.md - Create/update route group in
server/TailspinToys.Api/Routes/ - Register routes in
Program.cs - Add tests in
server/TailspinToys.Api.Tests/ - Run
./scripts/run-server-tests.sh(or.\scripts\run-server-tests.ps1on Windows)
- Read
.github/instructions/blazor.instructions.md - Create
.razorfile inclient/TailspinToys.Web/Components/Pages/ - Use existing layout with
@layout MainLayout - Add interactive components with
@rendermode InteractiveServer
- Read
.github/instructions/blazor.instructions.md - Create
.razorfile inComponents/Shared/ - Use
[Parameter]for component inputs - Add
data-testidto interactive elements - Apply Tailwind dark theme classes
| Script (Bash) | Script (PowerShell) | Purpose |
|---|---|---|
./scripts/setup-env.sh |
.\scripts\setup-env.ps1 |
Restore .NET dependencies |
./scripts/start-app.sh |
.\scripts\start-app.ps1 |
Start both backend and frontend servers |
./scripts/run-server-tests.sh |
.\scripts\run-server-tests.ps1 |
Run xUnit tests |
./scripts/run-e2e-tests.sh |
.\scripts\run-e2e-tests.ps1 |
Run Playwright E2E tests |
Always use existing scripts rather than performing operations manually. Use .sh scripts on Linux/macOS/Codespaces and .ps1 scripts on Windows.
- ✅ Explore before generating code
- ✅ Read instruction files before working with technology
- ✅ Create TODO lists for multi-step tasks
- ✅ Use absolute paths for scripts
- ❌ Don't generate summary markdown files
- ❌ Don't ignore existing patterns
- ✅ Type annotations for all C# code
- ✅ Descriptive variable/function names
- ✅ Follow REST conventions for APIs
- ✅ Dark theme throughout UI
- ✅ Accessibility (semantic HTML, ARIA labels)
- ✅ Test all API endpoints
- ✅ Add
data-testidto interactive elements - ✅ Use web-first assertions in Playwright
- ✅ Run tests before committing
- ❌ Don't skip test coverage for new features
Key models in server/TailspinToys.Api/Models/:
- Game: Crowdfunding game projects (title, description, star rating)
- Category: Game categories (Strategy, Puzzle, etc.)
- Publisher: Game publishers
Relationships use Entity Framework Core with Include for eager loading.
- Base URL:
/api/<resource> - GET
/api/games- List all games - GET
/api/games/<id>- Get single game
All endpoints return JSON with appropriate status codes.
- Use semantic HTML elements (
<nav>,<main>,<article>,<button>) - Provide ARIA labels where needed
- Ensure keyboard navigation works
- Visible focus states:
focus:ring-2 focus:ring-blue-500 - Sufficient color contrast in dark theme
When creating workflows (.github/workflows/):
- Set explicit permissions
- Follow security best practices
- Add comments documenting tasks
- Test thoroughly before committing
- Check the relevant instruction file in
.github/instructions/ - Review existing code for patterns
- Examine test files for usage examples
- Refer to
copilot-instructions.mdfor general guidelines