Skip to content

Backend API Overview

SimCopilot.Api is an ASP.NET Core 8 REST API deployed on Railway. It handles authentication, session cloud sync, leaderboards, AI coaching, and the SafeWatch admin dashboard.


Stack

Component Technology
Runtime .NET 8, ASP.NET Core 8
Database Neon Postgres (EF Core 8)
Cache Redis
Auth JWT Bearer + OAuth PKCE
AI Anthropic Claude API
Monitoring Sentry, Prometheus, Serilog
Hosting Railway (Docker)

URL Structure

Prefix Purpose
/v1/auth Authentication (OAuth, email/password, token exchange)
/v1/sessions Session upload (requires JWT)
/v1/leaderboards Leaderboard read + submission
/v1/ai AI coach (requires JWT)
/v1/feed Activity stream (requires JWT)
/v1/achievements Achievement catalog + user achievements
/v1/tracks Track listing
/v1/profile User profile
/safewatch Admin dashboard (Blazor Server, separate auth)
/health Healthchecks
/metrics Prometheus metrics

Project Layout

SimCopilot.Api/src/SimCopilot.Api/
├── Program.cs              Service registration + middleware pipeline
├── Controllers/            MVC controllers per resource
├── Data/
│   ├── AppDbContext.cs     EF Core DbContext
│   └── Migrations/         EF Core migration files
├── Auth/                   JWT service, OAuth handlers, PKCE
├── Services/               Business logic (Feed, Achievement, etc.)
└── SafeWatch/              Admin dashboard (see SafeWatch section)

See Endpoints, Auth System, Data Model, and Background Services for details.