1.5 KiB
1.5 KiB
Backend
PostgreSQL
The API targets PostgreSQL through EF Core 8 and Npgsql.EntityFrameworkCore.PostgreSQL.
Default local development connection string:
Host=localhost;Port=5433;Database=vtuber_star_awards_dev;Username=postgres;Password=postgres
You can override it with:
Backend/appsettings.Development.json- environment variable
VTSA_POSTGRES
If Docker is available locally, start a dev database from the repository root with:
docker compose -f docker-compose.dev.yml up -d
Commands
Restore and build:
dotnet restore
dotnet build
Create a migration:
dotnet ef migrations add InitialCreate
Generate a SQL migration script:
dotnet ef migrations script 0 20260617060000_InitialCreate --output Migrations/InitialCreate.sql
Apply migrations once PostgreSQL is running:
dotnet ef database update
Fallback bootstrap if dotnet ef is not usable in the current environment:
psql "Host=localhost Port=5433 Database=vtuber_star_awards_dev Username=postgres Password=postgres" -f Migrations/InitialCreate.manual.sql
Run the API:
ASPNETCORE_ENVIRONMENT=Development dotnet run
Check the API and database wiring:
curl http://localhost:5084/api/health
curl http://localhost:5084/api/health/database
Development auth/session:
curl -X POST http://localhost:5084/api/auth/dev-login \
-H "Content-Type: application/json" \
-d '{"twitchUserId":"admin_demo","displayName":"Admin Demo","role":"admin"}'