Skip to content

API Layer

Project: KeDevO.YardPro.API Type: ASP.NET Core Web API (.NET 10.0) Base URL: https://localhost:7254 (dev) / https://api.yardpro.uk (prod)

Architecture Role

Web (Blazor Server) → HTTP → API → Infrastructure → Database
                                  → Integration (eBay, Facebook)
                                  → NHTSA (VIN decode)

The API is the single gateway to all data and external integrations.

Dependencies

Dependency Version Purpose
Swashbuckle.AspNetCore 10.1.1 Swagger UI
JwtBearer 10.0.2 JWT token validation
EF Core SQLite 10.0.2 Database
CsvHelper 33.1.0 Vehicle catalog CSV import
QRCoder 1.7.0 QR code generation for labels

Startup Pipeline

  1. Blazor Server + Razor Components
  2. EF Core — SQLite with auto-migration on startup
  3. JWT Auth — HMAC SHA-256 signing, 1-hour token lifetime
  4. Swagger — At root /, ReDoc at /docs
  5. Security Headers — X-Content-Type-Options, X-Frame-Options, X-XSS-Protection
  6. CORS — Permissive for development
  7. Static files — For media uploads

Controllers (20)

AuthController — api/auth

JWT login endpoint.

VehiclesController — api/vehicle

CRUD, VIN lookup via NHTSA, search with make/model/status filters.

PartsController — api/parts

CRUD, reserve/sell workflow (transactional: create customer → invoice → payment → mark sold).

EbayController — api/ebay (9 partial class files)

  • Authentication — OAuth consent URL, token callback, account management
  • Listings — Create/update/withdraw/bulk operations
  • Orders — Sync and acknowledge
  • Templates — Listing template CRUD
  • Category Mappings — Part category → eBay category
  • Business Policies — Fulfillment, return, payment policies

FacebookController — api/facebook

Account connection, page posting, engagement tracking.

Services

Service Purpose
CarApiService NHTSA VIN decoding
InterchangeGenerationService Part interchange matching
InvoiceService Transactional sell: invoice → payment → status
MediaService File upload/delete/reorder
VehicleCatalogImportService CSV import with batch insert (1000/batch)

Development Setup

dotnet restore
dotnet run --project API

# Swagger UI: https://localhost:7254
# Database auto-created: API/yardpro.db