Refactor app architecture and clean local artifacts

This commit is contained in:
AzuTear
2026-06-24 23:43:14 +02:00
parent 17134b3b82
commit fef1d36fe8
274 changed files with 37724 additions and 6065 deletions
+48 -9
View File
@@ -4,16 +4,33 @@
The API targets PostgreSQL through EF Core 8 and `Npgsql.EntityFrameworkCore.PostgreSQL`.
Default local development connection string:
Local development is aligned with `../docker-compose.dev.yml` and `appsettings.Development.json`:
```text
Host=localhost;Port=5433;Database=vtuber_star_awards_dev;Username=postgres;Password=postgres
Host=localhost;Port=5433;Database=vtuber_star_awards_dev;Username=vtsa_dev;Password=change-me-local-only
```
You can override it with:
For production or shared deployments, keep checked-in appsettings empty and provide your own value through:
```text
VTSA_POSTGRES
ConnectionStrings__Postgres
```
The API reads its connection string from:
- `Backend/appsettings.Development.json`
- environment variable `VTSA_POSTGRES`
- environment variable `ConnectionStrings__Postgres`
Presentation/demo data is controlled separately:
```text
VTSA_SEED_MODE=demo
```
- `demo`, `presentation` or `sample`: seed local presentation data.
- `none`, `off`, `disabled` or an unset value in Production: do not seed presentation data.
- `Backend/appsettings.Development.json` defaults to `demo`; `Backend/appsettings.json` defaults to `none`.
If Docker is available locally, start a dev database from the repository root with:
@@ -51,20 +68,20 @@ dotnet ef database update
Fallback bootstrap if `dotnet ef` is not usable in the current environment:
```bash
psql "Host=localhost Port=5433 Database=vtuber_star_awards_dev Username=postgres Password=postgres" -f Migrations/InitialCreate.manual.sql
psql "$VTSA_POSTGRES" -f Migrations/InitialCreate.manual.sql
```
Run the API:
```bash
ASPNETCORE_ENVIRONMENT=Development dotnet run
ASPNETCORE_ENVIRONMENT=Development dotnet run --urls http://127.0.0.1:5084
```
Check the API and database wiring:
```bash
curl http://localhost:5084/api/health
curl http://localhost:5084/api/health/database
curl http://127.0.0.1:5084/api/health
curl http://127.0.0.1:5084/api/health/database
```
Development auth/session:
@@ -72,5 +89,27 @@ Development auth/session:
```bash
curl -X POST http://localhost:5084/api/auth/dev-login \
-H "Content-Type: application/json" \
-d '{"twitchUserId":"admin_demo","displayName":"Admin Demo","role":"admin"}'
-d '{"twitchUserId":"jayuhime_admin","displayName":"Jayuhime Admin","role":"admin"}'
```
Demo admin login for public presentations:
```text
VTSA_DEMO_LOGIN_ENABLED=true
VTSA_DEMO_ADMIN_LOGIN=jayuhime_admin
VTSA_DEMO_ADMIN_EMAIL=admin@example.local
VTSA_DEMO_ADMIN_PASSWORD=<set-secure-demo-password>
VTSA_DEMO_ADMIN_TWITCH_ID=jayuhime_admin
VTSA_DEMO_ADMIN_DISPLAY_NAME=Jayuhime Admin
```
The frontend route is `/login`. `VTSA_DEMO_ADMIN_LOGIN` may be a username or an email-style identifier; the backend also accepts the configured email, Twitch ID, and display name for admin flexibility. Disable the demo login for release with `VTSA_DEMO_LOGIN_ENABLED=false`.
Frontend app-wide demo gate:
```text
VITE_DEMO_GATE_ENABLED=true
```
- `true`: the whole Vue app starts at `/login` until a session exists.
- unset or `false`: public pages such as `/` are visible without the initial demo login.