Skip to content

Development

Leandro Battochio edited this page Nov 8, 2026 · 2 revisions

Architecture

Frontend

  • React 19
  • Vite 7
  • TypeScript
  • TanStack Query
  • Tailwind CSS + Radix UI + Monaco editor + Monaco YAML services

The frontend runs on http://localhost:8080 in development and proxies /api requests to the backend on http://localhost:5000.

Backend

  • ASP.NET Core Web API on .NET 10
  • Entity Framework Core with SQLite (default) or PostgreSQL
  • Hangfire + Hangfire.Storage.SQLite
  • Scalar/OpenAPI in development
  • YAML plugin engine built on YamlDotNet

The production container serves the API and the built frontend together on port 3000.

Local development

Requirements

  • Node.js 22+
  • pnpm
  • .NET SDK 10

Local development config

appsettings.Development.json is intentionally untracked. If you want local development defaults, create backend/src/TrackerStats.Api/appsettings.Development.json on your machine.

Example:

{
  "Data": {
    "Directory": "../../.data"
  }
}

Notes:

  • Keep this file local only. Do not commit machine-specific or secret values.
  • Use environment variables instead when you want settings that also work in CI or Docker.
  • Set Data:Directory to a writable local folder; ../../.data resolves to backend/.data. Plugins are read from <Data:Directory>/plugins/official, overrides and custom; on start, the app downloads the official plugins from trackarr-plugins. To work offline, set PluginSource:Url to the test fixture, file:///<repo>/backend/tests/fixtures/plugin-source/. On start, the app also reads the trackarr releases from the GitHub Releases API once, unauthenticated; AppReleases:Url replaces that URL.
  • The app uses SQLite at <Data:Directory>/trackarr.db. To work against PostgreSQL, add "ConnectionStrings": { "PostgresConnection": "Host=127.0.0.1;Port=5432;Database=trackarr;Username=trackarr;Password=trackarr" } and create that database first (see Using PostgreSQL).

1. Run the backend

cd backend
dotnet restore TrackerStats.sln
dotnet run --project src\TrackerStats.Api\TrackerStats.Api.csproj

Development defaults:

  • API: http://localhost:5000
  • OpenAPI + Scalar UI: http://localhost:5000/scalar/v1
  • Hangfire dashboard: http://localhost:5000/hangfire

On startup the backend:

  • applies EF Core migrations automatically to the database in use (SQLite, or PostgreSQL when it is configured)
  • creates the default application settings row if it does not exist
  • schedules recurring jobs for saved integrations

2. Run the frontend

cd frontend
pnpm install
pnpm dev

Frontend dev server:

  • App: http://localhost:8080
  • API proxy: /api -> http://localhost:5000

Changing the database model

The model lives in AppDbContext. Each database has its own migration set: SqliteAppDbContext in Migrations/Sqlite and PostgresAppDbContext in Migrations/Postgres. A model change needs a migration in both sets, with the same name. From backend/:

dotnet tool install --global dotnet-ef --version 10.0.4

dotnet ef migrations add <Name> --project src/TrackerStats.Infrastructure --startup-project src/TrackerStats.Api --context SqliteAppDbContext --output-dir Migrations/Sqlite
dotnet ef migrations add <Name> --project src/TrackerStats.Infrastructure --startup-project src/TrackerStats.Api --context PostgresAppDbContext --output-dir Migrations/Postgres

Neither command needs a database or a connection string. The backend tests fail while either set lags the model (Database.HasPendingModelChanges()), and so does CI.

End-to-end tests

tests/TrackerStats.Api.EndToEndTests boots the API on each database. Every test has a Database trait: Sqlite tests need nothing else, Postgres tests start PostgreSQL with Testcontainers and need Docker. From backend/:

dotnet test tests/TrackerStats.Api.EndToEndTests --filter Database=Sqlite
dotnet test tests/TrackerStats.Api.EndToEndTests --filter Database=Postgres

The Full Stack E2E workflow runs once per database: that half of the tests, then the Cypress specs against the app on that database.

README media

The GIFs in the README are recorded from the running app, on a desktop and on an iPhone viewport, with fictional demo data. The scripts are in frontend/scripts/readme-media/:

  1. Start the backend with an empty Data__Directory (SQLite), then the frontend with pnpm dev.
  2. Load the demo data: sqlite3 <Data__Directory>/trackarr.db < frontend/scripts/readme-media/seed.sql.
  3. From frontend/, run node scripts/readme-media/record.mjs, optionally followed by scenario names (dashboard, snapshots, plugins). It needs Playwright's Chromium (pnpm exec playwright install chromium) and ffmpeg, and writes docs/media/<scenario>-<desktop|mobile>.gif.

Clone this wiki locally